Page 1 of 1

"Artillery"

Posted: Sun Jul 04, 2004 5:30 am
by Lone_Rebel
Hello, I have come to a dilemna in my map... I have everything finished but I am having a scripting problem. In my map I want to have it so that when you Use a radio "artillery" hits the other team, (like the "random" omaha explosions). I have all the stuff in my map but i think I might have messed up in the script... here it is...


main:
level waittill prespawn

exec global/DMprecache.scr

level.script = maps/obj/obj_a_winter_war.scr
exec global/ambient.scr mohdm2


setcvar "g_obj_alliedtext1" "Destroy The Gun!"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "Prevent Allies from"
setcvar "g_obj_axistext2" "destroying the Flak88's"
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none"

level waittill spawn

thread allybomb
thread axisbomb

end





allybomb:
alliedtrig waittill trigger

thread allyboom
end

allyboom:
wait (randomfloat 13 + 23)


$allyboom1 anim start
radiusdamage $allyboom1 256 384


wait 2


$allyboom2 anim start
radiusdamage $allyboom2 256 384

wait 1


$allyboom3 anim start
radiusdamage $allyboom3 256 384

wait 2


$allyboom4 anim start
radiusdamage $allyboom4 256 384

wait 1


$allyboom5 anim start
radiusdamage $allyboom5 256 384

wait 2


$allyboom6 anim start
radiusdamage $allyboom6 256 384

wait 1


$allyboom7 anim start
radiusdamage $allyboom7 256 384

wait 120
thread allybomb
end



axisbomb:
axistrig waittill trigger

thread axisboom
end

axisboom:
wait (randomfloat 13 + 23)


$axisboom1 anim start
radiusdamage $axisboom1 256 384


wait 2


$axisboom2 anim start
radiusdamage $axisboom2 256 384

wait 1


$axisboom3 anim start
radiusdamage $axisboom3 256 384

wait 2


$axisboom4 anim start
radiusdamage $axisboom4 256 384

wait 1


$axisboom5 anim start
radiusdamage $axisboom5 256 384

wait 2


$axisboom6 anim start
radiusdamage $axisboom6 256 384

wait 1


$axisboom7 anim start
radiusdamage $axisboom7 256 384

wait 120
thread axisbomb
end

$

Posted: Sun Jul 04, 2004 7:36 am
by tltrude
$alliedtrig waittill trigger

and

$axistrig waittill trigger

The little "$" sign tells it to look for the entity with that targetname in the map.

Also, you can not have two threads with the same name.

allybomb:
allybomb:

Posted: Sun Jul 04, 2004 7:40 am
by bdbodger
what I would do if you don't need to set them off in a certain order is to give all the $allyboom effects and $axisboom effects the same targetname and use a script like this it is a bit shorter

main:
level waittill prespawn

exec global/DMprecache.scr

level.script = maps/obj/obj_a_winter_war.scr
exec global/ambient.scr mohdm2


setcvar "g_obj_alliedtext1" "Destroy The Gun!"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "Prevent Allies from"
setcvar "g_obj_axistext2" "destroying the Flak88's"
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none"

level waittill spawn

thread allybomb
thread axisbomb

end

allybomb:

$alliedtrig waittill trigger

wait (randomfloat 13 + 23)

for(local.i = 1;local.i <= $allyboom.size;local.i++)
{
$allyboom[local.i] playsound arty_leadinmp
$allyboom[local.i] anim start
radiusdamage $allyboom[local.i] 256 384

wait 2

}

wait 120
thread allybomb
end

axisbomb:
$axistrig waittill trigger

wait (randomfloat 13 + 23)

for(local.i = 1;local.i <= $axisboom.size;local.i++)
{
$axisboom[local.i] playsound arty_leadinmp
$axisboom[local.i] anim start
radiusdamage $axisboom[local.i] 256 384

wait 2
}

wait 120
thread axisbomb
end

Posted: Sun Jul 04, 2004 1:09 pm
by nuggets
i like bdbodger's method of the explosions (a lot easier) :D

but with both methods you'll have the same order of detonations everytime

if you were to use bdbodger's script and add or change the orange lines, you'll have random explosions :D

i haven't changed the axis bombs, i'll leave you to do that ;)

main:
level waittill prespawn

exec global/DMprecache.scr

level.script = maps/obj/obj_a_winter_war.scr
exec global/ambient.scr mohdm2


setcvar "g_obj_alliedtext1" "Destroy The Gun!"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "Prevent Allies from"
setcvar "g_obj_axistext2" "destroying the Flak88's"
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none"

level waittill spawn

thread allybomb
thread axisbomb

end

allybomb:

$alliedtrig waittill trigger

wait (randomfloat 13 + 23)

for(local.i = 1;local.i <= 10; local.i++) //changed to 10 explosions
{
local.j = ((randomint $allyboom.size) + 1)
$allyboom[local.j] playsound arty_leadinmp
$allyboom[local.j] anim start
radiusdamage $allyboom[local.j] 256 384
local.wait = ((randomint 20) / 10)
wait local.wait

}

wait 120
thread allybomb
end

axisbomb:
$axistrig waittill trigger

wait (randomfloat 13 + 23)

for(local.i = 1;local.i <= $axisboom.size;local.i++)
{
$axisboom[local.i] playsound arty_leadinmp
$axisboom[local.i] anim start
radiusdamage $axisboom[local.i] 256 384

wait 2
}

wait 120
thread axisbomb
end

Posted: Sun Jul 04, 2004 3:08 pm
by Lone_Rebel
Cool thanks alot guys :D OMG lol i just realized what was wrong with mine anyway! i forgot the $ in front of the trig names! ooh, and i just read that rude already said that lol.

threads

Posted: Sun Jul 04, 2004 4:49 pm
by tltrude
Don't forget about the thread names. If you have lines like "thread allyboom" or "goto allyboom", the script will get confused if there is more than one thread with that name.

Posted: Sun Jul 04, 2004 5:24 pm
by Lone_Rebel
Well I got it working, only the Tank explosion anim sucks for snow artillery and the artillery lead in sound is not working... Can anyone reccomend a better explosion effect? (i tried using the Spearhead mortar snow or something like that explosion but then the artillery quit working...) Oh and also there was only one allyboom thread, the other was allybomb...

boom

Posted: Sun Jul 04, 2004 9:39 pm
by tltrude
My bad sorry. Is it a Mohaa map? If so, spearhead models wont work in it.

I don't see a snow explosion for mohaa. So, you may need to make a new tik for it. For now you can try "animate/fx_mortar_dirt.tik".

Posted: Mon Jul 05, 2004 12:17 am
by Lone_Rebel
Well it is located in the spearhead folder (the .pk3 that is) but I shall try that... as I am new to this part of map making (I have never tried blowing things up other than trucks cannons and bridges, never artillery) I was not sure whether i could use an animate thing or not.... thanks i will try it...

OH! one more thing before i forget, If I were to take the existing explosion points and just rename the classname to animate_fx_mortar-dirt would that work the same as redoing every single point? or will this cause it to not work?

Posted: Mon Jul 05, 2004 2:16 am
by Lone_Rebel
Good it works great with the dirt explosion, thanks... one final thing is this: it won't play in arty leadin sound and here is the error it gives...

ERROR: Entity::Sound: arty_leadinmp needs an alias in ubersound.scr or uberdialog.scr - Please Fix

How may I get this sound to work properly? the map is made in the Radiant that comes with the spearhead SDK and is located in a pk3 in the MainTA folder...

sound

Posted: Mon Jul 05, 2004 8:21 am
by tltrude
That leadin sound only works if the map is in the maps/obj folder. But there is a workaround for sounds. These line will need to be at the top of the script just above "level waittill prespawn".

local.master = spawn ScriptMaster
local.master aliascache arty_leadinmp1 sound/weapons/explo/Exp_LeadIn_06.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m moh dm obj "
local.master aliascache arty_leadinmp2 sound/weapons/explo/Exp_LeadIn_07.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m moh dm obj "
local.master aliascache arty_leadinmp3 sound/weapons/explo/Exp_LeadIn_08.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m moh dm obj "
local.master aliascache arty_leadinmp4 sound/weapons/explo/Exp_LeadIn_09.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m moh dm obj "
local.master aliascache arty_leadinmp5 sound/weapons/explo/Exp_LeadIn_10.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m moh dm obj "
local.master aliascache arty_leadinmp6 sound/weapons/explo/Exp_LeadIn_11.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m moh dm obj "
local.master aliascache arty_leadinmp7 sound/weapons/explo/Exp_LeadIn_12.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m moh dm obj "
local.master aliascache arty_leadinmp8 sound/weapons/explo/Exp_LeadIn_13.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m moh dm obj "


So, when you use "playsound arty_leadinmp", the game will randomly pick from those 8 sounds.

Posted: Mon Jul 05, 2004 8:28 pm
by Lone_Rebel
Okay well I added those lines, yet it still does not work, it gets the same error. Was there something i needed to change in the lines (such as the section you highlighted in yellow?)

jv_map workaround

Posted: Mon Jul 05, 2004 9:41 pm
by tltrude
No, the things in orange make them work in game types other than just "obj".

If it is not working, it is something else in your script that is wrong. So, you will need to post it.

Posted: Mon Jul 05, 2004 11:27 pm
by Lone_Rebel
well I placed that before the level waittill prespawn, the only part that has that sound in it would be this....

wait (randomfloat 13 + 23)

for(local.i = 1;local.i <= 10; local.i++) //changed to 10 explosions
{
local.j = ((randomint $allyboom.size) + 1)
$allyboom[local.j] playsound arty_leadinmp
$allyboom[local.j] anim start
radiusdamage $allyboom[local.j] 256 384
local.wait = ((randomint 20) / 10)
wait local.wait
}

pause

Posted: Tue Jul 06, 2004 4:08 am
by tltrude
The leadin sound may be hidden by the explosion sound. Try putting a one second pause between the two.

$allyboom[local.j] playsound arty_leadinmp
wait 1
$allyboom[local.j] anim start

You should really have a script_origin speaker above each explosion entity. It can also be used to raise the damageradius above the explosion--if the explosion is in a crater. Here is an example from the obj_team3 script (they used two entities, note colors).

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

end