Scripting Question

For Descent, Descent II and Descent3 level editing and modification assistance.
Post Reply
User avatar
Black Widow
DBB Ace
DBB Ace
Posts: 141
Joined: Sun Jun 23, 2002 2:01 am
Location: Holland

Scripting Question

Post by Black Widow »

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?
Atan
DBB Ace
DBB Ace
Posts: 54
Joined: Mon Jul 16, 2001 2:01 am
Contact:

Post by Atan »

// 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.
User avatar
Black Widow
DBB Ace
DBB Ace
Posts: 141
Joined: Sun Jun 23, 2002 2:01 am
Location: Holland

Post by Black Widow »

It works!
Thanks for your help!
User avatar
Kyouryuu
DBB Alumni
DBB Alumni
Posts: 5775
Joined: Fri Apr 30, 1999 2:01 am
Location: Isla Nublar
Contact:

Post by Kyouryuu »

I'm pretty certain there's also an option for every event that says "Trigger Only Once" or something along those lines. I'm not sure where they put it - possibly on a right-click context menu?
Atan
DBB Ace
DBB Ace
Posts: 54
Joined: Mon Jul 16, 2001 2:01 am
Contact:

Post by Atan »

Yes it's inside.
right click on :Then perform following action.
But it does what it says: Execute only once then,
behind this, the script is not executed anymore up to next level start. Correct me if I'm wrong with this idea.
User avatar
Interceptor6
DBB Ace
DBB Ace
Posts: 138
Joined: Sat Mar 01, 2003 3:01 am
Location: baton rouge, LA, USA

Post by Interceptor6 »

just add a 'timer is active' condition with FALSE in your conditions for the script that initiates the timer. You don't really need a user flag, but it will work that either way.
Atan
DBB Ace
DBB Ace
Posts: 54
Joined: Mon Jul 16, 2001 2:01 am
Contact:

Post by Atan »

this would save resources, nice!!
But I can't find this 'timer is active' condition in the moment,
where must I exactly look for it?
could you please give an short example?
TIA
User avatar
Interceptor6
DBB Ace
DBB Ace
Posts: 138
Joined: Sat Mar 01, 2003 3:01 am
Location: baton rouge, LA, USA

Post by Interceptor6 »

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.
User avatar
Black Widow
DBB Ace
DBB Ace
Posts: 141
Joined: Sun Jun 23, 2002 2:01 am
Location: Holland

Post by Black Widow »

Next question: How do you make a specific weapon shake the level when it hits a wall?
User avatar
Interceptor6
DBB Ace
DBB Ace
Posts: 138
Joined: Sat Mar 01, 2003 3:01 am
Location: baton rouge, LA, USA

Post by Interceptor6 »

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
User avatar
Black Widow
DBB Ace
DBB Ace
Posts: 141
Joined: Sun Jun 23, 2002 2:01 am
Location: Holland

Post by Black Widow »

I want it to shake a bit more like in D2
User avatar
Interceptor6
DBB Ace
DBB Ace
Posts: 138
Joined: Sat Mar 01, 2003 3:01 am
Location: baton rouge, LA, USA

Post by Interceptor6 »

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.
Post Reply