hey guys,
I created a trap that works like this:
Immediatly after a door there is a trigger on the flor. When the player walks over it, it shuts and locks the door behind the player. At the door there is a script that says "on door lock, dammage players hp by 3".
The problem is each time the players walks over the trigger on the floor, the "dammage" function that is at the door is triggered, even if the door is already locked, and the player is damaged again.
I need to write a condition, to be put at the trigger on the floor, that says "if the door *doorname" is already locked, dont fire the damage script. Can anyone help me out with data? It's pretty urgent and I'm not sure how to do it.
Cheers
Urgent - How to create a "if door is locked, dont do that" condition?
Débuté par
el.sombrero
, mars 25 2013 09:22
#1
Posté 25 mars 2013 - 09:22
#2
Posté 25 mars 2013 - 09:35
put in a "do once" switch by setting a local int on each passerby - if they have the int, the trap wont trigger
#3
Posté 25 mars 2013 - 09:37
SetLocalInt(GetEnteringObject(), "locked", TRUE);
......
......
if(GetLocalInt(GetEnteringObject(), "locked") == TRUE) return;
......
......
if(GetLocalInt(GetEnteringObject(), "locked") == TRUE) return;
Modifié par Morbane, 25 mars 2013 - 09:46 .
#4
Posté 25 mars 2013 - 09:53
hmm - so if you have more than 1 party member does the door close on the rest of the party?
#5
Posté 25 mars 2013 - 10:06
that's what i'm wondering, do a quick cutscene of the door slamming shut and while the player is distracted jump the party over.. hehe
here's an alternative to M's idea'r
here's an alternative to M's idea'r
if (!GetLocked(oDoor))
{
//do damage
// close & lock the door
}
Modifié par kevL, 25 mars 2013 - 10:07 .
#6
Posté 25 mars 2013 - 10:13
ive handled this a couple ways:
find the party size and wait for the trigger to go off that many times
put a delay on the close/lock
haha i was looking for a gc_ script for GetLocked - either way i guess
find the party size and wait for the trigger to go off that many times
put a delay on the close/lock
haha i was looking for a gc_ script for GetLocked - either way i guess
#7
Posté 25 mars 2013 - 11:17
so...
if(GetLocked(GetObjectByTag("door tag")) return;
...is probably the shortest implementation at the top of ur script.
if(GetLocked(GetObjectByTag("door tag")) return;
...is probably the shortest implementation at the top of ur script.
#8
Posté 25 mars 2013 - 11:26
hint on finding scripts with Script Assist:
only search for 3 or 4 letters of ur keyword (in sequence), since the scripts are frequently abbreviated
only search for 3 or 4 letters of ur keyword (in sequence), since the scripts are frequently abbreviated
Modifié par Morbane, 25 mars 2013 - 11:26 .
#9
Posté 26 mars 2013 - 06:30
My game is "single character party" but the thing is, the door is in a maze and if the player doesn't solve the maze, he is teleported back to its beggining and all the doors are unlocked, so the "do once" solution wouldn't work.
I will try KevL alternative.
Hey guys, thx for your quick help!
I will try KevL alternative.
Hey guys, thx for your quick help!
#10
Posté 26 mars 2013 - 06:40
el.
Morbane's 2nd solution is the same as mine, but may be easier to copy paste in at the top of your script.
but either way,
Morbane's 2nd solution is the same as mine, but may be easier to copy paste in at the top of your script.
but either way,
#11
Posté 27 mars 2013 - 11:19
Hey KevL,
I will try it now, thx! And Thx Morbane!
I will try it now, thx! And Thx Morbane!
#12
Posté 27 mars 2013 - 11:23
Wow, lucky strike... I had already used oTarget = GetObjectByTag("door name")!
now its just paste if(GetLocked(oTarget)) return; at each script! yeah!
now its just paste if(GetLocked(oTarget)) return; at each script! yeah!
#13
Posté 27 mars 2013 - 11:27
dont forget to return and have it at the top of the script

edit: i read too fast - you said that already...
edit: i read too fast - you said that already...
Modifié par Morbane, 27 mars 2013 - 11:29 .
#14
Posté 28 mars 2013 - 03:05
Hey guys, problem solved. Thx.





Retour en haut






