Trouble with AI's

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
Mandos
Former Developer
Posts: 7
Joined: Wed May 25, 2011 1:24 am

Trouble with AI's

Post by Mandos » Wed May 25, 2011 1:33 am

Does anybody know if it is possible to start a new AIscript through the "start_script" command?

I want 2 while loops working on different time delays. Something like:

-> For every a miliseconds, run to x.
-> For every b miliseconds, fight y.

The easiest idea seemed to have 2 AIscripts attached to the same npc.

mr bubbles
Grandmaster Poster
Posts: 120
Joined: Thu Jan 18, 2007 2:34 am

Re: Trouble with AI's

Post by mr bubbles » Wed May 25, 2011 2:20 am

What is it you want your AI to do? From the looks of it, you want it to travel to a certain destination while fighting any enemies on the way?

Don't need 2 seperate scripts for that

Mandos
Former Developer
Posts: 7
Joined: Wed May 25, 2011 1:24 am

Re: Trouble with AI's

Post by Mandos » Wed May 25, 2011 5:30 am

I think I see how to avoid the problem. Nevertheless, I am still curious to know if it is possible to do it the other way...

User avatar
*Edwards
Forum Regular
Posts: 302
Joined: Fri Dec 28, 2007 11:19 pm
Location: Montreal, Canada

Re: Trouble with AI's

Post by *Edwards » Wed May 25, 2011 2:22 pm

I would strongly recommand you to look over the "Fantasia Zulu" scripts. You might find a "pathfinding" for brainAI.

Mandos
Former Developer
Posts: 7
Joined: Wed May 25, 2011 1:24 am

Re: Trouble with AI's

Post by Mandos » Wed May 25, 2011 2:30 pm

Hi Edwards,

Thanks for the suggestion! Nevertheless, the link in http://forums.polserver.com/viewtopic.php?f=43&t=2607 doesn't seem to be working. When I try to unzip it says the file is corrupt :(

mr bubbles
Grandmaster Poster
Posts: 120
Joined: Thu Jan 18, 2007 2:34 am

Re: Trouble with AI's

Post by mr bubbles » Wed May 25, 2011 10:56 pm

Mandos wrote:I think I see how to avoid the problem. Nevertheless, I am still curious to know if it is possible to do it the other way...
++

Well I guess you could. Like you said, using the start_script function, you could have as many scripts running on and npc as you want. It would greatly confuse things though :P

User avatar
CWO
POL Expert
Posts: 1153
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Trouble with AI's

Post by CWO » Thu May 26, 2011 2:55 am

I think you're better off having it in one script, this way if the NPC is fighting, you don't have the two scripts conflicting with eachother. One will be running the NPC away from the person to go to the location, the other will be running the NPC toward the person to fight them.


something along the lines of...

Code: Select all

var nextfighttimer := ReadGameClock() + (however long until the NPC fights)
while(me)
     RunTowardLocation(x);
     if (ReadGameClock() >= nextfighttimer)
          Fight(y);
          nextfighttimer := ReadGameClock() + (however long until the NPC fights)
     endif
     sleep
endwhile

Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Trouble with AI's

Post by Turley » Thu May 26, 2011 5:35 am

And If you want a more advanced ai script you remove all readgameclock checks and write it completely eventbased. This will speedup your ai's but having less instructions per minutes

User avatar
*Edwards
Forum Regular
Posts: 302
Joined: Fri Dec 28, 2007 11:19 pm
Location: Montreal, Canada

Re: Trouble with AI's

Post by *Edwards » Thu May 26, 2011 8:35 pm

brainAI from distro097 is simply awesome in my opinion.

Mandos
Former Developer
Posts: 7
Joined: Wed May 25, 2011 1:24 am

Re: Trouble with AI's

Post by Mandos » Thu May 26, 2011 10:10 pm

mr bubbles wrote:
Mandos wrote:I think I see how to avoid the problem. Nevertheless, I am still curious to know if it is possible to do it the other way...
++

Well I guess you could. Like you said, using the start_script function, you could have as many scripts running on and npc as you want. It would greatly confuse things though :P
It seems like scripts initiated through start_script can't use npc.em :(

mr bubbles
Grandmaster Poster
Posts: 120
Joined: Thu Jan 18, 2007 2:34 am

Re: Trouble with AI's

Post by mr bubbles » Fri May 27, 2011 12:32 am

ah ok, learn something new every day :) Not a big deal though, like everyone says, it will just confuse things anyway.

Post Reply