Trollheim
Well-Known Member
Hello!
Today I am presenting you really easy fun script for changing colors of monsters. Monsters like bandit or dwarf miner can have random (or almost random) colors of outfit.
In head section you have table of colors for hair (not to have green or pink hair, just normal hair colors)
Instalation:
1. create file named ChangeCreatureColors.lua and place it inside data>monster>scripts directory
2. Put this code inside
3. Edit monster you would like to use script on and add
to it's main node
It should look like this
4. Enjoy
There is also known bug. Monsters placed on map during loading server won't execute onCreatureApper event so they will have regular outfit colors. If you approach creature on same level, it color will not change, but if you relog or change floor near creature it outfit changes.
Today I am presenting you really easy fun script for changing colors of monsters. Monsters like bandit or dwarf miner can have random (or almost random) colors of outfit.
In head section you have table of colors for hair (not to have green or pink hair, just normal hair colors)
Instalation:
1. create file named ChangeCreatureColors.lua and place it inside data>monster>scripts directory
2. Put this code inside
Lua:
local colors = {
head = { 0, 1, 2, 3, 19, 20, 21, 22, 38, 39, 40, 41, 57, 58, 59, 60, 76, 77, 78, 79, 95, 96, 97, 98, 114, 115, 116, 117}
}
function onCreatureAppear(self, creature)
local outfit = self:getOutfit()
local monsterT = MonsterType(self:getName())
if not monsterT then
return
end
local monsterOutfit = monsterT:getOutfit()
if outfit.lookHead == monsterOutfit.lookHead and outfit.lookBody == monsterOutfit.lookBody and outfit.lookLegs == monsterOutfit.lookLegs and outfit.lookFeet == monsterOutfit.lookFeet then
self:setOutfit({lookType = outfit.lookType, lookHead = colors.head[math.random(1, #colors.head)], lookBody = math.random(1, 132), lookLegs = math.random(1, 132), lookFeet = math.random(1, 132)})
end
end
XML:
script="ChangeCreatureColors.lua"
It should look like this
XML:
<monster name="Bandit" nameDescription="a bandit" race="blood" experience="65" speed="180" manacost="450" script="ChangeCreatureColors.lua">
There is also known bug. Monsters placed on map during loading server won't execute onCreatureApper event so they will have regular outfit colors. If you approach creature on same level, it color will not change, but if you relog or change floor near creature it outfit changes.