my map contains a munitions depot. at map start, the depot is neutral and nobody can pickup ammo, then teams can switch it to their side to allow ammo pickup.
Here's the part for the switches
Code: Select all
/////////////////////////////////////////
// Switch Ammo Depot to Axis on use
/////////////////////////////////////////
RedAmmoThread:
while(1)
{
$trigger_ammoaxis waittill trigger // wait until a player activates
$trigger_ammoaxis nottriggerable // make sure nothing else gets
$trigger_ammoallies nottriggerable // started on either side
local.player = parm.other // get player reference
if(local.player.dmteam == "axis") // is it an axis? (red)
{
// if already controlled, print reminder message
if(level.ammo_ownerteam == "axis")
{
local.player iprint "Your team already has control of the depot!"
}
else // else team gains control
{
$trigger_ammoaxis playsound alarm_switch
level.ammo_ownerteam = "axis"
iprintlnbold "Red Team gained control of the the munitions depot!"
}
}
else //player is an allied, print denied message
{
local.player iprint "This is the Red Team switch, you cannot activate it!"
if(level.ammo_ownerteam == "allies")
{
// and tell him he already has control
local.player iprint "Anyway your team already has control of the depot..."
}
}
// reset triggering switches
$trigger_ammoallies triggerable
$trigger_ammoaxis triggerable
}
end
/////////////////////////////////////////
// Switch Ammo Depot to Allies on use
/////////////////////////////////////////
BlueAmmoThread:
while(1)
{
$trigger_ammoallies waittill trigger // wait until a player activates
$trigger_ammoallies nottriggerable // make sure nothing else gets
$trigger_ammoaxis nottriggerable // started on either side
local.player = parm.other // get player reference
if(local.player.dmteam == "allies") // is it an allied? (blue)
{
// if already controlled, print reminder message
if(level.ammo_ownerteam == "allies")
{
local.player iprint "Your team already has control of the depot!"
}
else // else team gains control
{
$trigger_ammoallies playsound alarm_switch
level.ammo_ownerteam = "allies"
iprintlnbold "Blue Team gained control over the munitions depot!"
}
}
else //player is an axis, print denied message
{
local.player iprint "This is the Blue Team switch. You cannot activate it."
if(level.ammo_ownerteam == "axis")
{
// and tell him he already has control
local.player iprint "Anyway your team already has control of the depot..."
}
}
// reset triggering switches
$trigger_ammoaxis triggerable
$trigger_ammoallies triggerable
}
end
The part i need advice on is, i want to set many kind of munitions to be picked up, the model disappears after being picked up but respawn after a while (i can manage to get this working). Usually, ammo is automatically picked up by the player who touches it, i want to check the dmteam of the player first to see if he's allowed to pick it up.
so far i got this part of the script, the $trigger_ammopickup should be the one activated by the player when picking up the munitions, but i'm not sure it's the good way to go, is there an easier way? can i have control over the automatic pickup of munitions that's ingame?
Code: Select all
////////////////////////////////////////
// Filter who tries to pickup ammo
// level.ammo_ownerteam determine who can pickup
// axis, allies, neutral(none)
///////////////////////////////////////
AmmoPickupFilter:
while(1)
{
//set waiting trigger on ammo trigger objects
$trigger_ammopickup waittill trigger <-- replace this by the ammo models and add a trigger on them?
local.player = parm.other
if(level.ammo_ownerteam == "neutral")
{
local.player iprintln "Your team must first get control over the munitions depot!"
}
else if(local.player.dmteam == level.ammo_ownerteam)
{
local.player iprintln "Here is your munitions refill!"
//give ammo to player, his team owns the depot <-- that's what i need control on, player has good team, give him ammo he touched
}
else
{
local.player iprintln "Munitions pickup denied"
local.player iprintln "Your team must first get control over the munitions depot!" <-- that's what im not sure how to
}
}
end



