Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
Author Message
Rayvolution
Journeyman
*

Posts: 135
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 1

Aetharia

Post: #17
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
(08-02-2012 08:09 AM)darksun84 Wrote:  == not = Blush

hah, whoops. Good catch.

I'm writing my own AI script now anyway, so it doesn't even matter anymore. Since I'm rewriting all my Mobs 1 by 1 as I add them to the world, I'm also giving them all special events and what not for AI flags.

So now;
Code:
[EVENTS e_AI_Guard]
ON=@NPCLookAtChar
    IF (<SRC.TEVENTS> == e_AI_Hostile)
ATTACK
ENDIF

But, now all my mobs in the entire game will have event flags setup for the AI, allowing certain types to fight each other. For example, e_AI_Carnivore will attack e_AI_Small_Animals, and e_AI_Hostile will always attack any e_AI_Friendly, etc.

It's also setup so each base event can have abilities.. so it'll be a very simple and easy to expand AI system, pretty much based on Anarch's ideas it's just my spin on it. I'm just not using any tags at all. I just have NPCs/Mobs attack/defend/react to each other based on what events they have. Any advanced AI can be written into the event itself for each event type.

Basic idea os what I have now (Hardly done at all, I'm just setting up)

Code:
[EVENTS e_AI_Guard]
ON=@NPCLookAtChar
    IF (<SRC.TEVENTS> == e_AI_Hostile)
ATTACK
ENDIF

[EVENTS e_AI_Vendor]

[EVENTS e_AI_Undead] //Incomplete
ON=@Hit
   IF (<SRC.ACT.RESTEST i_mem_undead_acid>)
      SRC.ACT.CONSUME 100 i_mem_undead_acid
   ENDIF
   IF (<SRC.ACT.RESTEST i_mem_undead_acid_2>)
      SRC.ACT.CONSUME 100 i_mem_undead_acid_2
   ENDIF
   SRC.ACT.DAMAGE 5
   SRC.ACT.SYSMESSAGENEG <NAME> burns you with acid!
   SRC.ACT.EMOTE burned with acid!
   SRC.ACT.UPDATE
   SOUND 517
   ACT.EFFECT 3,i_fx_curse,1,17,0
   SERV.NEWITEM i_mem_undead_acid
   SRC.ACT.EQUIP <NEW>
   NEW.TIMER=3
   NEW.LINK=<SRC.UID>
   SERV.NEWITEM i_mem_undead_acid_2
   SRC.ACT.EQUIP <NEW>
   NEW.TIMER=60
   NEW.LINK=<SRC.UID>

[ITEMDEF i_mem_undead_acid]
ID=i_memory
NAME=Acid
TYPE=t_eq_script
on=@EQUIP
   timer=1    
   return 0  
on=@timer
if <LINK.flags>&statf_dead
   LINK.SYSMESSAGE The acid has killed you!
   LINK.CONSUME 100 i_mem_undead_acid_2
   LINK.CONSUME 100 i_mem_undead_acid
   LINK.UPDATE
   return 1
endif
   LINK.DAMAGE 1
   TIMER=2
   return 1

[ITEMDEF i_mem_undead_acid_2]
ID=i_memory
NAME=Acid 2
TYPE=t_eq_script
on=@timer
   LINK.CONSUME 100 i_mem_undead_acid_2
   LINK.CONSUME 100 i_mem_undead_acid
   LINK.UPDATE
   REMOVE
   RETURN 1


[EVENTS e_AI_Friendly] //Friendly NPCs

[EVENTS e_AI_Neutral] //Animals

[EVENTS e_AI_Hostile] //Attacks anything that has "friendly" events, like vendors, guards, healers, most city NPCs.
ON=@NPCLookAtChar
    IF (<SRC.TEVENTS> == e_AI_Friendly)
ATTACK
ENDIF

[Image: 4_Logo.png]
An MMORPG based on the Ultima Online engine.
Completely Custom Map, GUI, AI, Combat, Skills, Crafts, Art, Music and so much more.
http://aetharia.com - Home of Ambition!
08-02-2012 10:37 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other? - Rayvolution - 08-02-2012 10:37 AM

Forum Jump:


User(s) browsing this thread: 4 Guest(s)