• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ Assigning a lua code to a monster

lexus21

Active Member
Joined
Dec 14, 2022
Messages
88
Reaction score
25
Hi

how to use the .lua code to be assigned to monsters.
I try this way:
in xml, e.g. rat

Lua:
<scripts>
         <event name="RatThink"/>
 </scripts>

in data\scripts\creaturescripts I added
rathink.lua

Code:
local creatureevent = CreatureEvent("RatThink")


function creatureevent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)




creature:say("TEST", TALKTYPE_MONSTER_SAY)


return true
end

creatureevent:register()

but this is don't work
 
Hi

how to use the .lua code to be assigned to monsters.
I try this way:
in xml, e.g. rat

Lua:
<scripts>
    <event name="RatThink"/>
</scripts>

in data\scripts\creaturescripts I added
rathink.lua

Code:
local creatureevent = CreatureEvent("RatThink")


function creatureevent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)




creature:say("TEST", TALKTYPE_MONSTER_SAY)


return true
end

creatureevent:register()

but this is don't work
scripts

change
XML:
<scripts>
    <event name="RatThink"/>
</scripts>
to
XML:
<script>
    <event name="RatThink" />
</script>
 
Back
Top