Aller au contenu

fTimer fWait cannot get them to work ?


3 réponses à ce sujet

#1
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
I have a FOR loop I want to run every second. How is this done. I have used fWait fTimer ect.. It seems the game language has no sleep function or pause nor delay. How do I get my code to repeat on a timed/delayed basis?
Basically I want a timer above the players head to count down for a quest I am doing How/Is this possible ?

#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
There's no way to pause execution of code. A script will run essentially instantaneously. Commands, such as CommandWait are actions taken by creatures, not the script itself.



The only way to delay anything in the scripting language is the DelayEvent() function. You delay an event passed to an object, and in the script for that object you check for the event type then put whatever code you want, possibly another delayed event to the same object.



Keep in mind that the timing on this is not exact, as execution of the delayed event is an ai update, and therefore will happen whenever the game gets around to it. If there are a lot of things happening, such as a big combat, the event may be delayed longer than the time you enter..

#3
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
That explains a lot. I figured as much when exploring the scripts but thought I was missing something. Thank you for preventing more of what I have coined TS Psycosis.

Many many thanks. Have to do something else instead like a score for monsters killed!

#4
FalloutBoy

FalloutBoy
  • Members
  • 580 messages
http://social.biowar...m/project/1261/

This is an area script template that has a 6 second heartbeat event added to it. If you need a 1 second heartbeat for a counter you could modify this to do it. That is a lot of events though. I can't guarantee it will work perfectly.

Modifié par FalloutBoy, 18 décembre 2009 - 07:11 .