I'm trying to create a map that has searchable containers like you might find in an RPG (treasure chests, dressers, giant jars), and am looking for advice on the best way to do this. I'm very new to ACS/ZScript, so if there's a completely different direction I should go in to accomplish this, I'm open to it.
The ideal flow would be:
1) Player interacts the 1st time, "You found ______" displays, and you collect the ammo or armor or key or whatever.
2) Player interacts the 2nd time, "But the chest was empty" displays
Currently, I've got a linedef with an action that calls an ACS script. My current draft of the script looks like this:
Code: Select all
//TID is basically a "container ID" in this version. Place a Thing on the map and give it this tag to serve as a flag describing whether the container has been searched.
script 3 (int tid){
if(Thing_Activate(tid)){
//Branch based on TID to determine what's "inside" the container.
if(tid == 5){
Print(s:"You found Ten Armor Bonuses");
GiveInventory("ArmorBonus",10);
Thing_Remove(tid);
}
}
else{
Print(s:"Nothing special is found.");
}
I was previously using Thing_Move to teleport invisible items onto the player so that I could see the item "inside the container" in the map editor, but that caused other problems - the item wouldn't be collected until you moved, and sometimes the Thing_Move would fail if you were standing against a wall (or the container itself).
Thanks.