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

Decrese IQ of monsters

Lyky

Well-Known Member
Joined
May 27, 2014
Messages
291
Solutions
8
Reaction score
89
Hi,
So my players have been sending complains for dragons on my server having over 200 IQ; Its running on [TFS 1.2];

I was wondering if its possible - through lua - make monsters having a chance turn towards player 20% per 2sec turn.

As it stands now, all of my monsters automatically from a get-go turn to player position, and when running away they move in a way so that player is going to be hit by a wave attack, and dodge their attacks.

XML:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="dragon" nameDescription="a dragon" race="blood" experience="700" speed="150" manacost="0">
   <health now="1000" max="1000"/>
   <look type="34" corpse="3104"/>
   <targetchange interval="1000" chance="5"/>
   <targetstrategies nearest="70" health="10" damage="10" random="10"/>
   <flags>
       <flag attackable="1"/>
       <flag hostile="1"/>
       <flag summonable="0"/>
       <flag convinceable="0"/>
       <flag illusionable="1"/>
       <flag pushable="0"/>
       <flag canpushitems="1"/>
       <flag canpushcreatures="1"/>
       <flag targetdistance="1"/>
       <flag staticattack="80"/>
       <flag runonhealth="300"/>
   </flags>
   <attacks>
       <attack name="melee" skill="55" attack="42"/>
       <attack name="fire" chance="15" range="7" radius="4" target="1" min="-55" max="-105">
           <attribute key="shootEffect" value="fire"/>
           <attribute key="areaEffect" value="firearea"/>
       </attack>
       <attack name="fire" chance="12" length="8" spread="3" min="-100" max="-160">
           <attribute key="areaEffect" value="firearea"/>
       </attack>
   </attacks>
   <defenses armor="25" defense="38">
       <defense name="healing" chance="13" min="34" max="56">
           <attribute key="areaEffect" value="blueshimmer"/>
       </defense>
   </defenses>
   <elements>
       <element firePercent="100"/>
       <element earthPercent="100"/>
   </elements>
   <immunities>
       <immunity paralyze="1"/>
       <immunity invisible="1"/>
   </immunities>
   <voices interval="1000" chance="5">
       <voice sentence="GROOAAARRR" yell="1"/>
       <voice sentence="FCHHHHH" yell="1"/>
   </voices>
   <loot>
       <item id="2672" chance="45000" countmax="3"/><!-- 3 45% dragon ham -->
       <item id="2148" chance="80000" countmax="45"/><!-- 45 80% gold coin -->
       <item id="2148" chance="50000" countmax="60"/><!-- 60 50% gold coin -->
       <item id="2145" chance="400"/><!-- 0.4% small diamond -->
       <item id="2546" chance="16000" countmax="10"/><!-- 10 16% burst arrow -->
       <item id="2177" chance="100"/><!-- 0.1% life crystal -->
       <item id="2457" chance="3000"/><!-- 3% steel helmet -->
       <item id="2647" chance="2000"/><!-- 2% plate legs -->
       <item id="5877" chance="1005"/><!-- green dragon leather -->
       <item id="5920" chance="1000"/><!-- green dragon scale -->
   
       <item id="1987" chance="100000"><!-- bag -->
       
               <item id="2455" chance="10000"/><!-- 10% crossbow -->
               <item id="2397" chance="4000"/><!-- 4% longsword -->
               <item id="2413" chance="2000"/><!-- 2% broadsword -->
               <item id="2387" chance="1000"/><!-- 1% double axe -->
               <item id="2434" chance="500"/><!-- 0.5% dragon hammer -->
               <item id="2409" chance="500"/><!-- 0.5% serpent sword -->
               <item id="2406" chance="25000"/><!-- 25% short sword -->
               <item id="2398" chance="20000"/><!-- 20% mace -->
               <item id="2187" chance="1000"/><!-- 1% wand of inferno -->
               <item id="2509" chance="15000"/><!-- 15% steel shield -->
               <item id="2516" chance="300"/><!-- 0.3% dragon shield -->
               <item id="7430" chance="10"/><!-- dragonbone staff -->
       
       </item>
   </loot>
</monster>


The issue has been described here:

Monster AI Revamp [$100] · Issue #922 · otland/forgottenserver · GitHub [2014 couple years back]
Turning/Facing - if a creature changes directions while while moving there is no delay before or after the turn, they turn and take their next step in a fluid motion. During dancestep if the creature turns away from the target when it moves, it will adjust the direction to face the target again during it's next attack interval (turn and attack in fluid motion)

later stated it has been implemented; thus how to control that turning/facing direction switch chance?


@edit
After thinking a little bit about it; it should be scriptable in creaturescripts; but i have no idea how to start - can anyone point me to example that modifies how certain creatures behave.
 
Last edited:
Could you give small example how the script should be structured, to affect creature and how to call Turn direction behavior of it?
Sorry no, that requires too much time to exaplain.
And its not like I can copy paste my monsterAI what would make sense for you, its 500+ lines long.
 
Could you give small example how the script should be structured, to affect creature and how to call Turn direction behavior of it?





btw. here's another example of how dragons didn't turn look to player direction right away.
1min 30 mark


it may be affected by spell cast / melee attack. I'll test it out on the server by reducing melee attack speed.

TESTED - Its not affected by spell cast or attack. It does it in immediate mode turn to player direction after each move.
Twitch
I am lost lol, i have no idea what you are trying to accomplish.
 
Why not provide a simple example then?
Sorry no, that requires too much time to explain.
Simplifying a small feature in complex sequence requires quite some time to explain because rewriting monster behavior will mess up a lot of other things which you need to take into consideration.
 
Melee monsters on real (at least in 7.7) change direction towards its target no matter what right before or after the monster is about to melee (every 2 seconds), and this mechanic is what OP seems to want to implement in his OT (OT monsters by default change their direction immediately after every move).
OT monsters are in general much more robotic in their behavior, they behave more like magnetic robots than creatures.
 
Hi,

Additional questions,


creature.h [line: 80-82]
Code:
#define EVENT_CREATURECOUNT 10
#define EVENT_CREATURE_THINK_INTERVAL 1000
#define EVENT_CHECK_CREATURE_INTERVAL (EVENT_CREATURE_THINK_INTERVAL / EVENT_CREATURECOUNT)

Could someone explain what is FrozenPathingConditionCall - purpose?
Code:
class FrozenPathingConditionCall
{
   public:
       explicit FrozenPathingConditionCall(Position targetPos) : targetPos(targetPos) {}

       bool operator()(const Position& startPos, const Position& testPos,
                       const FindPathParams& fpp, int32_t& bestMatchDist) const;

       bool isInRange(const Position& startPos, const Position& testPos,
                      const FindPathParams& fpp) const;

   protected:
       Position targetPos;
};

also has anyone tested windows debugger on the code with visual studio? Does it work well when you put breaks in the code? Also if anyone could point me to code where creature (non-player) updates direction?



//i.e. creature.cpp Direction var is not defined.


sources
GitHub - ninjalulz/forgottenserver at 8.0
 
Last edited:
Since you doing source edits. Check into follow creature related functions.
Because if creature does not follow player it does not turn to them either.
However if monster doesn't have follow target and target list is updated, source gives the monster a target to follow. Hence the reason its so annoying to make monster behavior only in Lua
 
Back
Top