Difference between revisions of "Event: Script:OnUpdate"

From Nomad DB
m (→‎WDL: Tiem -> Time + delta time clarification)
 
Line 3: Line 3:
 
{{WD2SH:ScriptEvent}}
 
{{WD2SH:ScriptEvent}}
  
== Usage ==
+
==Usage==
=== WDL ===
+
===WDL===
 
In Watch Dogs Legion, you can access the game & update time.
 
In Watch Dogs Legion, you can access the game & update time.
  
Line 10: Line 10:
 
function script:OnUpdate(time, dt)
 
function script:OnUpdate(time, dt)
 
-- time = Game Time
 
-- time = Game Time
-- dt = Delta Tiem
+
-- dt = Delta Time (time since previous frame)
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== MDE & WD2 ===  
+
===MDE & WD2===  
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
OnUpdate()
 
OnUpdate()
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== Related Pages ==
+
==Related Pages==
* [[WD2 ScriptHook: Events]]
+
 
 +
*[[WD2 ScriptHook: Events]]
  
 
[[Category:WD2 Script Events]]
 
[[Category:WD2 Script Events]]

Latest revision as of 23:05, 17 April 2021

This event is called every frame. Be careful performing heavy calculations here.

Registration

This event is registered on the Script Table.

Usage

WDL

In Watch Dogs Legion, you can access the game & update time.

function script:OnUpdate(time, dt)
	-- time = Game Time
	-- dt = Delta Time (time since previous frame)
end

MDE & WD2

OnUpdate()

Related Pages