Ok I'm using AGS 2.71 and i want to know someting.
I want to check if character is in view 2 if it is then the character will say someting and if not say something else I understand how to make character say something so how do I check what view character is in i know it goes like this:
if (?) {
character[EGO].Say("text");
}
else {
character[EGO].Say("text");
}
Now what do I have to put where the question mark is?
if (character[EGO].View==2) {
character[EGO].Say("text");
}
else {
character[EGO].Say("text");
}
Also be aware that using the character[] array is outdated, you can do it more concisely with the script-o-matic name displayed in the character editor, like
if (cEgo.View==2) {
cEgo.Say("text");
}
else {
cEgo.Say("text");
}
Thanks if I have more if problems I'll post it in this topic
The character[] array is not outdated, it's very useful if you want to iterate on the character #, like for example setting stuff of multiple characters with a while loop.
However, if you're referring to a specific character then yes, cEgo is more preferred and more readible for current versions of AGS.
I have another problem with 'if' how do I check that player has a inventory item?Please help those sneaky monsters (if-s) are very hard to me!
Character.InventoryQuantity (http://www.adventuregamestudio.co.uk/manual/Character.InventoryQuantity.htm)
See also this post (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=25926.0) from not that long ago (amongst others) for an example of it in an if statement.
Ok thanks it worked but how do I check if character is animating but not animating any animation but for example view 1 loop 1
Read the manual - these questions don't seem to be problems with ifs so much as just not knowing which functions/properties to use in them. Which you should do, once you've read the manual.
In this case, you'll need to use a few different ones - Character.View, Character.Loop and Character.Animating. e.g.:
if (cEgo.Animating && cEgo.View == 1 && cEgo.Loop == 1) {
//Do stuff
}
Thanks! I too dumb to use the manual :-[