Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Staff Block Warp (https://forums.graalonline.com/forums/showthread.php?t=75285)

bscharff 07-13-2007 01:04 AM

Staff Block Warp
 
Is it possible for me to have something like:
if (playertouchsme){
setlevel2 #s(this.blocklevel),#s(this.blockx),#s(this.blocky );
}
if (playerchats && strequals(#c,/blockwarp) && strequals(#a,bscharff)){
tokenize #c;
#t(1) = this.blocklevel;
#t(2) = this.blockx;
#t(3) = this.blocky;
}

or possibly with if (playertouchsme){
tokenize #c;
#t(1) = this.tempwarpaccount;
with (findplayer#s(this.tempwarpaccount)){
setlevel2 #s(this.blocklevel),#s(this.blockx),#s(this.blocky );
}
}

This Is Just My Example, If This Wouldn't Work, Please Provide A Code That Would! :)

or, If One Would Work, Please Tell Me Which One :)

Thanks!

Twinny 07-13-2007 01:30 AM

I'm not quite getting your script... You use a chat command, tokenize the players chat then set the tokens as strings which defies the point of tokenizing #c at all.

What are you trying to achieve?

theHAWKER 07-13-2007 06:45 AM

i think he wants to warp a "block" to a level...

Inverness 07-13-2007 06:50 AM

setlevel2 in GS1 requires conversion to float for the x and y.
PHP Code:

setlevel2 #s(this.string),strtofloat(#s(this.string)),strtofloat(#s(this.string)); 

Last time I checked anyway, and that was along time ago.

Luigi203 07-13-2007 07:41 AM

Quote:

Originally Posted by Twinny (Post 1328774)
I'm not quite getting your script... You use a chat command, tokenize the players chat then set the tokens as strings which defies the point of tokenizing #c at all.

What are you trying to achieve?


I think he was trying to achieve
PHP Code:

setstring this.blocklevel,#t(1);
this.blockx #t(2);
this.blocky #t(3); 


Inverness 07-13-2007 07:47 AM

Quote:

Originally Posted by Luigi203 (Post 1328902)
I think he was trying to achieve
PHP Code:

setstring this.blocklevel,#t(1);
this.blockx #t(2);
this.blocky #t(3); 


PHP Code:

setstring this.blocklevel,#t(1);
this.blockx strtofloat(#t(2));
this.blocky strtofloat(#t(3)); 


Twinny 07-13-2007 07:59 AM

Quote:

Originally Posted by theHAWKER (Post 1328888)
i think he wants to warp a "block" to a level...

Doubt it. It's doing player.setlevel2() : not actually making the NPC warp.

PHP Code:

if (playertouchsme){
setlevel2 #s(this.blocklevel),#s(this.blockx),#s(this.blocky );
}
if (
playerchats && strequals(#c,/blockwarp) && strequals(#a,bscharff)){
tokenize #c;
#t(1) = this.blocklevel;
#t(2) = this.blockx;
#t(3) = this.blocky;


This one requires you to say exactly /blockwarp but then it tokenizes the chat and then sets the token values to local variables. For the second one: I have no clue :x

Do you want to be able to say a location then be warped there when you touch the block? If so

PHP Code:

function onPlayerChats()
{
  if (
player.account == "youraccounthere")
  {
    if (
player.chat.starts("/blockwarp"))
    {
      
temp.toks player.chat.tokenize();
      
this.wlevel temp.toks[1];
      
this.wx temp.toks[2];
      
this.wy temp.toks[3];
    }
  }
}

function 
onPlayerTouchsMe()
{
  
player.setlevel2(this.wlevelthis.wxthis.wy);


Should work if you upload it to a server. Next time at least explain what you want the code to do :x

bscharff 07-14-2007 07:14 AM

No, No, No.
I'm Trying Like If A Player Touches The Block Then They Are Warped To this.blockwarpx this.blockwarpy this.blockwarplevel
But Thanks :P

bscharff 07-14-2007 07:15 AM

yeah, that's it twinny!
Thanks!


All times are GMT +2. The time now is 02:36 PM.

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