Page 1 of 1

Team-Specific Triggers

Posted: Thu Mar 06, 2003 9:20 pm
by MPowell1944
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?

Re: Team-Specific Triggers

Posted: Thu Mar 06, 2003 9:30 pm
by Angex
MPowell1944 wrote:This is off-topic, but it would be quite a riot if you had 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.

Posted: Thu Mar 06, 2003 9:44 pm
by MPowell1944
Yes, objectives work like this, but the usage is quite different. You can use this to stop spawn killing (like you said), or you can use this to hurt a specific team or even stop players from opening certain doors. So, there is much use for this. Just depends on if anyone would be interested.

Posted: Fri Mar 07, 2003 1:18 am
by nuggets
always interested :D thanks, ermmm... i'm sure we'll find some use 4 it, like nightclubs that prevent nazi access... possibly... :D

Posted: Fri Mar 07, 2003 11:55 am
by jv_map
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:

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
That's all 8)

Posted: Fri Mar 07, 2003 4:33 pm
by MPowell1944
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. :wink:

Posted: Fri Mar 07, 2003 5:58 pm
by jv_map
No. All commands are processed in one server frame unless you use a wait somewhere. In one frame, a player cannot be both inside and outside the trigger. :roll:

Posted: Fri Mar 07, 2003 6:18 pm
by MPowell1944
I have no idea why you are doubting this script. I ran it myself, thankyou.

Posted: Fri Mar 07, 2003 6:32 pm
by jv_map
You're wrong. This script can't work, unless you'd fix the local.index issue. When you've fixed that, it's still buggy though, because you're unnecessarily looping it. Why?

Posted: Fri Mar 07, 2003 8:04 pm
by MPowell1944
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.

Posted: Fri Mar 07, 2003 8:38 pm
by nuggets
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 :D no hard feelins m8

Posted: Fri Mar 07, 2003 10:02 pm
by jv_map
MPowell1944 wrote:Any other complaints? I used the game's scripts as an example, so you cannot tell me I am wrong.
Uh 'complaints' enough :(. Besides, a surprising amount of game scripts is crap and doesn't fuction properly :?.

Anyway, here's some complaints if you want 'em. Otherwise just skip this part :idea:.

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 :roll:

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
Please don't laugh at my reply :wink:, I only intend to offer insight.

Posted: Fri Mar 07, 2003 11:43 pm
by nuggets
lmao, sorry i know u said not 2 laugh but u could of put that at the beginning, i was laughing all the way through :)) sorry

Posted: Sat Mar 08, 2003 12:08 am
by MPowell1944
Well I am glad you have found all these errors. Since I used the game's .scr files for a base, I guess EA really can't script. :cry: