Random Explosions
Moderator: Moderators
Random Explosions
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??
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"


-
TheShiznaeSpe
- Major
- Posts: 304
- Joined: Wed Feb 05, 2003 11:45 pm
- Location: US
- Contact:
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
// 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"


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).
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"


-
Gizzy (nl)
- Sergeant Major
- Posts: 101
- Joined: Tue Dec 03, 2002 3:41 pm
- Location: Netherlands
- Contact:
yes thats correct...
I named my entity in the radiant random_explodea, b and c
you can also jump from one explosion to another :
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
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
obj/obj_team3
Here is an example from the Omaha multiplayer map script:
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.
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
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.
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

