Aller au contenu

Photo

Urgent - How to create a "if door is locked, dont do that" condition?


  • Veuillez vous connecter pour répondre
13 réponses à ce sujet

#1
el.sombrero

el.sombrero
  • Members
  • 100 messages
 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

#2
Morbane

Morbane
  • Members
  • 1 883 messages
put in a "do once" switch by setting a local int on each passerby - if they have the int, the trap wont trigger

#3
Morbane

Morbane
  • Members
  • 1 883 messages
SetLocalInt(GetEnteringObject(), "locked", TRUE);

......

......

if(GetLocalInt(GetEnteringObject(), "locked") == TRUE) return;

:wizard:

Modifié par Morbane, 25 mars 2013 - 09:46 .


#4
Morbane

Morbane
  • Members
  • 1 883 messages
hmm - so if you have more than 1 party member does the door close on the rest of the party?

#5
kevL

kevL
  • Members
  • 4 074 messages
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

if (!GetLocked(oDoor))
{
//do damage
// close & lock the door
}

Modifié par kevL, 25 mars 2013 - 10:07 .


#6
Morbane

Morbane
  • Members
  • 1 883 messages
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

#7
Morbane

Morbane
  • Members
  • 1 883 messages
so...

if(GetLocked(GetObjectByTag("door tag")) return;

...is probably the shortest implementation at the top of ur script.

#8
Morbane

Morbane
  • Members
  • 1 883 messages
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

:wizard:

Modifié par Morbane, 25 mars 2013 - 11:26 .


#9
el.sombrero

el.sombrero
  • Members
  • 100 messages
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!

#10
kevL

kevL
  • Members
  • 4 074 messages
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,

#11
el.sombrero

el.sombrero
  • Members
  • 100 messages
Hey KevL,

I will try it now, thx! And Thx Morbane!

#12
el.sombrero

el.sombrero
  • Members
  • 100 messages
Wow, lucky strike... I had already used oTarget = GetObjectByTag("door name")!
now its just paste if(GetLocked(oTarget)) return; at each script! yeah!

#13
Morbane

Morbane
  • Members
  • 1 883 messages
dont forget to return and have it at the top of the script 

:)

edit: i read too fast - you said that already...

Modifié par Morbane, 27 mars 2013 - 11:29 .


#14
el.sombrero

el.sombrero
  • Members
  • 100 messages
Hey guys, problem solved. Thx.