![]() |
[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) {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... |
nice thx
|
Re: [AI TUT] aggro mobs: changing aggro logic
Quote:
Code:
EventHandler SEE_CREATURE(creature, myself) { Code:
EventHandler SEE_CREATURE(creature, myself) { Code:
EventHandler SEE_CREATURE(creature, myself) { |
example 4. coward mob (run from high level players) =)
Code:
EventHandler SEE_CREATURE(creature, myself) { |
nice tutorial HD thx
|
Re: [AI TUT] aggro mobs: changing aggro logic
Quote:
|
Re: [AI TUT] aggro mobs: changing aggro logic
Quote:
guard handler is just: Code:
EventHandler SEE_CREATURE(creature) {2. called each time when new player appears nearby 3. called ? after EnableMakingSeeEvent() (not tested, if its true - add this using AddTimerEx(), handlers CREATED, TIMER_FIRED using e.g. 30 seconds) you can also try to use handler from class guard_move_around Code:
EventHandler NO_DESIRE() {or try put there EnableMakingSeeEvent(); instead of around desire... anyway... more expeiments = better results |
Thanks, we'll try this (moving around maybe) and also if there is any fox for veil when you're PK.
|
Great tutorial. Respect HD ;)
|
Re: [AI TUT] aggro mobs: changing aggro logic
Quote:
|
he didnt say its possible...
he ASKED IF its possible... ;) |
what about time ?
som like spawn mob only on monday? or mog say somthing every hour (for example "2:00 PM ! please take a rest for eat !"). and other thing: mob teleport/kill/giveitem only 2/3/5 playres choisen by som criteria. (now i use stupid system when mog when choise player by see_creature(own item) taking damage and when choic another just die and cant choice more >< ) thx forward. |
Quote:
at least the 2nd thingy when used together with the Say function... (NASC) |
Various time thingies from nasc
EventHandler TIME() {} Castle_GetRawSystemTime(); EnableTimeEvent(i0); SayInt(time); All of which would allow you to manage timed events. |
Another good job HD, you are sexy <3
|
also... u can use somthing like below to see when handler works
Code:
EventHandler SEE_CREATURE(creature) { |
Mmm, this is like the printfs for a first debugging, great idea, I'll consider it when I have time to "play" with AI.
Thank you very much master ;) |
Re: [AI TUT] aggro mobs: changing aggro logic
Quote:
200 it's a desire! :roll: But you have a nice idea! :wink: |
Re: [AI TUT] aggro mobs: changing aggro logic
Quote:
Code:
EventHandler SEE_CREATURE(creature) { |
btw
on oficial servers some mobs use only magic. no physical attack. ive make som changes in warrior_casting_ddmagic and create new class here is example Code:
EventHandler ATTACKED(attacker, damage)but skills have reload time and when skill is reloading mob hit by physical attack. ive createt special class and replace all warrior_casting_ddmagic with that. and aggro to. looks nice. |
if it works it sounds like an awsome idea
|
NASC seems to be haunted with some kind of evil force that opposes me when I try to do smth with ai :))
I can't understand why when I first compile a txt file with a script, NASC says that there are errors, but when I add a space somewhere in script, compile it, than remove that space - and NASC says "Success!!!". Moving a "{" symbol to the next line could "fix" a bunch of errors... What the ?.. Is there some kind of "random error generator" built-in in NASC?)) |
handler 5 have problem
because handler 5 is l2NPC offer one touch off event NPC must update npcinfo all the time you can made a test you fist summon a guard_npc then //setkarma npc must update npcinfo ,so,npc attack you |
| All times are GMT. The time now is 22:50. |