Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: urgrue on Mon 03/11/2003 17:26:36

Title: use inventory on character
Post by: urgrue on Mon 03/11/2003 17:26:36
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?
Title: Re:use inventory on character
Post by: CB.. on Mon 03/11/2003 18:25:09
put the interaction in the character section of the AGS
use the if item number# was used conditional
Title: Re:use inventory on character
Post by: Ishmael on Mon 03/11/2003 18:25:46
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!
Title: Re:use inventory on character
Post by: urgrue on Mon 03/11/2003 21:11:35
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
 }
Title: Re:use inventory on character
Post by: Mr Jake on Mon 03/11/2003 21:38:18
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.
Title: Re:use inventory on character
Post by: urgrue on Mon 03/11/2003 22:04:41
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!");  
  }
Title: Re:use inventory on character
Post by: on Wed 05/11/2003 08:45:17
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
Title: Re:use inventory on character
Post by: urgrue on Wed 05/11/2003 10:09:12
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.