Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-16-2010, 11:55 PM
Zeltino Zeltino is offline
Gov'nah
Zeltino's Avatar
Join Date: May 2005
Location: USA
Posts: 239
Zeltino will become famous soon enough
Using Random() {Major Help needed}

Hey guys,

I'm trying to put together a script that will make an NPC warp from one location to a list of ~100 locations on a server. The locations will be pre-determined. That means that I will have a list of the level, x, and y position that the NPC will warp to. I just need to know how to make the NPC randomly select between these locations, and how it will warp there, etc. It will randomly choose from the specified list of levels every 5 minutes.

I have very little scripting knowledge. I'm just trying to pull this together last-minute (needs to be done by tonight, ew). Any help would be tremendously helpful.

So far, I've started scripting the NPC in a class script (I assumed this would be better than a level NPC).

This is all I have so far:
NPC Code:
function onCreated(){ 
setimg("block.png");
this.locationsarray = {"test.nw","30","30"}, //Random Movement
{"zeltest.nw","40","40"};

scheduleevent("0.05","MoveMe","");
}

function onMoveMe(){
temp.i=int(random(0,99));
this.location=this.locationsarray[temp.i];
scheduleevent("300","MoveMe","");
}

function onPlayertouchsme(){
}


Almost certain none of the above is correct.

Can anyone help me <3?
__________________
Developer
Crescent Pirates
Email: [email protected]
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.