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: #1
Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
I'm working on my "realistic guards" script, and I'm having trouble getting the AI to act correctly, for some reason (and only with certain NPCs) they will attempt to attack each other, and retreat.

I thought it was something as simple as they detected the stats of the target and run, but that doesn't explain why I can code a guard with 1/1/1 stats to attack a Wyrm, and he does so.

I also noted that it seems to have to do with the type of NPC, for example, I can't get 2 skeletons to fight either.

[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-01-2012 09:58 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: #2
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
I believe the default brains have some specific behaviors. The relavant ones here seem to be guards are fearless and Undead won't fight.

One solution is to replace their default brains with a blank or simple one and code all attack behaviors. The fear is something that happens mostly with weak NPCs and I'm not sure what to do about it.

Current Projects: Necromancy SCP overhaul. Custom Faction AI/System. Imbuing.
08-01-2012 10:08 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: #3
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
Hmm, that might explain it.

Although there must be some other flags too, because I noticed for some reason, even brain_guard will "run away" from other human NPCs, even if you flag them red, criminal, and brain_monster

It's very strange :/

I can't use brain_guard for my script though anyway, because when "spawned" via spawngem, they vanish. They'll only stick around if I manually add them via Axis.

Even stranger: Brain_None on the guard won't change his behavior. He still "runs away" from all human characters.

Looking more into it, it seems that basically any NPC with the same Body won't attack each other.

It's so specific, that my male guards will attack female NPCs but not male ones (and vice versa).

I'm perplexed :/

[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-01-2012 11:51 AM by Rayvolution.)
08-01-2012 11:04 AM
Find all posts by this user Like Post Quote this message in a reply
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #4
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
long time ago, nazghull put some tags in the source code, so that npc will help or attack each other, if they have this tags.
but it was only a testing nightly build from him and I think it was never implented.
Maybe this thinks will be very helpfull for this script if it will implented ...
and maybe it can be coded a little bit more for example
there will be an event that name is hardcoded like
e_brain_undead but you can softcode it in some way like
if (<hitpoints> < 10)
RETURN 1 --> it will stop the hardcoded running away modus (something like that, donĀ“t know the code for it)
08-01-2012 08:13 PM
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: #5
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
In @NpcActFight there is this argument

ARGN2

IO

The NPC's motivation level to fight.
Note: NPCs, excluding pets, with a motivation less than zero will flee from their target.

Maybe it can be useful Shock
08-01-2012 09:24 PM
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: #6
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
(08-01-2012 09:24 PM)darksun84 Wrote:  In @NpcActFight there is this argument

ARGN2

IO

The NPC's motivation level to fight.
Note: NPCs, excluding pets, with a motivation less than zero will flee from their target.

Maybe it can be useful Shock

Nope, didn't work. Sad

It's very strange indeed, I can even spawn a generic bad guy NPC (Example, a male bandit) and the guard will see the bandit, "attack" and just turn around and walk away from the target in combat mode.

*but* if I spawn a female bandit, he attacks correctly. I even went as far as summing male NPCs and doing .set body c_woman, and he will instantly stop walking away in combat mode, and attack.

After further tested, I realized this is with *all* characters in the game. For example, 2 skeletons wont fight each other when told, but a skeleton and a zombie will. Same with Dragons, Balrons, Elementals and every single other character I've tested.

[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-01-2012 11:08 PM by Rayvolution.)
08-01-2012 11:05 PM
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: #7
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
maybe you have something like this in main npc event:
Code:
ON=@ATTACK
IF <SRC.BASEID>==<BASEID>
RETURN 1
ENDIF
?
08-01-2012 11:47 PM
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: #8
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
What about this flag in the sphere.ini ?

// Monsters may fight each other
MonsterFight=0
08-02-2012 12:11 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: #9
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
I can dig through my events but thats strange is the NPCs dont just return 1 and resume normal operation. They stay in combat mode, and just steady wander away from their target.

- Trigger fires to fight target
- Goes into combat mode, triggers the NAME attacking TARGET emote
- (still in combat mode) starting slowly walking directly away from the target.
- When out of view completely (screen or so away) leaves combat mode, and wanders back to his spawn point like nothing happened.

Although if it's a different baseID, he'll see them, go in combat mode and run after/kill the target.

I've tried remving their brains, all their speech flags, triggers, events, everything and manually forced them to attack each other, and they still do it. I can't ven get 2 c_chickens to fight. It's really odd. :/

MonsterFight is set to 1, also.

[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 02:10 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: #10
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
can you show us the script Shock ?
08-02-2012 02:14 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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