Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Transferring Items from Different Maps
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#6
RE: Transferring Items from Different Maps

You find a key in a map, for the sake of examples. The key's name is "Key01" and the map's name is "Map01". The map where you use the key will be called "Map02". So the player picks up the item "Key01" in "Map01", and then goes to "Map02" where the locked door is. Let's call this locked door, "LockedDoor01". Then you add an AddUseItemCallback command function followed by another function that unlocks the door with that key. It's quite simple, no crazy stuff involved. Smile

void OnStart()
{
     AddUseItemCallback("", "Key01", "LockedDoor01", "Func01", false);
}
void Func01(string &in asItem, string &in asEntity)
{
     SetSwingDoorLocked(asEntity, false, true);
     PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
     RemoveItem(asItem);
}

But if it doesn't work, then it'll require some more scripting that involves global variables to check if the player picks up the key so then the item can properly be removed when leaving the level, and then recieving a new one once they enter another level. Tongue

08-14-2011, 04:07 AM
Find


Messages In This Thread
RE: Transferring Items from Different Maps - by Kyle - 08-14-2011, 04:07 AM



Users browsing this thread: 4 Guest(s)