Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   2 Questions... (https://forums.graalonline.com/forums/showthread.php?t=134260091)

xMane 08-06-2010 05:09 PM

2 Questions...
 
Does anyone have any idea how to disable defualt unstick me command?
also how do i check rc chat , ex: if(rcchat == "example")

xXziroXx 08-06-2010 05:19 PM

PHP Code:

//#CLIENTSIDE
function ChatBar.onAction()
{
  if (
ChatBar.text in "unstick me""unstuck me" })
    
ChatBar.text "disabled!";


In Control-NPC:

PHP Code:

function onRCChat(command)
{
  if (
command == "test")
    echo(
"It works!");


Trigger it by doing the following on RC:

/npctest
/npc test

Either one works.

xMane 08-06-2010 08:31 PM

Also... umm ive bein trying to do this
PHP Code:

//#CLIENTSIDE
function onPlayerTouchsMe()
  {
setlevel2("example.gmap",30,30);


is their a way to warp to a level in clientside?
im using a level npc if it makes a diffrence...

fowlplay4 08-06-2010 08:37 PM

setlevel2 is a server-side player function.

PHP Code:

function onPlayerTouchsMe() {
  
player.setlevel2("onlinestartlocal.nw"3030);


Would work just fine.

xMane 08-06-2010 09:31 PM

Quote:

Originally Posted by fowlplay4 (Post 1591753)
setlevel2 is a server-side player function.

PHP Code:

function onPlayerTouchsMe() {
  
player.setlevel2("onlinestartlocal.nw"3030);


Would work just fine.

PHP Code:

function onPlayerTouchsMe() {
  if(
client.quest1 == 4)
    {
    
this.chat="Ok you have permission... so we'll be off!";
    
client.quest1=5;
    
freezeplayer(1);
    
this.e=0.1;
    
seteffect(0,0,0,this.e);//1
    
sleep(.1);
    
this.e+=.1;
    
seteffect(0,0,0,this.e);//2
    
sleep(.1);
    
this.e+=.1;
    
seteffect(0,0,0,this.e);//3
    
sleep(.1);
    
this.e+=.1;
    
seteffect(0,0,0,this.e);//4
    
sleep(.1);
    
this.e+=.1;
    
seteffect(0,0,0,this.e);//5
    
sleep(.1);
    
this.e+=.1;
    
seteffect(0,0,0,this.e);//6
    
sleep(.1);
    
this.e+=.1;
    
seteffect(0,0,0,this.e);//7
    
sleep(.1);
    
this.e+=.1;
    
seteffect(0,0,0,this.e);//8
    
sleep(.1);
    
this.e+=.1;
    
seteffect(0,0,0,this.e);//9
    
sleep(.1);
    
this.e+=.1;
    
seteffect(0,0,0,this.e);//10
    
sleep(.1);
    
this.chat="";
    
seteffect(0,0,0,0);
    
setani("sleep",null);
    
player.setlevel2("express_boat-storm2.nw",36.5,18);
  }


:( me fail cake... helps pls?

fowlplay4 08-06-2010 09:37 PM

You need to tell the server to warp the player, which is done easily with triggeraction. Since this is just a level npc, you can do it like this:

PHP Code:

function onCreated() {
  
// Gives NPC shape to be 'hit' with triggeractions on the server-side.
  
setshape(13232);
}

function 
onActionWarpPlayer() {
  
player.setlevel2("onlinestartlocal.nw"3030);
}

//#CLIENTSIDE

function onPlayerTouchsMe() {
  
triggeraction(this.1this.1"WarpPlayer""");


Your duplicate code can also be redone with a for loop.

xMane 08-06-2010 09:48 PM

Quote:

Originally Posted by fowlplay4 (Post 1591759)
You need to tell the server to warp the player, which is done easily with triggeraction. Since this is just a level npc, you can do it like this:

PHP Code:

function onCreated() {
  
// Gives NPC shape to be 'hit' with triggeractions on the server-side.
  
setshape(13232);
}

function 
onActionWarpPlayer() {
  
player.setlevel2("onlinestartlocal.nw"3030);
}

//#CLIENTSIDE

function onPlayerTouchsMe() {
  
triggeraction(this.1this.y, + 1"WarpPlayer""");


Your duplicate code can also be redone with a for loop.

Do you know how much i love you? <3 Thanks. EDIT : NVM! EDIT x2: NVM TAT NVM I LOVE U!
PHP Code:

function onActionWarpPlayer() {
  
player.setlevel2("express_boat-storm2.nw",36.5,18);
}
//#CLIENTSIDE
function onCreated()
  {
  
setshape(1,32,32);
}
function 
onPlayerTouchsMe()
  {
  if(
client.quest1=4)
    {
    
triggeraction(this.1this.y, + 1"WarpPlayer""");
    
setani("sleep",NULL);
    
client.quest1=5;
  }


it still no work! but setting client.quest1 works perfectly...

Mark Sir Link 08-06-2010 10:03 PM

Quote:

Originally Posted by xMane (Post 1591760)
Do you know how much i love you? <3 Thanks. EDIT : NVM! EDIT x2: NVM TAT NVM I LOVE U!
PHP Code:

function onActionWarpPlayer() {
  
player.setlevel2("express_boat-storm2.nw",36.5,18);
}
//#CLIENTSIDE
function onCreated()
  {
  
setshape(1,32,32);
}
function 
onPlayerTouchsMe()
  {
  if(
client.quest1=4)
    {
    
triggeraction(this.1this.y, + 1"WarpPlayer""");
    
setani("sleep",NULL);
    
client.quest1=5;
  }


it still no work! but setting client.quest1 works perfectly...

not 100% sure on this since I always do it but I believe you need to add a setshape on the serverside as well.

cbk1994 08-06-2010 10:09 PM

Quote:

Originally Posted by Mark Sir Link (Post 1591762)
not 100% sure on this since I always do it but I believe you need to add a setshape on the serverside as well.

Yes.

You've also got an extra comma on this line after this.y:

PHP Code:

triggeraction(this.1this.y, + 1"WarpPlayer"""); 

should be

PHP Code:

triggeraction(this.1this.1"WarpPlayer"""); 


fowlplay4 08-06-2010 10:10 PM

My example did have an error. Changing the following should fix it:

1. triggeraction(this.x + 1, this.y + 1, "WarpPlayer", "");
2. No setshape on the server-side.

The '+ 1' is personal preference, I prefer it to hit inside the NPC and not on the corner of it.

xMane 08-07-2010 03:14 AM

Quote:

Originally Posted by xXziroXx (Post 1591725)
PHP Code:

//#CLIENTSIDE
function ChatBar.onAction()
{
  if (
ChatBar.text in "unstick me""unstuck me" })
    
ChatBar.text "disabled!";



I want to like zod's unstick that a gui pops up.

xXziroXx 08-07-2010 03:17 AM

Quote:

Originally Posted by xMane (Post 1591838)
I want to like zod's unstick that a gui pops up.

Then script a GUI that does just that! :)


All times are GMT +2. The time now is 04:07 AM.

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