|
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible),
637
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Trigger action
#116165
03/09/07 15:10
03/09/07 15:10
|
Joined: Mar 2006
Posts: 724 the Netherlands
Frits
OP
User
|
OP
User
Joined: Mar 2006
Posts: 724
the Netherlands
|
I like to make a action that sets a trigger on or off when the player passes a triggerblock. So far I have Code:
action trigger_action { my.invisible=on; my.passable=on; while(vec_dist(player.x,my.x)>40) {wait(1);} trigger_on=trigger_on==off; }
This action works, but ofcourse only one time. I try to set the whole thing into another while(1) and wait(1) like this Code:
action trigger_action { my.invisible=on; my.passable=on; while(1) { while(vec_dist(player.x,my.x)>40) {wait(1);} trigger_on=trigger_on==off; wait(1); } }
but that will not work (trigger-on goes on and off aslong vec_dist < 40). So can anybody help me with this? 
I like to keep scripting simple, life is hard enough as it is. Regards, Frits
|
|
|
Re: Trigger action
[Re: Frits]
#116166
03/09/07 15:36
03/09/07 15:36
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
Close man, but your while() loops are all confused... Code:
action trigger_action { my.invisible=on; my.passable=on; while(1) { trigger_on = (vec_dist(player.x, my.x) <= 40); wait(1); } }
I think thats what your going for. Or did you want an event-like trigger. As in trigger on is only set to one on the entering of the range, not just while inside it. And set to -1 upon exiting...
xXxGuitar511 - Programmer
|
|
|
Re: Trigger action
[Re: xXxGuitar511]
#116167
03/09/07 16:10
03/09/07 16:10
|
Joined: Mar 2006
Posts: 724 the Netherlands
Frits
OP
User
|
OP
User
Joined: Mar 2006
Posts: 724
the Netherlands
|
No, I think I explain it wrong. When the player comes in range of the triggerblock, the trigger must go on and stay on, even when the player goes out of range. When the player comes in range of the the block again, then it should go off and stay off until the player comes in range again .... end so on. I hope you understand what I mean.
I like to keep scripting simple, life is hard enough as it is. Regards, Frits
|
|
|
Re: Trigger action
[Re: Frits]
#116168
03/09/07 16:15
03/09/07 16:15
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
I do... I'm not sure why you'd want it that way, but ok. Here it is: Code:
action trigger_action { my.invisible=on; my.passable=on; while(1) { my.skill10 = (vec_dist(player.x, my.x) <= 40); if (!my.skill11 & my.skill10) {trigger_on = !trigger_on;} my.skill11 = my.skill10; wait(1); } }
Skill 10 is a temp, and is just needed to see if your in range. 11 holds the last range, so you can tell if you are entering or exiting... You can change these if needed.
xXxGuitar511 - Programmer
|
|
|
Re: Trigger action
[Re: xXxGuitar511]
#116169
03/09/07 16:31
03/09/07 16:31
|
Joined: Mar 2006
Posts: 724 the Netherlands
Frits
OP
User
|
OP
User
Joined: Mar 2006
Posts: 724
the Netherlands
|
Your the man, that works like a charm! I need this to switch some light on and off. When you enter a room or so, the light goes on and you can walk around in the room without the light goes out. Only when you leave the room, the light goes out. Thanks again.
I like to keep scripting simple, life is hard enough as it is. Regards, Frits
|
|
|
Re: Trigger action
[Re: Frits]
#116170
03/09/07 17:20
03/09/07 17:20
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
Ha, thankz man...
I was thinkin it might be for somethin like, dropping a crate when the player walks close to a certain spot, or playing an animation when the player walks by (skeleton jumping up, or somethin like that]...
xXxGuitar511 - Programmer
|
|
|
Re: Trigger action
[Re: xXxGuitar511]
#116171
03/09/07 18:15
03/09/07 18:15
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi xXxGuitar511 ! You guys got my curiousity when I saw the title about trigger range. Since your asking for something like , dropping a crate....
I have a situation where I drop a bloc on another one ( one of three) The code works well in two levels. But in the other two, I drop the block outside the trigger range (F11) of the three objects ... the 3rd option always gets activated.
What should I be looking for?
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Re: Trigger action
[Re: xXxGuitar511]
#116173
03/10/07 00:03
03/10/07 00:03
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi xXx Guitar511 !  In ver 6.4 I made a level where I would pick and drop a box on a choice of three boxes. The player had to choose where he or she would drop the box. The player had three targets. When the player dropped the box outside the range of the (bounding) boxes, nothing would happen. That was ok because the player could pick up the box and try again. This worked very well until I upgraded to 6.5. Now if the player drops the box anywhere (even outside the range of the boxes) the trigger is activated to one of the boxes. Any suggestions as to where to look? I'm presently re-scripting this level from scratch.
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Re: Trigger action
[Re: Ottawa]
#116174
03/10/07 03:18
03/10/07 03:18
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
you could either use collision (ex: enable_entity event)
Or you could check the range the cube is to each block. If th cube is close enough to a certain block, then the event is triggered for that block...
xXxGuitar511 - Programmer
|
|
|
|