Author Topic: Random Walking  (Read 601 times)

I was gonna make a little script to make a bot walk random but what is the command?
I am needing it for my Role Playing Game.

Tom

You would need to make a schedule loop and have the bots move to a random point every time.

I have a small NPC script I wrote a while back.
Admins may type any of the following commands:
Code: [Select]
/spawnNPC Name  -  Spawns a bot with the specified name
/deleteNPC Name  -  Deletes the named bot
/exploreNPC Name  -  Tells the named bot to explore
/stopNPC Name  -  Stops the named bot from exploring/looking
/fetchNPC Name  -  Fetches the named bot to you
/lookNPC Name  -  Tells the named bot to look at you
/followNPC Name  -  Tells the named bot to follow you

I can give if you want, or if you still plan on writing your own script, here is exploring functions.
Code: [Select]
function AIPlayer::randomMove(%npc)
{
%loc = vectorAdd(%npc.getPosition(),getRandom(-25,25) SPC getRandom(-25,25) SPC 0);
%npc.setMoveDestination(%loc);
%npc.setAimLocation(%loc);
%npc.explore = schedule(2000,0,'NPCexplore',%npc);
}

function NPCexplore(%npc)
{
if(isObject(%npc))
{
%npc.stop();
%npc.randomMove();
}
}

How could i make a Horse randomly walk arround?
Do i use that same script?

Probably have to change something about %npc for that.
Pah, I would suggest testing around with scripts instead of making hundreds (or seeming) of coding help topics.
I'm sorry if you haven't been doing what I thought you were, I just noticed a few help topics within a few days.