Yet another trigger question

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Yet another trigger question

Post by blue60007 »

OK I need a trigger_multiple but I want it to be 'triggered' for say 10 seconds before it is triggered. Basically I have a room that I want the person to be in for a certain amount of time before triggering. Also how do I set it so it works for only one team?

THanks!
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Re: Yet another trigger question

Post by dcoshea »

Hi there,
blue60007 wrote:OK I need a trigger_multiple but I want it to be 'triggered' for say 10 seconds before it is triggered. Basically I have a room that I want the person to be in for a certain amount of time before triggering. Also how do I set it so it works for only one team?
I'm not sure on either of these things, so you might want to wait on confirmation from an expert (experts: please confirm what I have to say, or correct me!) but I think that to delay the calling of your 'setthread', you should set the 'delay' for the trigger:
Game Module Classes wrote:delay( Float delay_time )
Set the delay time (time between triggering and firing) for this trigger
As for only triggering for a certain team, I don't think you can do that, so I think you have to just put some code like this in the top of your 'setthread' thread:

Code: Select all

local.player = parm.other
if (local.player.dmteam != "allies") { // or "axis" if that's the team you want
	end // exit the thread immediately since the player is not on the team we're interested in
}
// do processing here, knowing the player is on the correct team
Hope this helps.

Regards,
David
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

Well thanks but I've decided just to forget this feature of the map, it won't be triggerable it'll just go on its own. But as for the delay thats say I walk through it but it won't fire for another x seconds.
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post by dcoshea »

blue60007 wrote:But as for the delay thats say I walk through it but it won't fire for another x seconds.
Sorry, I thought that was what you wanted :) I guess you don't need that functionality now, but if you do, let me know and we can try and figure out a solution that meets your requirements.

Regards,
David
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

I guess what you could do is set the wait to something like .5 then in the script:

Code: Select all

level.triggercount = 0
trigger:
{
level.triggercount ++
}

if (level.triggercount == 10)
{
level.triggercount = 0
goto whatever
}
else
{
goto trigger
}

then maybe you could incorporate a feature that resets triggercount to 0 if when it is > 0 and doesn't reach 10 within 30 seconds or something...
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

nope

Post by tltrude »

In your thread, if it runs at all, the count will reach 10 in the blink of an eye. It needs a "wait 1" to make it slow down to one loop per second.

You don't need brackets around "level.triggercount ++" and "goto trigger". Also, it is not a good idea to name the thread "trigger" because that is a command word.

level waittill prespawn
level.triggercount = 0
level waittill spawn

end

trigger_timer:

level.triggercount ++

if (level.triggercount == 10)
{
level.triggercount = 0
goto whatever
end
}
wait 1
goto trigger_timer

end
Tom Trude,

Image
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

but would you need the wait 1 if you set a key/value of wait/1 in the trigger because then wouldn't that make it 2 seconds wait??

oh yeah, I forgot you don't need brackets there, I've been doing a little bit of C++ lately...
Post Reply