Page 1 of 2
On and off trigger script
Posted: Thu May 01, 2003 8:03 pm
by bodybagger
Can someone help me with a small script?
I have a plane that does a bomb run. there is a radio with a trigger use and targetnamed bombertrigger.
Now i want the allies to activate the trigger and call an air strike and the axis to be able to de-activate it,
Could some please help,
Thanks
Posted: Thu May 01, 2003 8:31 pm
by jv_map
Just a few variables will do it, but you can't use a 'bombertrigger' in this case, for it doesn't allow a team check. Give the trigger a key 'setthread' with value for example 'airstriketrigger'.
In your script, type something like this:
Code: Select all
airstriketrigger:
local.triggerer = parm.other
if(local.triggerer.dmteam == axis)
{
// deactivate the trigger
$<triggername> nottriggerable
}
else
{
// must be allies
// airstrike code here (or use script to trigger a $bombertrigger)
}
end
Posted: Fri May 02, 2003 11:28 am
by bodybagger
I am still having problems, nothing seams to happen!!!
I have the trigger set up as follows:
$triggername airstrike
$setthread airstriketrigger
Which trigger should i use. I tried bot trigger_use and trigger_multiple
Here's my code:
Code: Select all
/////////////////////////////
//// airstrike ////
////////////////////////////
airstriketrigger:
local.triggerer = parm.other
if(local.triggerer.dmteam == axis)
{
// deactivate the trigger
$airstike nottriggerable
iprintlnbold_noloc "The Axis have called of the air strike!"
}
else
{
// must be allies
thread callairstrike
iprintlnbold_noloc "The Allies have called an air strike!!"
}
end
//////////////////////
/// call air stike///
/////////////////////
callairstrike:
wait 1.0
thread global/bomber.scr::bomb 40
wait (randomint(50) +20)
goto callairstrike
end
Posted: Fri May 02, 2003 12:44 pm
by jv_map
$setthread should be setthread and $triggername should be targetname

more
Posted: Fri May 02, 2003 2:50 pm
by tltrude
I think you need to explain better what you want to happen. Do you want the bombs to drop until the axis turn it off, or do you want there to be a timer the axis can turn off before the airstrike begins?
Here is what I have so far, but I'm not sure it is what you want.
Code: Select all
////////////////////////////
//// airstrike ////
////////////////////////////
airstriketrigger:
level.airstriketimer = 0
level.controllingteam = "axis"
while (1) // This line has been changed....
{
$airstrike waittill trigger
local.player = parm.other
if ((local.player.dmteam == "axis") && (level.controllingteam == "allies"))
{
iprintlnbold_noloc "The Axis have aborted the air strike!!"
goto airstriketrigger
break
}
if ((local.player.dmteam == "allies") && (level.controllingteam == "axis"))
{
iprintlnbold_noloc "The Allies have called an air strike!!"
level.controllingteam = "allies"
}
if (level.airstriketimer >= 60)
{
thread callairstrike
iprintlnbold_noloc "Bombers on the way!!"
$airstrike nottriggerable
break
}
level.airstriketimer ++
iprintln ("60 second timer = " + level.airstriketimer)
wait 1
}
waitframe
end
//////////////////////
/// call air stike///
/////////////////////
callairstrike:
wait 1.0
thread global/bomber.scr::bomb 40
wait (randomint(50) +20)
goto callairstrike
end
You should take out the "setthread" from the trigger_use, and put "thread airstriketrigger" under "level waittill prespawn" for the above script to work.
Posted: Fri May 02, 2003 3:11 pm
by bodybagger
Tom, yeah i like your idea of having a timer, never thought of that.
I will try it out later.
I want the allied to call an airstrike which randomly happens with re-peat bombing and the axis have to switch of the airstrike radio.
Just some questions, when ever the game starts or re-starts the trigger some how activates depending on which side you are on without doing anything. Thats what i got from using the script that i posted above.
The other q? is which would be the right trigger to use?
re-read
Posted: Fri May 02, 2003 3:21 pm
by tltrude
I have been updating the script while you were posting, so re-copy it. Use a trigger_use (no setthread) and targetname it "airstrike". And, put "thread airstriketrigger" under "level waitill prespawn".
key: targetname
value: airstrike
And, check my spelling in the script because I keep misspelling airstrike!!! LOL!
Is this an objective in an objective match?
Posted: Sat May 03, 2003 8:51 am
by bodybagger
cool, thanks. i am gonna try it now.
Its not an objective, but its aimed at making the objectives harder to achive for both sides
Posted: Sat May 03, 2003 9:17 am
by bodybagger
I have tried the cript and am getting a script complie error which says:
Bad Tolken
Right braket tolken line 104 which points to the last right bracket in the script you wrote.
Help me!!

Posted: Sat May 03, 2003 10:55 am
by jv_map
if (level.airstriketimer >= 60)
should be
if (level.airstriketimer >= 60) {
Posted: Sat May 03, 2003 1:31 pm
by bodybagger
ok great fixed that, But....now i get this error
Unknown command: brake
brake line what ever
Posted: Sat May 03, 2003 2:27 pm
by jv_map
Hehe didn't even see that
All 'brake's should be 'break'.
Posted: Sat May 03, 2003 2:45 pm
by mohaa_rox
lol spelling mustakes like these mistakes will effect MoH, so be careful to speel corecctly each time you try to scipt.
Posted: Sat May 03, 2003 5:26 pm
by jv_map
Exacly

Never
Posted: Sun May 04, 2003 8:06 am
by tltrude
I never make mistakes!! look at the script again. It must be your eyes. LOL.