Difference between revisions of "LUA:SpawnScripts"

Line 1: Line 1:
== The LUA Scripting System: SpawnScripts ==
+
Spawn Scripts are used to bring a spawn to life, the most common use is to add dialog but it is possible to write your own custom AI completely overriding the default behavior provided in the server core.
Describe purpose, examples, our chosen folder structure for script storage.
+
 
 +
== Aggro ==
 +
Aggro is called when the spawn aggros a player due to faction
 +
 
 +
<pre>
 +
function aggro(Spawn, Spawn)
 +
end
 +
</pre>
 +
== Attacked ==
 +
Attacked is called when the spawn enters combat
 +
 
 +
<pre>
 +
function attacked(Spawn, Spawn)
 +
end
 +
</pre>
 +
== Auto Attack Tick ==
 +
Auto Attack Tick is called when the spawn makes an attack with the primary weapon
 +
 
 +
<pre>
 +
function auto_attack_tick(Spawn, Spawn)
 +
end
 +
</pre>
 +
== Casted On ==
 +
Casted On is called when a spell is casted on the spawn, the third parameter is the name of the spell/entity command
 +
 
 +
<pre>
 +
function casted_on(Spawn, Spawn, String)
 +
end
 +
</pre>
 +
== Combat Reset ==
 +
Combat Reset is called when the spawn leaves combat
 +
 
 +
<pre>
 +
function CombatReset(Spawn)
 +
end
 +
</pre>
 +
== Death ==
 +
Death is called when the spawn dies
 +
 
 +
<pre>
 +
function death(Spawn, Spawn)
 +
end
 +
</pre>
 +
== Hailed ==
 +
Hailed is called when a player hails the spawn
 +
 
 +
<pre>
 +
function hailed(Spawn, Spawn)
 +
end
 +
</pre>
 +
== Hailed Busy ==
 +
Hailed Busy is called when a player hails the spawn while it is in combat
 +
 
 +
<pre>
 +
function hailed_busy(Spawn, Spawn)
 +
end
 +
</pre>
 +
== Health Changed ==
 +
Health Changed is called whenever the spawns health changes in either direction
 +
 
 +
<pre>
 +
function healthchanged(Spawn, Spawn)
 +
end
 +
</pre>
 +
== Killed ==
 +
Killed is called whenever the spawn kills something
 +
 
 +
<pre>
 +
function killed(Spawn, Spawn)
 +
end
 +
</pre>
 +
== Random Chat ==
 +
Random Chat is never called and its purpose is lost, code for it still remains so it is listed here just for reference
 +
 
 +
<pre>
 +
function randomchat(Spawn, String)
 +
end
 +
</pre>
 +
== Respawn ==
 +
Respawn is called when the spawn respawns
 +
 
 +
<pre>
 +
function respawn(Spawn)
 +
end
 +
</pre>
 +
== Spawn ==
 +
Spawn is called when the spawn spawns for the first time
 +
 
 +
<pre>
 +
function spawn(Spawn)
 +
end
 +
</pre>
 +
== Targeted ==
 +
Targeted is called whenever a player targets the spawn
 +
 
 +
<pre>
 +
function targeted(Spawn, Spawn)
 +
end
 +
</pre>
 +
 
 +
== Think ==
 +
Think is used to override AI and is called every time the AI needs to run
 +
 
 +
<pre>
 +
function Think(Spawn, Spawn)
 +
end
 +
</pre>
 +
 
  
 
[[LUA|Back to LUA]]
 
[[LUA|Back to LUA]]

Revision as of 23:20, 27 December 2013

Spawn Scripts are used to bring a spawn to life, the most common use is to add dialog but it is possible to write your own custom AI completely overriding the default behavior provided in the server core.

Aggro

Aggro is called when the spawn aggros a player due to faction

function aggro(Spawn, Spawn)
end

Attacked

Attacked is called when the spawn enters combat

function attacked(Spawn, Spawn)
end

Auto Attack Tick

Auto Attack Tick is called when the spawn makes an attack with the primary weapon

function auto_attack_tick(Spawn, Spawn)
end

Casted On

Casted On is called when a spell is casted on the spawn, the third parameter is the name of the spell/entity command

function casted_on(Spawn, Spawn, String)
end

Combat Reset

Combat Reset is called when the spawn leaves combat

function CombatReset(Spawn)
end

Death

Death is called when the spawn dies

function death(Spawn, Spawn)
end

Hailed

Hailed is called when a player hails the spawn

function hailed(Spawn, Spawn)
end

Hailed Busy

Hailed Busy is called when a player hails the spawn while it is in combat

function hailed_busy(Spawn, Spawn)
end

Health Changed

Health Changed is called whenever the spawns health changes in either direction

function healthchanged(Spawn, Spawn)
end

Killed

Killed is called whenever the spawn kills something

function killed(Spawn, Spawn)
end

Random Chat

Random Chat is never called and its purpose is lost, code for it still remains so it is listed here just for reference

function randomchat(Spawn, String)
end

Respawn

Respawn is called when the spawn respawns

function respawn(Spawn)
end

Spawn

Spawn is called when the spawn spawns for the first time

function spawn(Spawn)
end

Targeted

Targeted is called whenever a player targets the spawn

function targeted(Spawn, Spawn)
end

Think

Think is used to override AI and is called every time the AI needs to run

function Think(Spawn, Spawn)
end


Back to LUA