Home   Help Search Login Register  

Author Topic: Time in Trigger as Condition  (Read 1310 times)

0 Members and 1 Guest are viewing this topic.

Kilo11

  • Guest
Time in Trigger as Condition
« on: 15 Aug 2005, 02:35:47 »
I need the scripting to do the following:

I want the leader of a group (player1), to stay in a tent while the rest must defend him.  He can leave the tent..but needs to spend 2 minutes in the tent before the mission will continue.  Is there anyway to track the amount of time he is within the area of a trigger, to make it the condition for another trigger?

Example:

?player1 in trigger1 >120 : MISSION_CONTINUE = true


I know thats not right...but mabey it will help you understand...mabey lol.  Thanks for anyones help or direction!

Offline Pilot

  • Contributing Member
  • **
Re:Time in Trigger as Condition
« Reply #1 on: 15 Aug 2005, 02:47:27 »
Uhh, try the following.  Name the trigger player1List

Then, make a script, name it CheckArea.sqs and put the following in it:

_man1 = _this select 0

InTrigger=0

#Loop
?InTrigger==120: goto "End"
?_man1 in player1List: InTrigger=InTrigger+1
~1
goto "Loop"

#End
MISSION_CONTINUE=true
exit

Call the script by the following:
[player1] exec "CheckArea.sqs"

Then, make sure you have the following in init.sqs:
MISSION_CONTINUE=false

Finally, in the other trigger you want to fire when the man is in the tent for two minutes, write in the condition field:
NextTrigger

But don't take my idea right away, I'm sure someone will be around shortly with an easier way of doing it. :P

One final thing, syntax not guarenteed.

-Student Pilot
« Last Edit: 15 Aug 2005, 02:49:30 by Student Pilot »

Kilo11

  • Guest
Re:Time in Trigger as Condition
« Reply #2 on: 15 Aug 2005, 03:19:03 »
That didint work, I tried multiple differnt things to get it to work, nothing prevailed.  Thanks for the help though!


Offline Pilot

  • Contributing Member
  • **
Re:Time in Trigger as Condition
« Reply #3 on: 15 Aug 2005, 03:26:50 »
Hmm, that's disappointing.  I'll see what I can do and if I get anywhere I will post back.

-Student Pilot

EDIT:
Ok, my mistake.  In the trigger player1 has to be in, don't name it anything.  Instead, put the following in the On Activation field:
player1List=thislist

Ahh, what a newbie mistake ::)
« Last Edit: 15 Aug 2005, 03:41:13 by Student Pilot »

Kilo11

  • Guest
Re:Time in Trigger as Condition
« Reply #4 on: 15 Aug 2005, 03:28:20 »
Copy that, thanks for the effort, im Still trying to test it out.  mabey I did something wrong? Try what you did in game, it may work for you and Im just being dumb.  Thanks again.

Kilo11

  • Guest
Re:Time in Trigger as Condition
« Reply #5 on: 15 Aug 2005, 03:47:18 »
I tried your edit...still didint work??? Mabey Im doing somethign wrong here.

Offline Pilot

  • Contributing Member
  • **
Re:Time in Trigger as Condition
« Reply #6 on: 15 Aug 2005, 03:50:54 »
If your unit is a west unit, make sure the trigger is set to West Present, or if it is east, East Present, ect.

-Student Pilot

Kilo11

  • Guest
Re:Time in Trigger as Condition
« Reply #7 on: 15 Aug 2005, 03:53:57 »
Here is what I have:

Resistance Unit (player1)
__________________________
Trigger: no name
10x10 Axis
Activation: Resistance - Present
On Activation:player1List=thislist
__________________________
Script Named: "CheckArea.sqs"
with:

_man1 = _this select 0

InTrigger=0

#Loop
?InTrigger==120: goto "End"
?_man1 in player1List: InTrigger=InTrigger+1
~1
goto "Loop"

#End
MISSION_CONTINUE=true
exit

Call the script by the following:
[player1] exec "CheckArea.sqs"
____________________________

Player1 steps into 10x10 trigger area....waits 2 minutes...nothing happens.  I have a trigger with condition "MISSION_COMPLETE" that activated a hint that says "It worked".....

It hasnt worked yet lol.
« Last Edit: 15 Aug 2005, 03:55:17 by Kilo11 »

Offline Pilot

  • Contributing Member
  • **
Re:Time in Trigger as Condition
« Reply #8 on: 15 Aug 2005, 03:57:50 »
Ok, do you have an init.sqs file?  If not, you need one, put the following in init.sqs:

MISSION_CONTINUE=false


Also, and I know this may seem like a dumb question, how are you calling the script?

-Student Pilot

Kilo11

  • Guest
Re:Time in Trigger as Condition
« Reply #9 on: 15 Aug 2005, 04:03:00 »
This is the On Activation Field of the trigger;


player1List = thislist; [player1] exec "CheckArea.sqs"




I am getting an error from the player1list=thislist part when I launch game....

And yes, that is in the init.sqs.
« Last Edit: 15 Aug 2005, 04:03:16 by Kilo11 »

Offline Pilot

  • Contributing Member
  • **
Re:Time in Trigger as Condition
« Reply #10 on: 15 Aug 2005, 04:07:03 »
Hmmm, this is odd.  I will have to recheck how I did it, because it works for me.  I will do so tomorrow.  The only thing I can suggest is to make a new trigger:

Size: X=0  Y=0

Activation:
Anybody - Not Present

On Activation:
[player1] exec "CheckArea.sqs"

And then remove the call for the script from the other trigger.

Also, can you post the exact trigger?

-Student Pilot

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:Time in Trigger as Condition
« Reply #11 on: 15 Aug 2005, 04:31:35 »
Here is an easier way.

just name your tent "Tent" Or whatever and do this:

_num = 0
#loop
~1
if(Officer_man distance tent < 5)then{_num = _num + 1}else{hint"Hes outa the tent! No goal!"}
?(_num != 120):goto"loop"
hint"HES DEFENDED BABY!"
« Last Edit: 15 Aug 2005, 04:32:23 by RujiK »
I like your approach, lets see your departure.
Download the New Flashlight Script!

Kilo11

  • Guest
Re:Time in Trigger as Condition
« Reply #12 on: 15 Aug 2005, 07:23:03 »
RujiK,

Please lend some more details...what do you wnat me to activate that by? Where do I put triggers, etc?

Offline Pilot

  • Contributing Member
  • **
Re:Time in Trigger as Condition
« Reply #13 on: 15 Aug 2005, 14:26:27 »
Quote
Here is an easier way.
I knew it! :P

I think the script simply replaces my script.  I think everything else is the same.  Feel free to correct me if I am wrong, Rujik.

-Student Pilot

EDIT:
Actually no, now that I look at it it is much simpler than my way (I'm going to cry).  All you need is a trigger to activate the script.
« Last Edit: 15 Aug 2005, 14:28:12 by Student Pilot »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Time in Trigger as Condition
« Reply #14 on: 15 Aug 2005, 15:19:07 »
Forgive me if I miss the point.  I only read the first post and skimmed the rest so I may have missed something.

Have you investigated the CountDown and the TimeOut features of triggers?  One will cause the tigger to fire a defined time after the condition becomes true and the other will cause the trigger to fire a defined time after the condition becomes true, only if the condition remains true for the whole of the time period.

Is that what you want?