SphereCommunity
NPC AI - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Submissions (/Forum-Script-Submissions)
+--- Thread: NPC AI (/Thread-NPC-AI)

Pages: 1 2


NPC AI - Skul - 09-20-2012 05:08 PM

Uploaded on SShare here, this NPC AI script will give your NPCs specific AI features, all of which can be altered and defined by defname. Installation of this script is included in the comment at the top of this script.

Link: http://forum.spherecommunity.net/sshare.php?download=211


RE: NPC AI - Extreme - 09-20-2012 11:51 PM

Got lots of errors Skul.
The <serv.chardef.<argv[0]>.defname> is giving error because some chardefs don't have defname.
I changed to "baseid" and the error disappear.


RE: NPC AI - Skul - 09-21-2012 01:42 AM

Good to know Extreme, I also fixed that in the script. Also, it's unfinished right now, about half done I'd say. I will be adding more later. Right now I know the 'tossing stone' AI will be mucked up since the default behaviour in sphere has to be halted in sphere_item_boulders_rocks.scp, which isn't mentioned in the .scp I uploaded. Also, it needs to be thoroughly tested before I add in anymore features. For the most part, it works properly.


RE: NPC AI - Extreme - 09-21-2012 01:44 AM

I set the events on eventspet and eventsplayer and type .enable_npcai
Got lot of errors telling that the events e_npcai is already set on sphere.ini

Need type .enable_npcai or just set the events on sphere.ini ?


RE: NPC AI - Skul - 09-21-2012 01:50 AM

Alright, I upadted the script, visit the link and recopy it, run the command again, it is necessary in order to start the AI script. It shouldn't error anymore either.

One more update, added effectto and effectcmp, both functions were missing since I had already had those functions in a seperate .scp file, now both functions are included within the NPC AI script.


RE: NPC AI - Extreme - 09-21-2012 02:15 AM

Alright, using .enable_npcai, the line 82 give error "ncp_ai" doesn't exists. Its "npcai".
Please Skul, try it in a fresh installation, the .enable_npcai isn't working properly.

Line 171 > (body>==c_cyclops)
Fix (<body>==c_cyclops)
Line 172 (<def0.npcai_can_throw_rock)
Fix (<def0.npcai_can_throw_rock>)


RE: NPC AI - Skul - 09-21-2012 04:44 AM

Alright, I ran some tests myself, all the errors I could find are patched. Try it out if you're still interested, let me know how it works on your end.

You might want to add this trigger to your boulders and rocks itemdefs in sphere_item_boulders_rocks.scp if you want to only use the NPC AI 'throw rock' feature:
Code:
on=@create
if (<src.ischar>)
  if (<src.npc>)
    remove
  endif
endif
That code will prevent NPCs from creating a rock or boulder via sphere's default behaviour.

If anyone has any comments, suggestions, feedback, questions, anything really, just post it here and I'll see what I can do.


RE: NPC AI - Skul - 09-24-2012 02:58 AM

New version uploaded today:

-Fixed invalid point -1,-1 on map errors.
-Fixed script trying to add e_npcai when eventspet=e_npcai is defined
-Added custom NPC throw rocks (Thx Ben for the info as to how to do this!)
-Added custom NPC breath fire (Thx Ben for the info as to how to do this!)
-Other misc errors fixed since the last update.


RE: NPC AI - Skul - 09-24-2012 05:41 AM

OK, so what you do is spawn 10-15 c_h_barbarian_warrior near a tree, maxdist 1, and watch the action Wink


RE: NPC AI - Skul - 10-01-2012 02:53 PM

New version uploaded. I added in a new feature, npcai_can_eatfood_changecolor for iron beetles and other creature that you want to specify specific foodtypes for.

The new defnames are:

npcai_can_eatfood_changecolor = 1/0 (on/off)
npcai_id_eatfood_changecolor = id & type defnames of foodtypes that are listed in the creatures <foodtypes>