Random Explosions

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
ArcAngel
Corporal
Posts: 26
Joined: Thu May 01, 2003 10:30 am

Random Explosions

Post by ArcAngel »

I have just added a couple of random explosions to my map.

I have also added the scripting for them. But I must have missed something as both explosions seem to go off together. The random timing works. But both always fire at the same time. How do I get each one to fire on it's own??
"My shield in He and whom I trust"
Image
TheShiznaeSpe
Major
Posts: 304
Joined: Wed Feb 05, 2003 11:45 pm
Location: US
Contact:

Post by TheShiznaeSpe »

ArcAngel
Corporal
Posts: 26
Joined: Thu May 01, 2003 10:30 am

Post by ArcAngel »

Hiya, thanks for the link.
This is the tutorial I used. But my explosions all seem to be firing at the same time!
They fire at random intervalls. But Always together!

Any ideas, as to what i might have done!
Or not done!!!
:?
"My shield in He and whom I trust"
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Post your script (or part of it) ;)
Image
ArcAngel
Corporal
Posts: 26
Joined: Thu May 01, 2003 10:30 am

Post by ArcAngel »

Here is the Script file:

// Wiking-Test
// ARCHITECTURE: Wiking-ArcAngel
// SCRIPTING: Wiking - ArcAngel

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Test Allie Text"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "Test Axis Test"
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none"

level waittill prespawn

exec global/DMprecache.scr

exec global/ambient.scr A-Wiking

level.script = "maps/dm/A-Wiking.scr"

level waittill spawn

//*** --------------------------------------------
//*** "Random Explosions"
//*** --------------------------------------------

thread random_explode1
thread random_explode2
thread random_explode3

end

random_explode1:

wait (randomfloat 5 + 23)

$random_explode anim start
radiusdamage $random_explode 256 384

goto random_explode1
end

random_explode2:

wait (randomfloat 13 + 20)

$random_explode anim start
radiusdamage $random_explode 256 384

goto random_explode2
end

random_explode3:

wait (randomfloat 9 + 18)

$random_explode anim start
radiusdamage $random_explode 256 384

goto random_explode3
end
"My shield in He and whom I trust"
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Why do you use $random_explode in all threads? Isn't it supposed to be $random_explode2 or $random_explode3 in the other threads (if you have multiple explosions)? If you only have one explosion, why use three different threads?
Image
ArcAngel
Corporal
Posts: 26
Joined: Thu May 01, 2003 10:30 am

Post by ArcAngel »

To be honest I am not sure what I am doing!!

Let me see if I understand.
At the moment the target name for each explosion is random_explode.

So do I need to change each traget name to randome explode1 (and 2 etc).

Then change the scripts for each thread to match: ie: $random_explode1 (and 2 etc).
"My shield in He and whom I trust"
Image
Gizzy (nl)
Sergeant Major
Posts: 101
Joined: Tue Dec 03, 2002 3:41 pm
Location: Netherlands
Contact:

Post by Gizzy (nl) »

yes thats correct...

I named my entity in the radiant random_explodea, b and c

Code: Select all


random_explode1:
wait (randomfloat 8 + 20)
$random_explodea anim start
radiusdamage $random_explodea 256 384 
goto random_explode1
end

random_explode2:
wait (randomfloat 3 + 15)
$random_explodeb anim start
radiusdamage $random_explodeb 256 384 
goto random_explode2
end

random_explode3:
wait (randomfloat 5 + 18)
$random_explodec anim start
radiusdamage $random_explodec 256 384 
goto random_explode3
end
you can also jump from one explosion to another :

Code: Select all


random_explode1:
wait (randomfloat 8 + 20)
$random_explodea anim start
radiusdamage $random_explodea 256 384 
goto random_explode3       // <==
end

random_explode2:
wait (randomfloat 3 + 15)
$random_explodeb anim start
radiusdamage $random_explodeb 256 384 
goto random_explode1       // <==
end

random_explode3:
wait (randomfloat 5 + 18)
$random_explodec anim start
radiusdamage $random_explodec 256 384 
goto random_explode2       // <==
end
ArcAngel
Corporal
Posts: 26
Joined: Thu May 01, 2003 10:30 am

Post by ArcAngel »

Great thanks. I gathered they would have to be made individual in radiant. But wasn't sure about the script.

Thanks guys!
"My shield in He and whom I trust"
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

You can also use $random_explode[1], [2] and [3].

If you use $random_explode, all explosions go off.
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

obj/obj_team3

Post by tltrude »

Here is an example from the Omaha multiplayer map script:

Code: Select all

random_explode1:

	wait (randomfloat 13 + 23)

	$random_explode1_origin playsound arty_leadinmp

	wait 1

	$random_explode1 anim start
	radiusdamage $random_explode1_origin 256 384

	goto random_explode1
In your map you will need two entities, an explosion entity and a script_origin, at each explosion spot. The explosion entity must be targetname "$random_explode1" for the example above. The script_origin must be targetnamed "$random_explode1_origin"--it causes the damage to the players.

If you want more ramdom explosions just copy the thread and change the targetnames to end with 2, 3, 4, etc. You will also want to change the randomfloat numbers so they don't all explode at the same times. Also change the name of the thread.

All of the threads must be started at the top of your script:

level waittill prespawn

thread random_explode1
thread random_explode2
thread random_explode3
etc...

Hope that helps.
Tom Trude,

Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I find that it is better to make script origins for the mines because if you put too many of them in a map you get a out of temp models error some of the time , what you can do is create script origins name them $random_mine then do this
random_mines:
wait (randomfloat 13 + 23)
local.x = randomint($random_mine.size)
spawn animate/fx_explosion_mine targetname local.spawn_mine
local.spawn_mine.origin = $random_mine[local.x].origin
local.spawn_mine anim start
radiusdamage local.spawn_mine.origin 4000 256
wait 3
local.spawn_mine remove
goto random_mines
end
Post Reply