Scripting Question
- Black Widow
- DBB Ace
- Posts: 141
- Joined: Sun Jun 23, 2002 2:01 am
- Location: Holland
Scripting Question
I created a button that activates something and then deactivates it after 10 secs using a timer. The script executes every time you hit the button, so if you hit the button 4 times the scipt is also running 4 times. How do I make the script execute only once, and then enable it to execute again?
// i.e //
create a user flag, name it 'tRun'
at your level start event
Set user Flag 'tRun' to FALSE
Now:
Script xx0 'Hit Button'
-> Owner 'Button' (Object)
Event: Collided (with IT)
? if the following condition is met:
AND
+ ? (IT is a player or player weapon) = TRUE
+ ? (User Flag 'tRun')= FALSE
> Then perform the following actions:
Play object OWNER animation from 0-x, .... sound etc
Set user flag 'tRun' to TRUE
Generate object OWNER timer event in 10.00 seconds with ID 'mytime'
DO NOTHING
next script:
Script xx1 'mytime' timer off
-> Owner 'Button' (Object)
Event: Timer (TIMER ID)
? If the following condition is met:
+ ? (mytime)=(TIMER ID)
> Then perform the following actions:
..do your stuff
Set user Flag 'tRun' to FALSE
DO NOTHING
//--
This means that if you hit your button,
the script is looking if your flag is set or not,
if not it starts action and set the Flag now.
If you hit your button again (during the timer is running),
the script will jump over your action
until your timer is off.
In the timer off script yout 'tRun' flag is set to false again
and the next hit will trigger your action again.
I hope this example is understandable.
create a user flag, name it 'tRun'
at your level start event
Set user Flag 'tRun' to FALSE
Now:
Script xx0 'Hit Button'
-> Owner 'Button' (Object)
Event: Collided (with IT)
? if the following condition is met:
AND
+ ? (IT is a player or player weapon) = TRUE
+ ? (User Flag 'tRun')= FALSE
> Then perform the following actions:
Play object OWNER animation from 0-x, .... sound etc
Set user flag 'tRun' to TRUE
Generate object OWNER timer event in 10.00 seconds with ID 'mytime'
DO NOTHING
next script:
Script xx1 'mytime' timer off
-> Owner 'Button' (Object)
Event: Timer (TIMER ID)
? If the following condition is met:
+ ? (mytime)=(TIMER ID)
> Then perform the following actions:
..do your stuff
Set user Flag 'tRun' to FALSE
DO NOTHING
//--
This means that if you hit your button,
the script is looking if your flag is set or not,
if not it starts action and set the Flag now.
If you hit your button again (during the timer is running),
the script will jump over your action
until your timer is off.
In the timer off script yout 'tRun' flag is set to false again
and the next hit will trigger your action again.
I hope this example is understandable.
- Black Widow
- DBB Ace
- Posts: 141
- Joined: Sun Jun 23, 2002 2:01 am
- Location: Holland
- Interceptor6
- DBB Ace
- Posts: 138
- Joined: Sat Mar 01, 2003 3:01 am
- Location: baton rouge, LA, USA
- Interceptor6
- DBB Ace
- Posts: 138
- Joined: Sat Mar 01, 2003 3:01 am
- Location: baton rouge, LA, USA
I'm not totally sure where it is, but if I remember correctly this is what you should do:
Under conditions, select default comparison statement.
Right click the first parameter in the statement, and select replace with query. It may be under timer, misc or something like that.
I don't remeber exactly where it is, but I'm pretty sure it is in there somewhere. It certainly saves some time not having to set up user flags.
Hope that helps.
Under conditions, select default comparison statement.
Right click the first parameter in the statement, and select replace with query. It may be under timer, misc or something like that.
I don't remeber exactly where it is, but I'm pretty sure it is in there somewhere. It certainly saves some time not having to set up user flags.
Hope that helps.
- Black Widow
- DBB Ace
- Posts: 141
- Joined: Sun Jun 23, 2002 2:01 am
- Location: Holland
- Interceptor6
- DBB Ace
- Posts: 138
- Joined: Sat Mar 01, 2003 3:01 am
- Location: baton rouge, LA, USA
I think it has to have a gravity field. Just set gravity time to zero and gravity size to zero so there won't actually be a gravity field. You should see a lot of sparks when the missile hits the wall, and it should shake the level slightly. Something like that was used my schplurg when he made the Earthshaker 2001. It seemed to shake the wall somewhat when the big missile collided with a wall. I've never tested it, but that would be my best guess.
Good luck.
-Int
Good luck.
-Int
- Black Widow
- DBB Ace
- Posts: 141
- Joined: Sun Jun 23, 2002 2:01 am
- Location: Holland
- Interceptor6
- DBB Ace
- Posts: 138
- Joined: Sat Mar 01, 2003 3:01 am
- Location: baton rouge, LA, USA
Well, I really doubt there is a way to get it to shake any more than it does, with just Gamtool at least. Since you cannot script to an individual weapon in dallas, there isn't really a way to affect the level of shake.Which really is a bummer, since the Earthshaker really should shake things up quite a bit more. Not much that can be done about it though.