View Single Post
Old 19.04.2006, 14:38   #1
humordwarf
Архивный участник
 
Join Date: Feb 2006
Posts: 453
Default [AI TUT] aggro mobs: changing aggro logic

first lets look on common code for aggro mobs:
class warrior_aggressive_patrol : warrior_patrol
inside SEE_CREATURE handler:
Code:
EventHandler SEE_CREATURE(creature, myself) {
    if ((GetLifeTime() > 7)  &&  InMyTerritory(myself.sm)) {
        AddAttackDesire(creature, 1, 200);
    }
}
// 3 functions called (1+2)
we see, mob will attack only if his lifetime>7 (to let player go away after mob respawn), he is in hometerritory (not too far from respawn point) and [s:da6fe7aa15]also attack desire will be adden only if distance_to_creature < 200[/s:da6fe7aa15]
sorry, 200 - is not distance.. its something like probability

easy, we can change 200 to 500 or to 50 to some mobs, just for diversify somehow mobs behaviour

or we can add something like "if Rand(100)<5" so mob will desire attack only 5%

and turn on your lively imagination =)
example 1: what if mob desire attack players with level>40 only?
example 2: what if mob desire attack only if player not have some quest item (OwnItemCount function) hmm.. (almost same as "silence" skill =))?
example 3: what if mob desire attack orcs only ?

etc... etc...
humordwarf is offline