Trigger Question =/

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Bebert1
Private
Posts: 3
Joined: Fri Dec 13, 2002 10:40 am

Trigger Question =/

Post by Bebert1 »

Hi Folks !

i've got a probleme with my map =/

Okay, here's the situation :

In my map, there's a detonator that player can use with a "Trigger_useonce" ; for the explosion,

I made a Mortar explosion (animate -> fx -> mortar dirt).

The Trigger_once properties are the following:

#set / 1
classname / trigger_useonce
targetname / explodertrigger

And the 2 Animate_fx_mortar-dirt are :

#set / 1
classname / animate_fx_mortar-dirt
model / animate/fx_mortar_dirt.tik
origin / (values)
targetname / exploderfire
testanim / idle

I've also parametred my .scr, adding the "global/exploder.scr" line, "thread explode1" line, and

afeter the "main:" "end", I added the following :

exploderfire1:

$exploderfire anim start
radiusdamage $exploderfire 200 300
end


..

So, everything works fine, but the explosions detonate at the same time. In my scenario, the explosions are serial explosion, the first detonate at Time A and the second at Time B+1. So,

what can I do ? =/
It's either a Trigger problem or a Script problem.

How can I do to make one single trigger, to start more than 1 Thread event ?

Thanks for me helping me out :)

Aw, and another question (anoying, uh ?? :))

How does the #set <value> works exactly ? In my case, I put "exploder" and "explodertrigger" because it works on a Tutorial i saw. But, can I put any Targetname I want, but if the #set <value> are the same, it'll work anyway ?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

In your case, you don't need a #set value because you aren't using the global/exploders.scr file. So you can remove the 'exec global/exploders.scr' line as well.

To start multiple explosions, just set the 'setthread' key of the trigger to a thread that calls these explosions.

e.g. create a trigger_use with setthread / exploders.

Then create something like this thread in your script:

Code: Select all

exploders:
   for(local.i = 1; local.i <= 5; local.i++)
   {
      waitthread exploderfire1
      wait (0.5 + randomfloat 2)
   }
end


This will set off five explosions.
Image
Guest

Post by Guest »

Thanks for answering, i'll test this and reply ASAP
Bebert1
Private
Posts: 3
Joined: Fri Dec 13, 2002 10:40 am

Post by Bebert1 »

The post above was from me, forgot to login, sorry.

So, great ! the trigger thing works fine ! thanks a lot !

I've got still a little problem :

My map loads, and as soon as i'm in the level, the "exploders" thread fires up : i've got 5 explosions. But if i use the trigger, it'll explode too.

Looks like i forgot to put a command like " wait until triggered " somewhere.
Here's my .scr end :

Code: Select all

main:
[...]
$player item weapons/m1_garand.tik
$player item weapons/colt45.tik
$player useweaponclass rifle
$player ammo rifle 15

thread exploders
thread exploderfire1

end


exploders:
   for(local.i = 1; local.i <= 5; local.i++)
   {
      waitthread exploderfire1
      wait (0.5 + randomfloat 2)
   }
end

exploderfire1:

$exploderfire anim start
radiusdamage $exploderfire 200 300
end


What have I to add ? or remove ?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Remove

thread exploders
thread exploderfire1

The exploders thread is started by the trigger.
The exploderfire1 thread is started by the exploders thread.

So there's no reason to put them in the main thread.

I'm not sure if it was your intention, but this thread turned into a scripting discussion so I moved it to the scripting forum.
Image
Bebert1
Private
Posts: 3
Joined: Fri Dec 13, 2002 10:40 am

Post by Bebert1 »

Okay jv, thanks a LOT, it works now

And I put this topic in the mapping forum cuz I thought that it was a trigger related problem :)

Thanks again
Post Reply