Using custom timers

Go down

Using custom timers Empty Using custom timers

Post by TheTurkishMoose on Sat 21 Nov 2015, 15:59

Hello, I'm new to the mission editor and have gone through all the help documents
I'm still struggling with the timers though

I've created my own timer which sets of once the player is spotted by enemies (it's a stealth mission). It lasts for 600000 (which should be 10 minutes right?)

After ten minutes, the mission is failed but I don't know how to write the function.
The timer is called "USAlerted"

Could someone tell me how I should write it so that when the USAlerted timer reaches 10 minutes, the mission fails

Thank you!

TheTurkishMoose

Location : England
Points : 6
Reputation : 1
Join date : 2015-11-19
Age : 23

Back to top Go down

Using custom timers Empty Re: Using custom timers

Post by runerback on Mon 23 Nov 2015, 08:33

Do you mean after player is spotted by enemies 10 minutes later the mission failed? If it is, write some code like this:

Code:

function onIdentified( identifiedID, identifierID)
    --judge if player is spootted, if true
    OFP: addTimer( "USAlerted", 600000)
end

function onTimer_USAlerted()
    --the timer triggered
    OFP:missionFailed()
end

BTW, if you are using EDX, there are some better way to write codes.

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

Using custom timers Empty Re: Using custom timers

Post by TheTurkishMoose on Mon 23 Nov 2015, 09:54

Thanks for the help runerback, that was exactly what I was looking for - the "function onTimer_USAlerted()" part particularly!




I'm not sure what EDX means, sorry. I'm using the default mission editor editing the leve.lua file. Could you explain what you mean please?

TheTurkishMoose

Location : England
Points : 6
Reputation : 1
Join date : 2015-11-19
Age : 23

Back to top Go down

Using custom timers Empty Re: Using custom timers

Post by runerback on Tue 24 Nov 2015, 01:38

You can check it here:
Mission Editor Expansion

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

Using custom timers Empty Re: Using custom timers

Post by TheTurkishMoose on Tue 24 Nov 2015, 12:36

Thaks runerback, completely missed this!

TheTurkishMoose

Location : England
Points : 6
Reputation : 1
Join date : 2015-11-19
Age : 23

Back to top Go down

Using custom timers Empty Re: Using custom timers

Post by TheTurkishMoose on Thu 26 Nov 2015, 22:55

Okay so I had a look through all the EDX stuff and decided to just stick with the main editor. I know it talks about making mission making easier and more efficient, but I'm happier doing it the old fashioned way!

TheTurkishMoose

Location : England
Points : 6
Reputation : 1
Join date : 2015-11-19
Age : 23

Back to top Go down

Using custom timers Empty Re: Using custom timers

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum