Trigger to take all weapons but 1
Moderator: Moderators
Trigger to take all weapons but 1
ok thx yall for helping me on last map got it fully completed and testing now.....my next map is stalingrad i want to put triggers in at the boiler room doors all entries to take all ur weapons from u except the pistol making it bash only in there..i know my coords and everything but i dont know how to put in trigger or trigger it to takeall and give one...been searching on here but find things close but not exactly what i need.....thx for any and all help guys
Here is a tutorial for spawning triggers
http://blazinmohaa.com/adding_triggers_final.htm
To make the player take all but the pistol you would have to go something like this:
$mytrigger waittill trigger
local.player = parm.other
local.player takeall
if (local.player = allied)
local.player item weapons/colt45.tik
else
local.player item weapons/p38.tik
end
I am not sure if this will work (the allied part). You could test it.
http://blazinmohaa.com/adding_triggers_final.htm
To make the player take all but the pistol you would have to go something like this:
$mytrigger waittill trigger
local.player = parm.other
local.player takeall
if (local.player = allied)
local.player item weapons/colt45.tik
else
local.player item weapons/p38.tik
end
I am not sure if this will work (the allied part). You could test it.
ok thx alot i got my trigger in place now and it takes all weaopns and it only gives u pistol back but u have to choose pistol from ur bar at bottom it doesnt give it in ur hands...how can i make it put the pistol in ur hands without having to choose weapon.....also i would like to know how to add more triggers in same script i tried a few things and couldnt get it to work....here is what i have so far but i need 2 more triggers at the other doors to the boiler room
Code: Select all
level waittill prespawn
local.trig = spawn trigger_multiple
local.trig.origin = ( 885 85 -100 ) // This is where you place the cords you have.
local.trig setsize ( -85 -45 -55 ) ( 85 45 55 ) //The way this works is it defines the box size. (the larger the numbers the larger the area)
//Directions for the size(south east down) (north west up) I believe these are in inches
local.trig setthread Trigger1 //Name of thread.
Trigger1: //This is the name of the thread you defined earlier in setthread.
self waittill trigger //Tells it to wait until the trigger is set off and is something you will never change.
local.player=parm.other //Something you will never change.
if (local.player.isTrigger1==1) //Change this to the name of the thread, in this case Trigger1.
end //This defines the end of this thread.
local.player.isTrigger1=1 //Since we made the player turn on the trigger, this says what to do once it?s turned on.
local.player takeall // This is where you execute the command. You never change the words ?local.player?.
local.player item weapons/colt45.tik // This is where you execute the 2nd command. You never change the words ?local.player?.
local.player.isTrigger1=0 //Again make sure this has the name of the thread above for it to work.
endYou actually made that complicated, (something I usually do before I see the easy answer)
Here is your code:
level waittill prespawn
local.trig = spawn trigger_multiple
local.trig.origin = ( 885 85 -100 ) // This is where you place the cords you have.
local.trig setsize ( -85 -45 -55 ) ( 85 45 55 ) //The way this works is it defines the box size. (the larger the numbers the larger the area)
//Directions for the size(south east down) (north west up) I believe these are in inches
local.trig setthread Trigger1 //Name of thread.
Trigger1: //This is the name of the thread you defined earlier in setthread.
self waittill trigger //Tells it to wait until the trigger is set off and is something you will never change.
local.player=parm.other //Something you will never change.
if (local.player.isTrigger1==1) //Change this to the name of the thread, in this case Trigger1.
end //This defines the end of this thread.
local.player.isTrigger1=1 //Since we made the player turn on the trigger, this says what to do once it?s turned on.
local.player takeall // This is where you execute the command. You never change the words ?local.player?.
local.player item weapons/colt45.tik // This is where you execute the 2nd command. You never change the words ?local.player?.
local.player.isTrigger1=0 //Again make sure this has the name of the thread above for it to work.
end
Change it to this to get 2 more triggers:
main:
level waittill prespawn
local.trig = spawn trigger_multiple
local.trig.origin = ( 885 85 -100 ) // This is where you place the cords you have.
local.trig setsize ( -85 -45 -55 ) ( 85 45 55 ) //The way this works is it defines the box size. (the larger the numbers the larger the area)
//Directions for the size(south east down) (north west up) *** These are in world units as in radiant. (16 units = 1 foot)
local.trig setthread Trigger1 //Name of thread.
Trigger1: //This is the name of the thread you defined earlier in setthread.
self waittill trigger //take this out. Trigger1 is the setthread that runs when the trigger is triggered, you dont need to wait for it to be triggered again
local.player=parm.other //Something you will never change.
local.player takeall
local.player item weapons/colt45.tik //ADD all of this
local.player ammo pistol 100
local.player useweaponclass pistol
end
Take all of the green out it isnt needed
if (local.player.isTrigger1==1)
end //This defines the end of this thread.
local.player.isTrigger1=1 //Since we made the player turn on the trigger, this says what to do once it?s turned on.
local.player takeall // This is where you execute the command. You never change the words ?local.player?.
local.player item weapons/colt45.tik // This is where you execute the 2nd command. You never change the words ?local.player?.
local.player.isTrigger1=0 //Again make sure this has the name of the thread above for it to work.
end
And then just add 2 more sections for triggers. Here is the final code with all of the triggers.
There is your code. Tell me if it works and reply back if you need any help
Here is your code:
level waittill prespawn
local.trig = spawn trigger_multiple
local.trig.origin = ( 885 85 -100 ) // This is where you place the cords you have.
local.trig setsize ( -85 -45 -55 ) ( 85 45 55 ) //The way this works is it defines the box size. (the larger the numbers the larger the area)
//Directions for the size(south east down) (north west up) I believe these are in inches
local.trig setthread Trigger1 //Name of thread.
Trigger1: //This is the name of the thread you defined earlier in setthread.
self waittill trigger //Tells it to wait until the trigger is set off and is something you will never change.
local.player=parm.other //Something you will never change.
if (local.player.isTrigger1==1) //Change this to the name of the thread, in this case Trigger1.
end //This defines the end of this thread.
local.player.isTrigger1=1 //Since we made the player turn on the trigger, this says what to do once it?s turned on.
local.player takeall // This is where you execute the command. You never change the words ?local.player?.
local.player item weapons/colt45.tik // This is where you execute the 2nd command. You never change the words ?local.player?.
local.player.isTrigger1=0 //Again make sure this has the name of the thread above for it to work.
end
Change it to this to get 2 more triggers:
main:
level waittill prespawn
local.trig = spawn trigger_multiple
local.trig.origin = ( 885 85 -100 ) // This is where you place the cords you have.
local.trig setsize ( -85 -45 -55 ) ( 85 45 55 ) //The way this works is it defines the box size. (the larger the numbers the larger the area)
//Directions for the size(south east down) (north west up) *** These are in world units as in radiant. (16 units = 1 foot)
local.trig setthread Trigger1 //Name of thread.
Trigger1: //This is the name of the thread you defined earlier in setthread.
self waittill trigger //take this out. Trigger1 is the setthread that runs when the trigger is triggered, you dont need to wait for it to be triggered again
local.player=parm.other //Something you will never change.
local.player takeall
local.player item weapons/colt45.tik //ADD all of this
local.player ammo pistol 100
local.player useweaponclass pistol
end
Take all of the green out it isnt needed
if (local.player.isTrigger1==1)
end //This defines the end of this thread.
local.player.isTrigger1=1 //Since we made the player turn on the trigger, this says what to do once it?s turned on.
local.player takeall // This is where you execute the command. You never change the words ?local.player?.
local.player item weapons/colt45.tik // This is where you execute the 2nd command. You never change the words ?local.player?.
local.player.isTrigger1=0 //Again make sure this has the name of the thread above for it to work.
end
And then just add 2 more sections for triggers. Here is the final code with all of the triggers.
Code: Select all
main:
level waittill prespawn
local.trig = spawn trigger_multiple
local.trig.origin = ( 885 85 -100 ) //your coords you had
local.trig setsize ( -85 -45 -55 ) ( 85 45 55 )
local.trig setthread Trigger1
local.trig2 = spawn trigger_multiple
local.trig2.origin = (Put your coord here)
local.trig2 setsize (setsize here)(****)
local.trig2 setthread Trigger2
local.trig3 = spawn trigger_multiple
local.trig3.origin = (Put your coord here)
local.trig3 setsize (setsize here)(*****)
local.trig3 setthread Trigger3
level waittill spawn
Trigger1:
local.player=parm.other
local.player takeall
local.player item weapons/colt45.tik
local.player ammo pistol 100
local.player useweaponclass pistol
end
Trigger2:
local.player=parm.other
local.player takeall
local.player item weapons/colt45.tik
local.player ammo pistol 100
local.player useweaponclass pistol
end
Trigger3:
local.player=parm.other
local.player takeall
local.player item weapons/colt45.tik
local.player ammo pistol 100
local.player useweaponclass pistol
end
Um sorry to be so picky but since all the trigger threads are exactly the same word for word why not just use the setthread to use the same thread for all of the triggers it is a lot less writing that way . Also I think you missed an end at the end of the main thread and before the trigger threads .
All this sounds simple enough but there are some things to concider . First the trigger is going to keep firing as long as the player is triggering it so it will take and give over and over again . If you make the trigger not triggerable untill the player is no longer touching it that would help . Second players who have not hit a trigger will still have the normal weapons .
Code: Select all
main:
level waittill prespawn
local.trig = spawn trigger_multiple
local.trig.origin = ( 885 85 -100 ) //your coords you had
local.trig setsize ( -85 -45 -55 ) ( 85 45 55 )
local.trig setthread Triggers
local.trig2 = spawn trigger_multiple
local.trig2.origin = (Put your coord here)
local.trig2 setsize (setsize here)(****)
local.trig2 setthread Triggers
local.trig3 = spawn trigger_multiple
local.trig3.origin = (Put your coord here)
local.trig3 setsize (setsize here)(*****)
local.trig3 setthread Triggers
level waittill spawn
end
Triggers:
local.player=parm.other
local.player takeall
local.player item weapons/colt45.tik
local.player ammo pistol 100
local.player useweaponclass pistol
end
yes thats right.....im only putting triggers at all the entrances to the boiler room in stalingrad because we r making it bash only....if u dont go in the boiler room u will play the other parts of the maps with whatever weapon u choose but bash only in boiler......then ill try the other way u said with the setthread...it is less typing and i like that=)...also will take up less space in my script...thx for all the replys guys. Second players who have not hit a trigger will still have the normal weapons .
after the player leaves the room
wont the player still have just the pistol when he leaves the boiler room?
Can you have the player get his weapons back?
Can you have the player get his weapons back?
yeah u can have the player get his weapon or weapons back but u will have to put another trigger where u want to that will do that....if u leave our boiler room u will still only have pistol but if u want to leave with weapons u will need to put in another trigger somewhere outside the ones that take and give back weapons.....
Doesn't work
The script to remove weapons is not being cast on my player. I have tried renaming it because of a previous command that may have named my player $player[local.tm]. any ideas?
Both codes have been threaded, and the weapon trigger is actually an entity in the map.
Code: Select all
spectate:
while(1)
{
for (local.playtm=1;local.playtm <= $player.size;local.playtm++)
{
if ($player[local.playtm].dmteam == "axis")
$player[local.playtm] german
$player[local.playtm] threatbias 1000
if ($player[local.playtm].dmteam == "allies")
$player[local.playtm] american
$player[local.playtm] threatbias 1000
if ($player[local.playtm].dmteam == "spectator")
$player[local.playtm] threatbias ignoreme
}
waitframe
}
endCode: Select all
weapon_trig:
$weapon_trig waittill trigger
local.tm takeall
local.tm item weapons/colt45.tik
local.tm ammo pistol 0
local.tm useweaponclass pistol
endFixed it
I had to do this to get it to run:
I have a deadbox in my map. Players who die 6 seconds after the game starts go here and may watch the game in progress. A waiting area, which will prevent them from interfereing with the current match.
Code: Select all
weapon_trig:
$weapon_trig waittill trigger
for (local.i=1;local.i <= $player.size;local.i++)
{
local.origin = $player.origin
$player[local.i] takeall
}
goto weapon_trig
endhave u tried it like this?
just wondering because on mine i dont waittill trigger...that is the trigger
whenh u trigger this is what happens
parm.other then takeall then it gives u selected weapon
Code: Select all
weapon_trig:
local.tm=parm.other
local.tm takeall
local.tm item weapons/colt45.tik
local.tm ammo pistol 0
local.tm useweaponclass pistol
endwhenh u trigger this is what happens
parm.other then takeall then it gives u selected weapon
Mistakenness
Still working with the code. For some reason, my method casts to all players. Hence, all players lose wepons on respawn.
My new method uses this:
Will test to see if this works sometime.
My new method uses this:
Code: Select all
weapon_trig:
$weapon_trig waittill trigger
local.playtm=parm.other
local.playtm takeall
goto weapon_trig
end bashers?
No, it is not. This is for a completely new map which is a Speedball field. The map has a center flag which runs up the pole to score for either team. Map also has AI, which will play for the flag, even if there are no players on the field. (Axis and Allies from single player.)
The code is needed for a deadbox. Players eliminated from the field after the game starts will spawn weaponless to the deadbox, where the game can be watched from the sidelines. Those who spawn late will wait here for the next match. The AI take about 38 seconds to win by themselves, but will occasionaly hang up for nearly 2 minutes if "line of sight" becomes an issue.
The code is needed for a deadbox. Players eliminated from the field after the game starts will spawn weaponless to the deadbox, where the game can be watched from the sidelines. Those who spawn late will wait here for the next match. The AI take about 38 seconds to win by themselves, but will occasionaly hang up for nearly 2 minutes if "line of sight" becomes an issue.

