Post Reply 
 
Thread Rating:
  • 4 Votes - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NPC AI
Author Message
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #1
NPC AI
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....wnload=211

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
(This post was last modified: 11-20-2012 04:52 PM by Skul.)
09-20-2012 05:08 PM
Visit this user's website 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: #2
RE: NPC AI
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.

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.
09-20-2012 11:51 PM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #3
RE: NPC AI
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.

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
09-21-2012 01:42 AM
Visit this user's website 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: #4
RE: NPC AI
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 ?

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.
09-21-2012 01:44 AM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #5
RE: NPC AI
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.

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
(This post was last modified: 09-21-2012 02:07 AM by Skul.)
09-21-2012 01:50 AM
Visit this user's website 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: #6
RE: NPC AI
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>)

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.
(This post was last modified: 09-21-2012 02:20 AM by Extreme.)
09-21-2012 02:15 AM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #7
RE: NPC AI
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.

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
(This post was last modified: 09-21-2012 05:18 AM by Skul.)
09-21-2012 04:44 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #8
RE: NPC AI
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.

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
09-24-2012 02:58 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #9
RE: NPC AI
OK, so what you do is spawn 10-15 c_h_barbarian_warrior near a tree, maxdist 1, and watch the action Wink

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
09-24-2012 05:41 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #10
RE: NPC AI
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>

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
(This post was last modified: 10-01-2012 02:53 PM by Skul.)
10-01-2012 02:53 PM
Visit this user's website 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)

This forum uses Lukasz Tkacz MyBB addons.