Team-Specific Triggers
Moderator: Moderators
- MPowell1944
- Moderator
- Posts: 287
- Joined: Thu Jan 09, 2003 7:06 am
- Location: Woodstock, GA
- Contact:
Team-Specific Triggers
This is off-topic, but it would be quite a riot if you had team-specific triggers. Here is how you would setup a trigger_multiple so that it would only hurt an allied player. Could come useful in the future :
-Make a trigger_multiple.
-Enter targetname for the KEY and pain_trigger for the VALUE.
-Enter setthread for the KEY and pain_setup for the VALUE.
-Enter the following script after your level waittill spawn end command :
pain_setup:
local.player = parm.other
if (local.player.dmteam != axis)
goto pain_setup
if (local.player istouching $pain_trigger[local.index] == 1)
{
local.player exec global/bullethit.scr (0 -1 0) 1000 50 1
}
goto pain_setup
end
I was thinking about writing a tutorial covering Team-Specific Triggers. What do you think?
-Make a trigger_multiple.
-Enter targetname for the KEY and pain_trigger for the VALUE.
-Enter setthread for the KEY and pain_setup for the VALUE.
-Enter the following script after your level waittill spawn end command :
pain_setup:
local.player = parm.other
if (local.player.dmteam != axis)
goto pain_setup
if (local.player istouching $pain_trigger[local.index] == 1)
{
local.player exec global/bullethit.scr (0 -1 0) 1000 50 1
}
goto pain_setup
end
I was thinking about writing a tutorial covering Team-Specific Triggers. What do you think?
Re: Team-Specific Triggers
I thought that was how the obj maps worked. Plus I'm sure other maps use something like that to stop people wandering into the other teams spawn area.MPowell1944 wrote:This is off-topic, but it would be quite a riot if you had team-specific triggers.
- MPowell1944
- Moderator
- Posts: 287
- Joined: Thu Jan 09, 2003 7:06 am
- Location: Woodstock, GA
- Contact:
This script will not work but result in the following error:
bad lvalue NIL
As local.index is not defined. Fortunately, you don't need this index nor does the trigger have to have a targetname. The line
if (local.player istouching $pain_trigger[local.index] == 1)
servers no use at all, as the thread only runs when the trigger is triggered
.
I've got a piece of easier and shorter code if you want it:
That's all 8)
bad lvalue NIL
As local.index is not defined. Fortunately, you don't need this index nor does the trigger have to have a targetname. The line
if (local.player istouching $pain_trigger[local.index] == 1)
servers no use at all, as the thread only runs when the trigger is triggered
I've got a piece of easier and shorter code if you want it:
Code: Select all
pain_setup:
local.player = parm.other
if(local.player.dmteam == allies)
local.player exec global/bullethit.scr (0 -1 0) 1000 50 1
end
- MPowell1944
- Moderator
- Posts: 287
- Joined: Thu Jan 09, 2003 7:06 am
- Location: Woodstock, GA
- Contact:
jv you make me laugh. the istouching command checks to see if the player is still touching the trigger after it checks the dmteam. this gives the player a chance to escape before they get hurt. hence, if the player isnottouching the trigger after it checks the dmteam, it reloops and waits for the next player to touch it. 
- MPowell1944
- Moderator
- Posts: 287
- Joined: Thu Jan 09, 2003 7:06 am
- Location: Woodstock, GA
- Contact:
- MPowell1944
- Moderator
- Posts: 287
- Joined: Thu Jan 09, 2003 7:06 am
- Location: Woodstock, GA
- Contact:
Here is a fixed version of the script without the usage of a setthread in the trigger :
level waittill spawn:
thread pain_setup
end
pain_setup:
pain_trigger local.index
local.player = parm.other
$pain_trigger[local.index] waittill trigger
if (local.player.dmteam != axis)
goto pain_setup
if (local.player istouching $pain_trigger[local.index] == 1)
{
local.player exec global/bullethit.scr (0 -1 0) 1000 50 1
}
goto pain_setup
end
Any other complaints? I used the game's scripts as an example, so you cannot tell me I am wrong.
level waittill spawn:
thread pain_setup
end
pain_setup:
pain_trigger local.index
local.player = parm.other
$pain_trigger[local.index] waittill trigger
if (local.player.dmteam != axis)
goto pain_setup
if (local.player istouching $pain_trigger[local.index] == 1)
{
local.player exec global/bullethit.scr (0 -1 0) 1000 50 1
}
goto pain_setup
end
Any other complaints? I used the game's scripts as an example, so you cannot tell me I am wrong.
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
ermmm... don't mean 2 butt in in the middle of your heart 2 heart, but...
Error MPOWELL
you'll need another line of script to stop the trigger being triggered if an ally is activating the trigger, if he was 2 wait inside the trigger you would end up with an infinate loop (server crash 2 commence shortly), sorry but on this occassion i'm joinin JV's team
no hard feelins m8
Error MPOWELL
you'll need another line of script to stop the trigger being triggered if an ally is activating the trigger, if he was 2 wait inside the trigger you would end up with an infinate loop (server crash 2 commence shortly), sorry but on this occassion i'm joinin JV's team
hope this helps, prob not cos it's all foreign 2 me :-/
Uh 'complaints' enoughMPowell1944 wrote:Any other complaints? I used the game's scripts as an example, so you cannot tell me I am wrong.
Anyway, here's some complaints if you want 'em. Otherwise just skip this part
level waittill spawn:
The colon shouldn't be there, it's supposed to say
level waittill spawn
---------------------------------
pain_trigger local.index
No clue what this is supposed to do
local.player = parm.other
$pain_trigger[local.index] waittill trigger
local.player should be set to parm.other after the trigger was triggered, or you'll get very weird behaviour.
$pain_trigger[local.index] waittill trigger
local.index is undefined.
if (local.player.dmteam != axis)
I thought you wanted to hurt allied players?
if (local.player istouching $pain_trigger[local.index] == 1)
like I said before this line doesn't do anything but waste CPU time.
On a side note, try not to use goto commands. They make scripts very hard to read and you're asking for bugs if you use them. Goto is always considered harmful. Try to use a while loop instead:
Code: Select all
pain_setup:
while(1)
{
$pain_trigger waittill trigger
local.player = parm.other
if(local.player.dmteam == allies)
local.player exec global/bullethit.scr (0 -1 0) 1000 50 1
}
end
- MPowell1944
- Moderator
- Posts: 287
- Joined: Thu Jan 09, 2003 7:06 am
- Location: Woodstock, GA
- Contact:
