Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-31-2010, 08:43 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
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");

__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #2  
Old 05-31-2010, 08:46 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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); 

__________________

Last edited by cbk1994; 05-31-2010 at 09:27 PM.. Reason: didn't notice "=" comparison
Reply With Quote
  #3  
Old 05-31-2010, 08:52 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.
__________________
Quote:
Reply With Quote
  #4  
Old 05-31-2010, 09:02 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Jiroxys7 View Post
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.
Reply With Quote
Reply


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 07:35 PM.


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