• 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!

Solved How to make boss monsters?

Status
Not open for further replies.

Digital

Learning C++
Joined
Jul 15, 2018
Messages
57
Solutions
1
Reaction score
12
Does anyone know how to make intelligent boss monsters? Can you attach scripts to monsters and how do you do it? I mean is there a simple template to follow?
 
Solution
Yes, you can. Just use the script attribute in the monster xml tag.
The script can handle:

onThink(self, interval) -- Maybe this is the most important for give a behavior to the boss
onCreatureAppear(self, creature) -- Maybe you can give bonus to make the boss more strong based on how much players coming to his area
onCreatureDisappear(self, creature) -- Or remove theses bonus if only a small party is attacking him
onCreatureMove(self, creature, oldPosition, newPosition) -- Ops, a player coming near the eggs of boss dragon? Set the target, throw the fire, kill him
onCreatureSay(self, creature, type, message) -- Well, the boss was not aggressive. But the player call him by a bad name, then he get angry and start to attack everyone, oh...
Yes, you can. Just use the script attribute in the monster xml tag.
The script can handle:

onThink(self, interval) -- Maybe this is the most important for give a behavior to the boss
onCreatureAppear(self, creature) -- Maybe you can give bonus to make the boss more strong based on how much players coming to his area
onCreatureDisappear(self, creature) -- Or remove theses bonus if only a small party is attacking him
onCreatureMove(self, creature, oldPosition, newPosition) -- Ops, a player coming near the eggs of boss dragon? Set the target, throw the fire, kill him
onCreatureSay(self, creature, type, message) -- Well, the boss was not aggressive. But the player call him by a bad name, then he get angry and start to attack everyone, oh my gosh

You can also use all of creature events as onDeath, onKill, onPrepareDeath, onHealthChange, to make your boss unique, with invulnerability, random loot, get more strong as much as he kill players and etc...

Example:
<monster name="Dragon Boss" ... attributes ... script="dragon_boss.lua">
and put the dragon_boss.lua script on data/monsters/scripts/dragon_boss.lua with something like

Lua:
function onThink(self, interval)
    print("I like FIRE! I'm a DRAGON! FEAR ME!")
end

The rest is with you. Just try to be creative, good luck
 
Solution
Status
Not open for further replies.
Back
Top