On and off trigger script
Moderator: Moderators
-
bodybagger
- Sergeant
- Posts: 52
- Joined: Mon Jan 06, 2003 5:27 pm
Ok guys, sorry to be a pain.
It kinda works.
However, when activating the trigger you have to press it 61 times for the airstrike to begin. Each time it is pressed the screen message prints:
60 second timer = 1
60 second timer = 2
and so on..
also the axis can't call off the airstike.
I am sorry i really don't understand scripts to well and really appreciate all the help you guys give
Thanks again
Craig
It kinda works.
However, when activating the trigger you have to press it 61 times for the airstrike to begin. Each time it is pressed the screen message prints:
60 second timer = 1
60 second timer = 2
and so on..
also the axis can't call off the airstike.
I am sorry i really don't understand scripts to well and really appreciate all the help you guys give
Thanks again
Craig
Hmm well tltrude seems to be quite happy with gotos but in fact they make scripts completely unreadable
.
I have another script for you to try, as ever without a single goto 8)
This code just checks if the airstrike was cancelled before the strike commences, instead of checking this every second.
I assume the trigger has targetname 'airstriketrigger', if this trigger doesn't exist the script will crash to the main menu!
I have another script for you to try, as ever without a single goto 8)
Code: Select all
main:
level waittill roundstart
thread airstrikethread
end
airstrikethread:
// wait for allies trigger event
while(1)
{
$airstriketrigger waittill trigger
if(parm.other.dmteam == allies)
break
}
// start the airstrike in 60 seconds, meanwhile the axis can yet call it off
iprintlnbold_noloc "Allied air armada will arrive in 60 seconds!"
thread airstrike
// wait for axis trigger event
while(1)
{
$airstriketrigger waittill trigger
if(parm.other.dmteam == axis)
break
}
iprintlnbold_noloc "The air strike was cancelled!"
level.cancelled_airstrike = 1
end
airstrike:
wait 60
// run airstrikes until cancelled
while(level.cancelled_airstrike != 1)
{
// example bomber line
thread global/bomber.scr::bomb 40
wait (randomfloat 4)
wait 0.5
}
endThis code just checks if the airstrike was cancelled before the strike commences, instead of checking this every second.
I assume the trigger has targetname 'airstriketrigger', if this trigger doesn't exist the script will crash to the main menu!
-
bodybagger
- Sergeant
- Posts: 52
- Joined: Mon Jan 06, 2003 5:27 pm
Sure. There you go:
I used a slightly more advanced script here to prevent execution of multiple airstrike threads in a row.
Code: Select all
main:
level waittill roundstart
thread airstrikethread
end
airstrikethread:
while(1)
{
// wait for allies trigger event
while(1)
{
$airstriketrigger waittill trigger
if(parm.other.dmteam == allies)
break
}
// start the airstrike in 60 seconds, meanwhile the axis can yet call it off
iprintlnbold_noloc "Allied air armada will arrive in 60 seconds!"
thread airstrike
local.airstrikethread = parm.previousthread
// wait for axis trigger event
while(1)
{
$airstriketrigger waittill trigger
if(parm.other.dmteam == axis)
break
}
iprintlnbold_noloc "The air strike was cancelled!"
local.airstrikethread.cancel = 1
}
end
airstrike:
wait 60
// run airstrikes until cancelled
while(local.cancel != 1)
{
// example bomber line
thread global/bomber.scr::bomb 40
wait (randomfloat 4)
wait 0.5
}
end-
bodybagger
- Sergeant
- Posts: 52
- Joined: Mon Jan 06, 2003 5:27 pm
Timer?
I have been looking at jv_map's script and for the life of me, I can't see the 60 second timer anywhere. It must be there if it works, but....... Oh, I see it now. It's a 60 second wait.
I think this line:
local.airstrikethread.cancel = 1
should be changed to:
local.cancel = 1
to fix it.
Also, the targetname of his trigger was "airstrike". Did he change it to "airstriketrigger"?
I think this line:
local.airstrikethread.cancel = 1
should be changed to:
local.cancel = 1
to fix it.
Also, the targetname of his trigger was "airstrike". Did he change it to "airstriketrigger"?
Last edited by tltrude on Mon May 05, 2003 1:55 pm, edited 2 times in total.
targetname
the targetname of his trigger was "airstrike". Did he change it to "airstriketrigger"?
-
bodybagger
- Sergeant
- Posts: 52
- Joined: Mon Jan 06, 2003 5:27 pm
Ok, here's a debug script:
See if this script generates any yellow error messages. Also test if the 'airstrike ended' message pops up (this could happen up to two minutes after you pressed the trigger). Use 'timescale 100' if you're impatient 
Code: Select all
main:
level waittill roundstart
thread airstrikethread
end
airstrikethread:
while(1)
{
// wait for allies trigger event
while(1)
{
$airstriketrigger waittill trigger
if(parm.other.dmteam == allies)
break
}
// start the airstrike in 60 seconds, meanwhile the axis can yet call it off
iprintlnbold_noloc "Allied air armada will arrive in 60 seconds!"
thread airstrike
local.airstrikethread = parm.previousthread
if !(local.airstrikethread)
iprintln "ERROR: parm.previousthread failed"
// wait for axis trigger event
while(1)
{
$airstriketrigger waittill trigger
if(parm.other.dmteam == axis)
break
}
iprintlnbold_noloc "The air strike was cancelled!"
if !(local.airstrikethread)
iprintln "ERROR: airstrikethread doesn't exist"
local.airstrikethread.cancel = 1
}
end
airstrike:
wait 60
// run airstrikes until cancelled
while(local.cancel != 1)
{
// example bomber line
iprintln "INFO: bomber run started"
thread global/bomber.scr::bomb 40
wait (randomfloat 4)
wait 0.5
}
iprintln "INFO: airstrike ended"
end
-
bodybagger
- Sergeant
- Posts: 52
- Joined: Mon Jan 06, 2003 5:27 pm

