Killing in quest?

Xecutioner
17 Jan 2014, 18:49
I did not even know that there was a "Kill" command in Quest until I used the debug mode. I do not know what this does or how to implement it. Please tell me how. Thanks. :D :D :D :D :D

HegemonKhan
18 Jan 2014, 06:16
"kill" is a built-in Verb (lower left corner of screen in GUI~Editor: Filter -> Show Library Elements):

but, I'm not too sure how it works, as I've not used it myself.

or, you can create your own by:

a Boolean ( boolean = 'flag' ) Attribute

for example:

<object name=orc">
-> <inherit name="editor_object" />
-> <attr name="dead" type="boolean">false</attr>
</object>

"orc" (Object) -> Verb (Tab) -> Add ->

(Object: orc)
Attribute (1) Name: dead
Attribute (1) Type: boolean
Attribute (1) Value: false

orc.dead=false

you "fight" (Verb) the "orc", and kill it:
orc.dead=true

"orc" Object's "fight" Verb:

if (orc.dead=true) {
-> msg ("he's already dead, silly")
} else if (orc.dead=false) {
-> orc.hit_points = orc.hit_points - player.damage
-> msg ("you attack the orc for damage")
-> if (orc.hit_points <= 0) {
->-> orc.dead=true
->-> msg ("You killed the orc")
-> }
}

or, if you want to end the game, such as if your character dies:

"finish" Script

if you need help or got any questions let me know.

Xecutioner
18 Jan 2014, 15:40
I don't want a battle to occur when I run the script. I just want a simple "Kill" to happen. how can I do that?

HegemonKhan
18 Jan 2014, 20:46
well, what do you want "kill" to entail (happen~do~mean) ?? what do you mean by "kill", what do you want it to do ???

here's as simple as you can get (barring what you want done by your "kill" Verb):

(example only)

Creation (initial setting and adding~"attaching" the Attribute to an Object) of the "Object.Attribute" in the GUI~Editor:

"orc" (Object) -> Attribute (Tab) -> Attribute -> Add ->

Attribute (1) Name: dead
Attribute (1) Type: boolean
Attribute (1) Value: false

In-Code (or in, for example a Verb's, Scripting~Action, to set it, of the GUI~Editor) this is it's syntax:

orc.dead=false

"orc" (Object) -> Verb (Tab) -> Add ->

Verb (1) Name: kill
Verb (1) Script: run as script ->

add a script -> Variables -> Set a variable or attribute ->

left of the equal sign: orc.dead
right of the equal sign: true
(orc.dead=true) // we just "re-set" (or changed) this attribute (from "orc.dead=false"~alive, to "orc.dead=true"~dead)

(or, you can use the "Set object flag on" Script ~ Object: orc, Flag~Boolean: dead ~ I think this is how it's done hopefully, lol)

add a script -> Output -> Print a message [MESSAGE] -> You killed the orc, it is dead.

jaynabonne
19 Jan 2014, 23:22
Since kill is a verb, you can just add a verb to the object you want to kill and then implement it either with a message or script.

For example, add a "monster" object to your game. Then click on monster and go to "verbs". Click "Add" and enter "kill" for the name. Then you have choices of printing a message, running a script, etc. which will occur when you type "kill monster". You can make the script do whatever you like.