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

Lua setmonster immunities in game

Engradiel

Member
Joined
May 3, 2009
Messages
121
Reaction score
7
Location
Brazil
Hello friends, I wanted to know if it is possible to change the invisible immunity or walk on fields with the creature already in the game (not in the monsters folder).

Example:
monster:setImmunity(invisible, 1)
monster:setImmunity(walkonfire, 1)


Similar to these:
monster:setMaxHealth()
monster:changeSpeed()
 
I could only find it available on a global level using MonsterType.
So you could set all rats to be immune to walking on fire, not just a single one.

I haven't used it before.. so I don't know if that changes all rats currently spawned, or only rats spawned after the change.
 
Yes its possible, easiest and correct way its from edit source,

You will need:
* add a boolean to monster.h like
C++:
canWalkOnFire = false;

* write a function that this boolean will be toggled to true / false
C++:
void setWalkOnFire(bool value)
}
    canWalkOnFire = value;
}



in function where is a check that creature can walk on fire you have to change reading from MonsterType to directly monster aka Monster* with check like
Code:
if (monster->canWalkOnFire)

also if you wanna use this function in lua, u have to register it to luascript.cpp
 
Back
Top