OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Gooner861 on 20 Aug 2004, 14:43:32

Title: End mission if u take too long?
Post by: Gooner861 on 20 Aug 2004, 14:43:32
Hi there,

In a mission im making i have the player making a choice of going sumwhere to fight or staying to attack a camp nearby a town.

Now wot i want to do is if the player decides to get in a chopper to fight at another location, i want to prevent the player being able to change his mind and decide to go on and clear the camp near the town ur in.

So i dunno how that can be dun, cud u script sumthing where say the player has say 1 minute to get on the chopper, if he takes longer than the mission is over.

Sorry if this sounds rushed. In a hurry.

Cheers

Gooner
Title: Re:End mission if u take too long?
Post by: Mud_Spike on 20 Aug 2004, 15:34:37
The elapsed mission time (in seconds) is returned by the 'time' command/variable.

If you assign a variable when the player has one minut to get in the chopper (in a trigger, script, waypoint, wherever) like so:
Code: [Select]
getin_chopper_timeout = time + 60
And then have a trigger with the condition:
Code: [Select]
getin_chopper_timeout < time
you can have that trigger perform the End - Loose (or whatever it is) action.



Title: Re:End mission if u take too long?
Post by: Gooner861 on 20 Aug 2004, 18:45:20
Well you see what i have is a have a main trigger, which the player activates and than he is given a choice to call in a chopper or not.

So i think wot i'll have to do is put all that code in the choppers LOAD waypoint, when it arrives to pick me up.

Cheers

Gooner
Title: Re:End mission if u take too long?
Post by: h- on 20 Aug 2004, 19:42:40
Be aware of using time though...
It is reset to 0 after a savegame is loaded...
Title: Re:End mission if u take too long?
Post by: Mud_Spike on 20 Aug 2004, 20:36:47
Thats good info, HK, you should add that as a comment to the command reference entry.

Title: Re:End mission if u take too long?
Post by: Gooner861 on 20 Aug 2004, 20:58:48
So if sumone loads a savegame the timer wont work?
Title: Re:End mission if u take too long?
Post by: Rokket on 21 Aug 2004, 05:25:50
Don't know if this will help, I don't fully understand, but it's from the old UBER Ref guide:

==================
At first,you need write "Description.ext" like this.
***************************************
TitleParam1 = "TimeLimit:";
ValuesParam1[] = {600,900,1200,1500,1800};
DefValueParam1 = 600;
TextsParam1[] = {"10 min","15 min","20 min","25 min","30 min"};
***************************************
then,you can choose time limit when starting game.
and put trigger
--Type:End #1
--Condition:Time >= Param1
(Command"Time" is reference to how many seconds passed since starting game.)
Then,game will end if time comes.
This is a beginner course.

Now,you can show selectable menu on ServerSetup screen by "Description.ext".
and its possible also at Param2.
For example,if you want selectable TimeZone menu,
write "description.ext" like this.
***************************************
TitleParam2 = "TimeZone:";
ValuesParam2[] = {6,12,18};
DefValueParam2 = 2;
TextsParam2[] = {"Morning","Noon","Evening"};
***************************************
next, put trigger for init.
--Cond:true
--OnAct:SkipTime Param2
(Dont forget to set Time of Intel to "0:00")
then,you can choose time zone at ServerSetup screen.

==================
Title: Re:End mission if u take too long?
Post by: h- on 21 Aug 2004, 16:51:41
Quote
So if sumone loads a savegame the timer wont work?
The timer on the trigger works, yes.

But the 'command' time has a bug that when ever a saved game is reloaded the time value it gives resets back to 0...

So, if using a script that bases some of it's 'actions' to time it will get screwed after savegame reload...

Surely, the example given in the second post won't probably get screwed so badly as not many use their 'only' savegame in the beginning...

Quote
Thats good info, HK, you should add that as a comment to the command reference entry.
Oh, it isn't there allready...
Well, should be added then...


regarding the question:
I'm a bit 'lost' what you want exactly, but in the most simpliest way you could use a timeout trigger.

Make a trigger that covers the area where player and the chopper are, then put the trigger on timeout 60/60/60, activated by the player side, and write in the condition field: vehicle player in thisList
Then, in the on activation field you put the variable controlling the 'bad' end for the mission and set it to true, like my_badend=true.
Then, make a end trigger, like end#2 or something (assuming you use the end#1 for the 'good' end) with condition my_badend in it's condition field...
Now, in theory ( ::) ), the timeout trigger should 'trig' if the player is in the trigger area after 60 seconds and then 'trig' the 'bad' end trigger...
But as I said, in theory, no guarantees that it will work...

As for not allowing the player to go and 'clean' the closest town, it depends on whether you want the location to be available for 'cleaning' later on in the mission or not...
If not, you could use a variable that is set to true when the player selects the other location than the closest town and when that variale is set to true, all the enemies in the closest town would be deleteVehicled...
That is of course a bit crappy way of doing this if the briefing states that there's enemy activity in that town and when you fly over it with the chopper there's no enemies there at all... ::)
Title: Re:End mission if u take too long?
Post by: LCD on 21 Aug 2004, 17:27:28
Quote
As for not allowing the player to go and 'clean' the closest town, it depends on whether you want the location to be available for 'cleaning' later on in the mission or not...
If not, you could use a variable that is set to true when the player selects the other location than the closest town and when that variale is set to true, all the enemies in the closest town would be deleteVehicled...
That is of course a bit crappy way of doing this if the briefing states that there's enemy activity in that town and when you fly over it with the chopper there's no enemies there at all...  

u can do wat bis did in their mision.... if u go 2 far from the mision area a spetznatz appears n shot u ::);D

or u can use the daytime command as this doesnt reset everytime... somin like that i think

Code: [Select]
_taam = daytime
@daytime = (_taam +1/60)
watever

not sure bout the sec lin tho :P

LCD OUT
Title: Re:End mission if u take too long?
Post by: Gooner861 on 21 Aug 2004, 18:55:47
Thanks for the help guys, im gonna give it a whirl now. I'll get back to u soon.

Gooner
Title: Re:End mission if u take too long?
Post by: Nulear_Man on 22 Aug 2004, 16:10:34
YOu COuld Also Do this
TimeLimitSecs = 1200
~TimeLimitSecs
EndMission

;the endMission command may not be correct (it should force end of mission)