OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Kilo11 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!
-
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
-
That didint work, I tried multiple differnt things to get it to work, nothing prevailed. Thanks for the help though!
-
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 ::)
-
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.
-
I tried your edit...still didint work??? Mabey Im doing somethign wrong here.
-
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
-
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.
-
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
-
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.
-
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
-
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!"
-
RujiK,
Please lend some more details...what do you wnat me to activate that by? Where do I put triggers, etc?
-
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.
-
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?
-
only if the condition remains true for the whole of the time period.
Really?! ...oh, then my method was way too diffucult. Oh well, what's new? ::)
So, you're saying with a resistance present trigger with a timeout set to 120 seconds, and with the following in the condition field:
player1 in thislist
The trigger will only become true if player1 is in the trigger for 120 seconds? Does the tigger reset itself if player1 walks out, or will it keep track of the time?
-Student Pilot
-
Ahhaah! Got it, thanks Student Pilot and RujiK ;-)
-
So, you're saying with a resistance present trigger with a timeout set to 120 seconds, and with the following in the condition field:
player1 in thislist
Well I haven't checked exactly that condition but the principle is okay. What I would go is group the trigger with the player so only he can activate the trigger, have the activation field set to this and away you go. The player will need to be in the trigger area for the full time period for the trigger to fire.
The trigger will only become true if player1 is in the trigger for 120 seconds? Does the tigger reset itself if player1 walks out, or will it keep track of the time?
It resets itself so the 120 seconds starts again next time the player is in the trigger.
Now Killo11 seems to prefer your solution
-
It resets itself so the 120 seconds starts again next time the player is in the trigger.
That may be a problem then, I don't think Kilo11 wants the time to be reset everytime player1 leaves the trigger area.
-Student Pilot
-
Well there you go. I should have read the question.