For this I have two threads
the first checks to see if it is an Ally that has triggered the trigger and sets
the local.player to local.thief.
This seems to work fine.
Code: Select all
crate:
$crate_trigger waittill trigger
local.player = parm.other
if (local.player.dmteam == "axis")
{
print "You must protect the crate not steal it!!"
goto crate
}
if (local.player.dmteam == "allies")
{
$crate hide
$crate_trigger nontriggerable
iprintlnbold_noloc "The crate has been stolen!"
level.allies_have_crate++
local.player = local.thief
while (level.allies_have_crate>0)
{
if (! isAlive local.thief )
{
level.allies_have_crate--
$crate show
$crate_trigger triggerable
break
}
wait 1
}
}
}
end
Obviously I want the player who got the crate ( local.thief )
to be the only one who can use the trigger.
this is the thread I have but it doesn't seem to recognise the local.thief
and therefore the crate doesn't appear on the back of the truck.
If I remove the check for local thief anyone can trigger the truck_trigger
and it all works.
Code: Select all
$truck_trigger waittill trigger
local.player = parm.other
if (local.player.dmteam == "axis")
{
print "You cannot use this!!"
goto truck
}
if (local.player.dmteam == "allies")
{
iprintlnbold_noloc "You do not have the crate!!"
goto truck
}
if (local.player.dmteam == "allies") && (level.allies_have crate == 1 ) && (Isalive local.thief)
{
$truck play loopsound opeltruck_snd_idle
$crate_on_truck show
iprintlnbold_noloc "The Truck is escaping!"
$truck anim idlelights
$truck stop loopsound
while ($truck.health > 0)
{
$truck drive $truckwap1
$truck start loopsound opeltruck_snd_run
$truck waittill drive
$truck stop
$truck stop loopsound
level.targets_destroyed ++
thread allies_win
}
if ($truck.health < 0)
{
local.Exp2 = spawn animate/fx_explosion_tank.tik
local.Exp2.origin = $truck.origin
local.Exp2 anim start
wait 1
local.Exp2 anim stop
local.Exp2 remove
$truck remove
truck_health == 500
level.allies_have_crate--
$crate_on_truck hide
$crate show
$crate_trigger triggerable
goto spawn_truck
}
}
end
How do I script it so it identifes the player who triggered the crate_trigger
to be the only player who can activate the truck trigger as long as
he is alive?
If he dies the crate reappears and has to be stolen again.
Thanks in advance
