Home   Help Search Login Register  

Author Topic: timer  (Read 1239 times)

0 Members and 1 Guest are viewing this topic.

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
timer
« on: 22 Oct 2002, 01:15:12 »
now, i have a situation where a player has to kill 8 targets and then exit an area within an alloted time...

now when he leave the area and has killed the targets i want a Hint C to come up showing how long it took him to clear the area.

it should look like this:

You have completed the Killing House in ### seconds. The required time was 120s

so it comes up with how many seconds it took - now if the player takes too long, then he has to retry - if he gets it within the time then he wins

i dont know how to make a trigger time how long it takes, and how to make a condition out of it...

please help :help:

cheers :thumbsup:

Proud Member of the Volunteer Commando Battalion

seanver

  • Guest
Re:timer
« Reply #1 on: 22 Oct 2002, 10:23:29 »
Hmmm let me see. About how long it takes, create a script like this:

Code: [Select]
go=false
time = 120.00
time2 = time

#loop

time2 = time2 - 0.01

~0.01

? (win) : goto "continue"

goto "loop"

#continue

timef = 120 - time2
timef2 = 120 - timef

hint format ["It took %1 seconds", timef2]
exit


This about how long it takes. Idon't think you can use a trigger to do that.

Ook, abut the time out create a trigger. Countdown 120 in mid, max, min.

Now condition: this

ON Activation: out = true

So now if the countdown reaches 0 the condition out will be true. Create an init.sqs file and put: out = false; win = false.

Edit: Little big mistake

Now create another trigger. Condition: out AND !(Win) so the trigger will activate when the countdown is 0 and you have not won (win = false). So now when you want the player to win (get out of an area and kill the targets)  set win as true.

Hope this helps.
« Last Edit: 22 Oct 2002, 10:41:18 by SeAnVeR »

seanver

  • Guest
Re:timer
« Reply #2 on: 22 Oct 2002, 16:09:57 »
It's me again :P. Today in Latin class I was doing nothing so I thought a little more about the script, and here is a better script:

Code: [Select]
time = 0
win = false

#loop

time = time + 0.1

~0.1

? (win) : goto "continue"

goto "loop"

#continue

hint ["It took %1",time]

exit

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:timer
« Reply #3 on: 22 Oct 2002, 17:27:01 »
@ savaner - u have a big mistake over dere  :P

u cant use _time nd time as changin veriables - both of em r used by OFP 2 indicate movin of time so wat he can do is
 
Code: [Select]
win = false

@win

hint ["It took %1",_time]

exit

dats it

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

seanver

  • Guest
Re:timer
« Reply #4 on: 22 Oct 2002, 17:47:29 »
I tested the first one and worked perfectly. I haven't tested the second but they are very similar.

Pope_Zog

  • Guest
Re:timer
« Reply #5 on: 22 Oct 2002, 18:01:46 »
A method that doesn't need a script would be creating the area trigger (the one the player enters to start the clock and exits to stop the clock) like this:

Size: Covering the area
Activated by: Whatever side the player is
Condition: this and not task_done
On Activation: time_start = time
On Deactivation: time_end = time - start_time; hint format["You have completed the Killing House in %1 seconds. The required time was 120s", time_end]

In your init.sqs or init trigger declare the variable task_done and set it to false, i.e. task_done = false

Then have a second trigger with
Condition: time_end > 120 and task_done
On Activation: (Whatever to make the player repeat the task.)

Optionally have a third trigger with
Condition: time_end <= 120 and task_done
On Activation: (Whatever to make the player win.)

Pope Zog

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:timer
« Reply #6 on: 22 Oct 2002, 19:57:33 »
cool, thanx all of you. i'll try everything out and see what works best for my purpouses.

i'll be back.
Proud Member of the Volunteer Commando Battalion