Extreme
Grandmaster Poster
Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20
SphereCommunity
|
|
08-02-2012 02:35 AM |
|
|
Rayvolution
Journeyman
Posts: 135
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 1
Aetharia
|
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!
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?
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 |
|
|
Rayvolution
Journeyman
Posts: 135
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 1
Aetharia
|
RE: Why do NPCs attacking eachother (Seemingly randomly) run away from each other?
(08-02-2012 08:09 AM)darksun84 Wrote: == not =
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
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 |
|
|
Rayvolution
Journeyman
Posts: 135
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 1
Aetharia
|
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? :/
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 |
|
|
Extreme
Grandmaster Poster
Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20
SphereCommunity
|
|
08-02-2012 03:37 PM |
|
|