i must be blind but i cant find anything in the docs about this...
how do i script item interactions? specifically, i want some stuff to happen if a certain item is used on a certain character, how do i do this?
put the interaction in the character section of the AGS
use the if item number# was used conditional
Go to the character pane, click on the 'interactions' button, and select the 'use inventory item' interaction. There, insert the script you want to run.
And these fraggin' newcomers think they know everything... And I didn't say that!
i found the "use inventory on character" bit in the character pane, but the problem specifically is how do i check for WHICH item was used?
for the life of me i cant find this in the manual.
in other words please tell me XXXXX should be:
//item 1 = cup
//item 2 = key
if (XXXXXX == 1) {
Display("You cant unlock a door with a cup!");
}
else if (XXXXX == 2) {
Display("You unlock the door.");
//blahblah bits to unlock door etc etc
}
under Inventory used on character (in the interaction editor) select new actions and scroll to find conditional-inv. item was used. This allows you too define which item does what.
EDIT: sorry, Im not sure how to find out what the inventory used is script is.
thanks for that tip!
the interaction options menu displays the equivalent script bit, and there it was. its the ...activeinv but i was looking for. so here's an example, in case other clueless newbies run into this same problem:
if (character[GetPlayerCharacter()].activeinv == 3) {
Display("Item 3 was used!");
}
that line of code should become part of the panes- it would be really cool if there was an extra panel, keeping track of all the inventory items created, and allowing to insert the reactions (as code) or just check a "default reaction" (Like "I don't want to have the [item name]).
I suggest this for 2.57 ;D
i agree. i also would love it if we could use "script names" (ie aliases) for at least items and GlobalInts, just like for characters.
i have to keep a separate (rather large) txt file open always to keep track of what number corresponds to what item/variable/etc.