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
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #11
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
I have the same problem, thats very strange.

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
08-02-2012 02:35 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #12
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
By commanding npc to kill each other via "chicken kill" mine chickens are still fighting, did you get the problem even in this way?
08-02-2012 02:59 AM
Find all posts by this user Like Post Quote this message in a reply
Anarch Cassius
Master
**

Posts: 273
Likes Given: 19
Likes Received: 10 in 9 posts
Joined: Mar 2012
Reputation: 2



Post: #13
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
Just a hunch... try giving them a different brain. A blank one from beyond the end of the list. It will have no behavoir built in. See if that still has these issues or if only defined brain types do.

Current Projects: Necromancy SCP overhaul. Custom Faction AI/System. Imbuing.
08-02-2012 03:53 AM
Find all posts by this user Like Post Quote this message in a reply
WRWR
Journeyman
*

Posts: 212
Likes Given: 30
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 1



Post: #14
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
Ahh, its hardcoded thing Smile just checking it on my sphere
08-02-2012 04:55 AM
Find all posts by this user Like Post Quote this message in a reply
Rayvolution
Journeyman
*

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

Aetharia

Post: #15
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
hmmm, it may be hardcoded then, if so anyone have any tips on a work around?

I don't have elves on my server at all, when I get home I'll try making all my guards "Elves" bodies and see if that fixes it. It won't correct the hardcoded issue, but at least it'll allow my guards to attack anything on my server as they should be.

Update:

Using c_elf_male/female works like a champ, they attack everything now! Since I have no plans on ever having elves on my server, I just simply have to cover their ears with the right hairstyles and no one is the wiser. I'm not keen on hacky workarounds, but hey, it's working! Tongue

Now I just need to code the guards correctly. Does anyone know if there's a way to detect if the target is hostile? Not necessarily in combat mode, but just red/aggressive?

Right now, this is my basic "attack" script:
Code:
ON=@NPCLookAtChar
    IF (<SRC.KARMA> < -2999) || (<SRC.BRAIN> = brain_monster) || (<SRC.BRAIN> = brain_undead) || <SRC.FLAGS>&statf_criminal)
ATTACK
ELSE
RETURN 0

I know it's missing a few flags/brains, I just set it up for testing purposes. But is there a more simple way to do it or do I have to specify every condition that makes a target red/aggressive?

[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!
(This post was last modified: 08-02-2012 06:18 AM by Rayvolution.)
08-02-2012 05:47 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #16
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
== not = Blush
08-02-2012 08:09 AM
Find all posts by this user Like Post Quote this message in a reply
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
Rayvolution
Journeyman
*

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

Aetharia

Post: #18
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
hmmm, it looks like im having another problem now. I didn't notice it before in testing because at the time, the IF statement didnt actually matter to run the script.

It looks like the EVENT cant detect when your target has an event applied to him.

This IF won't fire:
IF (<SRC.TEVENTS> == e_AI_Hostile)

I've wrote up every way I could think of to make the IF statement fire. I can get it to work with tags, but it would be much simplier if it could figure out it's target's TEVENTS.

Any ideas? :/

[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 03:31 PM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #19
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
IF STRMATCH(*e_AI_Hostile*,<SRC.EVENTS>)

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
08-02-2012 03:37 PM
Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #20
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
You can try ISTEVENT.

IF (<SRC.TEVENTS.ISTEVENT.e_AI_Hostile>)

It works in my system.
08-02-2012 04:05 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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