• 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 non-hostile Monster to hostile monster

whitevo

Feeling good, thats what I do.
Joined
Jan 2, 2015
Messages
3,452
Solutions
1
Reaction score
626
Location
Estonia
tfs 1.0
I want to have creatures what are not hostile at start, but when attacked then they turn hostile.

Then also would like to have creatures who are non-hostile, but if player has certain StorageValue, they are hostile vs him.

i don't get it how can i alter monster.xml with scripts
 
Last edited:
First of all, you should list what server version you are using.

I added all of the above functionality into my server.

The first thing is easy (change non-hostile monster to hostile monster)
There are 2 ways to do this.
  1. You can remove the creature, then add a new creature that looks exactly the same, edit the new creature's health to match the current creature, and doMonsterSetTarget(cid, target) to the player that attacked the first creature. (This is the Lazy way)
  2. You can edit the source (some already have edits for this I think) so that the storage value "hostile" is linked to this.
If you have your source, you can check if it has this in monster.cpp
Code:
bool Monster::isHostile() const
{
std::string value;
if(!getStorage("hostile", value))
return mType->isHostile;

return booleanString(value);
}
Or add it yourself.

That will allow you to set the storage value of "hostile" to 1, which would mean it is hostile, and if -1, it means it is not hostile.

Now... for creatures only being hostile towards certain players, there is a really bad way of doing this. (Which I used for my original species server)

First, you make a onCombat script, that says something like:
Code:
if getPlayerStorageValue(target, "enemy") == 1 then
  return true
else
  if target == getCreatureTarget(cid) then
    doMonsterChangeTarget(cid)
  end
  return false
end
and link that creaturescript to the monster you want to only be hostile to certain players (it will still follow around players, kind of like a dog, but it will only damage players and switch targets quickly when following a non-hostile player)

There is another way to do it, which is edit the source and make groups of allies, and enemies, and ignored monsters etc. (Which I have in my The Imagined Server) but that takes time, and isn't yet complete so I don't want to release a tutorial for it yet.
 
ok, seems still complicated to make creature from non-hostile to hostile.

But also when i turn some monster hosile = 0 then and give him huge targetdistance="25" and push his speed up like to 1500 or whatever. he still moves weirdly. he moves from tile to tile VERY FAST, but he waits like second before he takes other step..

i'm using rabbit as an example and i want to make him hardly catchable, but doesnt matter what speed i give them.. they simply too slow and i easily catch up with my 220speed
 
still a problem with monster speed..
Theire speed is only accurate when they are not affected by run on health or targetdistance.
But if i take these option away then they are not running away wither :|
 
Back
Top