Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-28-2012, 05:48 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Move Script to stop

So I'm using FP4's movement script for npcs (http://forums.graalonline.com/forums...ad.php?t=85370)
and I'm trying to let the actions be interrupted so the npc will stop to chat and other stuff, w/o it being set in the actions and instead by onPlayerTouchsMe, I've added these to the level npc (remember fp4's stuff is also there, these are just additions, I believe the way I'm triggering is probably the problem):

PHP Code:
function onCreated()
{
  
level.npc.jaqor this;
}
// Function to stop the walk of the npc when chatting with a player
function onStopWalk()
{
  echo(
"trigger");
  
// save this.actions
  
this.actionsSaved this.actions;
  
this.actions = {
    
"wait: 9000"
  
};
  
this.savActPos this.actionpos;
  
doAction(0);
}

// Function to resume original actions
public function onResume()
{
  echo(
"resume");
  
this.actions this.actionsSaved;
  
doAction(this.savActPos);
}
//#CLIENTSIDE
function onPlayerTouchsMe()
{
  
this.trigger("StopWalk");
  
findweapon("-System/NPCDialog").loadDialog(this.headthis.speakerthis.msgthis.options);

The weapon calling at the bottom eventuall sends to this serverside trigger in the weapon (and yes it does reach it)

PHP Code:
function onActionServerside()
{
  if (
params[0] == "moveNPC")
  {
    
//echo("server");
    
level.npc.(@params[1]).trigger("Resume");
  }
}
//#CLIENTSIDE
function doesntReallyMatter()
{
  
triggerserver("gui"this.name"moveNPC"this.speaker);

It seems it's not getting to either trigger on the lv npc at all. if I echo on the wep trigger to server action it does get to that though...
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 12-28-2012, 06:34 AM
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
You're in luck, I actually updated that script for my use elsewhere about a year ago. I posted my changes here. I would recommend keeping it client-side though.
__________________
Quote:
Reply With Quote
  #3  
Old 12-28-2012, 06:42 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Awesome. Thanks!

I wanted it serverside so the npc is at the same spot for everyone, due to party quests, ect.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #4  
Old 12-28-2012, 07:22 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Errrr nm.

If you set it both on clientside and serverside in the same class it seems to mess it up. If you need it serverside, just leaving it only serverside works fine. Dunno or understand why but thats what just happened xD
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #5  
Old 12-28-2012, 07:33 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Also to my original problem. I still need to trigger from the weapon showing the dialog to the level npc, so on a waitfor it knows when to continue. I'm still basically using the same thing, send a trigger to server in weapon, send a trigger serverside in weapon to serverside on level npc.

On the level npc now though it's just this for waiting for the trigger from the wnpc:

PHP Code:
function onPlayerTouchsMe()
{
  
npc_stop();
  
this.dir = (player.dir 2) % 4;
  
waitfor(this"onDialogDone"3600);
  
npc_continue();

I've also tried just "DialogDone" in waitfor as well... it's not doing anything until the waitfor times out.

The weapon npc:
PHP Code:
function onActionServerside()
{
  if (
params[0] == "finishedDialog")
  {
    
level.npc.(@params[1]).trigger("DialogDone");
  }
}
//#CLIENTSIDE 
function doesntReallyMatter() 

  
triggerserver("gui"this.name"finishedDialog"this.speaker);

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...



Last edited by sssssssssss; 12-28-2012 at 07:48 AM..
Reply With Quote
  #6  
Old 12-28-2012, 07:47 AM
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
Try using a database NPC variable instead of a level variable. I.e.

("Control-NPC").npc.jaqor = this;

then in your script..

("Control-NPC").npc.(@params[1]).trigger("Resume");
__________________
Quote:
Reply With Quote
  #7  
Old 12-28-2012, 07:49 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Changed above post to match what I have. Sorry about that.

It's still mostly the same. I might just have the wrong idea of how this is supposed to work, but from my understanding you call the trigger to the level npc from the serverside of the wnpc. The level npc sits with a waitfor, waiting for that trigger name to pull up, from the trigger sent from the wnpc.

Like I said I've tried onDialogDone and DialogDone as well in the waitfor.

Ill just post what I got so we're up to date with each other xD


Still not working unfortunately...

wnpc:
PHP Code:
function onActionServerside()
{
  if (
params[0] == "finishedDialog")
  {
    (
"Control-NPC").npc.(@params[1]).trigger("DialogDone");
  }

level npc:
PHP Code:
function onCreated()
{
  (
"Control-NPC").npc.jaqor this;
  
this.join("npc_movement");
  
// stuff
}
function 
onPlayerTouchsMe()
{
  
npc_stop();
  
this.dir = (player.dir 2) % 4;
  
waitfor(this"onDialogDone"3600);
  
npc_continue();

Did just DialogDone on waitfor too...
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...



Last edited by sssssssssss; 12-28-2012 at 04:09 PM..
Reply With Quote
  #8  
Old 12-28-2012, 04:49 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
in your server-side portion verify that you're actually sending a trigger to the right place and that you can see it's nickname (give it one):

echo("trigger" SPC params[1]);
echo(("Control-NPC").npc.(@params[1]).nick);
__________________
Quote:
Reply With Quote
  #9  
Old 12-28-2012, 04:53 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Yup.

NPC Code:
trigger Jaqor



That was echo("trigger" SPC params[1]);
Putting .nick didn't work.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #10  
Old 12-28-2012, 05:03 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
Quote:
Originally Posted by fowlplay4 View Post
("Control-NPC").npc.(@params[1]).trigger("Resume");
Just be careful to validate that parameter before you do this to avoid allowing a hacker to send rogue triggers to any NPC you're using like this.
__________________
Reply With Quote
  #11  
Old 12-28-2012, 05:51 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
Quote:
Originally Posted by sssssssssss View Post
Yup.
That was echo("trigger" SPC params[1]);
Putting .nick didn't work.
You have Jaqor but your variable is jaqor, and the lack of a nick would indicate to me that it's not finding the npc.

Variables are case-sensitive:

PHP Code:
function onCreated() {
  
temp.1;
  
temp.2;
  echo(
temp.== temp.A);
  echo(
temp.a SPC temp.A);
}

//The script of NPC JerretNPC has been updated by fowlplay4
//0
//1 2 
I would probably go back to using level instead of Control-NPC for now as well.
__________________
Quote:
Reply With Quote
  #12  
Old 12-28-2012, 07:16 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Oh goodness.....

Sorry and thanks for pointing that out. It's always really stupid things that get me stuck. xD
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #13  
Old 12-29-2012, 12:14 AM
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
Quote:
Originally Posted by sssssssssss View Post
Oh goodness.....

Sorry and thanks for pointing that out. It's always really stupid things that get me stuck. xD
Use your params when you're debugging next time.
__________________
Quote:
Reply With Quote
  #14  
Old 12-29-2012, 12:16 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
I did. Just didn't pay that much attention I guess.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 11:15 AM.


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