Trigger Scripts not firing. - by New Horizon
New Horizon on 1/9/2005 at 14:09
I didn't want to start another thread on this but I'm not sure people were seeing it in this thread.
(
http://www.ttlg.com/forums/showthread.php?t=99762)
It's not something I've been able to find any information on through the search function.
Basically, when I apply a trigger script to the key model "within the map" and not in the "gamesys", it doesn't fire to unlock the door. Not sure if the script needs another condition for it to work this way but I'll keep trying. In the meantime, if anyone else has any experience with this. Let me know.
The reason I needed to do this was to make it so only one instance of the KeyRing appeared in the Inventory.
Rantako on 1/9/2005 at 15:47
This is why it doesn't work:
When you pick up an item into inventory, that particular concrete item doesn't go into inventory. The concrete is destroyed, and a new concrete of the same archetype is spawned in your inventory. Because of this, any scripts on the concrete you pick up but not on its archetype will not be on the new concrete that is spawned. This means you must put the key script on the archetype, or it will not work. That's the reason why I made a new archetype for the second key in the tutorial.
New Horizon on 1/9/2005 at 17:40
Quote Posted by Rantako
This is why it doesn't work:
When you pick up an item into inventory, that particular concrete item doesn't go into inventory. The concrete is destroyed, and a new concrete of the same archetype is spawned in your inventory. Because of this, any scripts on the concrete you pick up but not on its archetype will not be on the new concrete that is spawned. This means you
must put the key script on the archetype, or it will not work. That's the reason why I made a new archetype for the second key in the tutorial.
Ahhh, I understand. Hmmm, not sure what to do about that then. Is it possible to transfer the triggerscript to the new concrete that is spawned? If not, I'm not sure how else to make the KeyRing work. It's a catch 22. :) Applying the scripts to the items in the map allow me to have a fully functioning keyring but then I can't use the scripts. If I use the gamesys and place multiple keys that way, I get multiple KeyRings in the inventory. I've been trying to find a way to associate different keys into a single slot but no luck so far. Argh. I thought maybe an association link or something but I really don't understand how that all works quite yet.
Krypt, you know your way around this stuff. :) Any thoughts on that?
Dark Arrow on 1/9/2005 at 18:21
The way I figured the keyring would work, would be by first adding a keyring object to the players inventory. Then add keys to the map and link them to the doors/chests/whatever with a specific link. When you pick up the key, the script in it activates and that adds the link the key has to the keyring object and destroys itself.
The keyring could be activated from the inventory and it would open all the locked objects within a certain radius that it is linked to. That is how I figured the system would work. I am not sure how you have things set up already. I haven't really had time to read all the key tutorials out there.
So a total of three scripts would be needed.
One for all the keys (Add link from itself to the keyring in inventory)
One for the door (listens for a specific message send by the keyring in a specific link)
One for the keyring (send a message to all objects the object linked to with a specific link).
Just my two cents...
New Horizon on 1/9/2005 at 19:06
Quote Posted by Dark Arrow
One for all the keys (Add link from itself to the keyring in inventory)
This the part I've been trying to achieve. I have the keyring as part of the players inventory. I just don't know how to add the script from the key when it's destroyed, to the key ring.
Ziemanskye on 1/9/2005 at 19:32
Do you need to? An alternative system suggestion:
When the key is picked up, send a message to the doors/chests/whatever it unlocks, and give a fake 'key picked up' message (in that it doesn't do anything as such)
Then just have the keyring as a generic message that also trips to the locked things, that need both the key picked up message and the keyring used message to unlock.
rujuro on 1/9/2005 at 20:32
That seems like a very good idea. Just some sort of a flag per key, and you check to see if Key1pickedup=true when the keyring is used, right?
New Horizon on 1/9/2005 at 23:49
Ahhh, I see. So the key ring would basically have all the scripts attached to it but they won't open the door or chest until the physical key sends a message? I really wish I had the head for this guys. I'm learning the scripting slowly but the possibilities overwhelm me.
ascottk on 2/9/2005 at 05:12
Do the keys like we know how to do it but use the InventorySwitch link instead of the HUDRender. The link will go from the keys to the key ring. Take a look at the bombs (mainly the FlashBomb archetype). You really can't do anything with it except frob it. But when it's frobbed the InventorySwitch link switches the FlashBomb to the FlashbombProjectile. So when you pick up the key it switches to the key ring. When when you scroll through the inventory you'll see the key ring & hopefully you'll be able to unlock/lock doors after you pick up the key.
EDIT: I can see a couple problems with this:
* The key
becomes the keyring so that key you frob could possibly open all locked doors. All independant qualities of that key is now the properties of the key ring.
* Depends on where you place the key ring (i.e. SpawnedWeaponObject) then you're limited to inventory slots. Remember the mess with adding the sword to inventory. You ended up having to replace the sword instead just adding the knife.
Essentially you want this:
Code:
KeyRing __
|_Key1 (All keys have InventorySwitch to KeyRing)
|_Key2
|_Key3
but once you frob all three keys:
New Horizon on 2/9/2005 at 12:56
That does solve the problem with multiple versions of the keyring popping up in inventory. Now they stack properly. :) Thank you. New problem however, the keys appear to be destroyed during the inventory switch and the doors can no longer be unlocked. Same problem I had by creating a single key where the triggerscripts were added to the properties within the map. As soon as it was frobbed, it was destroyed and the triggerscripts lost. Damn. I think this is much closer than we were before, but how the heck can we not have the triggerscripts destroyed up on inventory switch? There must be some sort of setting.
Tried a Triggerscript Link in addition to the inventory switch...I thought it might transfer the scripts to the Key Ring. No luck. Not exactly sure what that's supposed to do but it doesn't seem to share anything with the Keyring. I'm happy we have gotten the basic keys working but a Keyring would just be so elegant. The best of both worlds really. The uncluttered approach that they went a little too far with in T3 and the player interaction of the original games.