Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Warp script isnt working. (https://forums.graalonline.com/forums/showthread.php?t=134259371)

Jiroxys7 05-31-2010 08:43 PM

Warp script isnt working.
 
I cant seem to get this script to work. As a level NPC it wont work, but when i use it as a WNPC, it will. (though i need it as a level npc)

When I use it as a level NPC, it cant seem to get through to the serverside action. What am i doing wrong?

PHP Code:

function onActionServerSide(cmd){
   if(
temp.cmd == "arrive"){
       
setlevel2(client.destination[0],client.destination[1],client.destination[2]);
   }
}

//#CLIENTSIDE
function onCreated(){
  
setcoloreffect 1,1,1,0.01;
  
setimgpart block.png,0,0,32,16;
}

function 
onPlayerchats(){
  if(
player.chat "Testdestination"){
  
client.destination = {"overworld_bw061.nw",15.5,15};
  }
   
setTimer(3);
}

function 
onTimeout(){
  
triggerserver("npc",this.name,"arrive");



cbk1994 05-31-2010 08:46 PM

You don't need a trigger for that.

PHP Code:

function onPlayerChats() {
  if (
player.chat == "Testdestination"){
    
player.setLevel2("overworld_bw061.nw"15.515};
  }
}
//#CLIENTSIDE 
function onCreated(){ 
  
setcoloreffect(1,1,1,0.01); 
  
setimgpart("block.png",0,0,32,16); 



fowlplay4 05-31-2010 08:52 PM

Well, quick glance over:

if (player.chat = "Testdestination") {

=, is an assignment i.e: a = 1;
==, is a comparison. i.e: player.chat == "yes!";

You should be doing comparisons in if statements.

Also I would recommend just setting:

client.destination = "Test destination";

Instead of setting actual level coordinates that could easily be changed with a memory editor, then on the serverside you'd have to a simple check.

PHP Code:

function onActionServerSide() {
  if (
params[0] == "arrive") {
    
// Determine coordinates from the destination
    
if (client.destination == "Test destination") {
      
temp.coordinates = {"onlinestartlocal.nw"3030};
    }
    else if (
client.destination == "some other place") {
      
temp.coordinates = {"onlinestartlocal.nw"3030};
    }
    
// Make sure coordinates were set.
    
if (temp.coordinates != NULL) {
      
// Warp player
      
player.setlevel2(temp.coordinates[0], temp.coordinates[1], temp.coordinates[2]);
    }
  }


But that was assuming you were using it in a weapon npc, oh well.

ffcmike 05-31-2010 09:02 PM

Quote:

Originally Posted by Jiroxys7 (Post 1579606)
but when i use it as a WNPC, it will. (though i need it as a level npc)

It might also be worth mentioning that you cannot use triggerserver within normal Level NPCs (although you can with local level NPCs/putnpc2s if you have the name stored), you generally have to use a triggeraction on the coordinate.


All times are GMT +2. The time now is 12:26 AM.

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