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.
Trouble with AI's
Moderator: POL Developer
-
- Grandmaster Poster
- Posts: 120
- Joined: Thu Jan 18, 2007 2:34 am
Re: Trouble with AI's
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
Don't need 2 seperate scripts for that
Re: Trouble with AI's
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...
Re: Trouble with AI's
I would strongly recommand you to look over the "Fantasia Zulu" scripts. You might find a "pathfinding" for brainAI.
Re: Trouble with AI's
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
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
-
- Grandmaster Poster
- Posts: 120
- Joined: Thu Jan 18, 2007 2:34 am
Re: Trouble with AI's
++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
Re: Trouble with AI's
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...
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
Re: Trouble with AI's
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
Re: Trouble with AI's
brainAI from distro097 is simply awesome in my opinion.
Re: Trouble with AI's
It seems like scripts initiated through start_script can't use npc.emmr 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
-
- Grandmaster Poster
- Posts: 120
- Joined: Thu Jan 18, 2007 2:34 am
Re: Trouble with AI's
ah ok, learn something new every day Not a big deal though, like everyone says, it will just confuse things anyway.