Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   trigger client in a DB NPC (https://forums.graalonline.com/forums/showthread.php?t=134266073)

BlueMelon 03-23-2012 12:42 AM

trigger client in a DB NPC
 
PHP Code:


function onCreated(){
  
trigWeapon("Test");
}

function 
trigWeapon(trig){
  
triggerClient("npc","Blue_Temp","triggar",trig);
}

//#CLIENTSIDE

function onActionClientSide(){
  if(
params[0] == "triggar"){
    
findWeapon("Blue/Temp").trigger(params[1], "");
  }


And then ofcourse in Blue/Temp (weapon) I would have on clientside
function onTest(){ player.chat = "test"; }

Anyone have an idea why its not triggering?

ffcmike 03-23-2012 12:59 AM

Quote:

Originally Posted by BlueMelon (Post 1689694)
PHP Code:


function onCreated(){
  
trigWeapon("Test");
}

function 
trigWeapon(trig){
  
triggerClient("npc","Blue_Temp","triggar",trig);
}

//#CLIENTSIDE

function onActionClientSide(){
  if(
params[0] == "triggar"){
    
findWeapon("Blue/Temp").trigger(params[1], "");
  }


And then ofcourse in Blue/Temp (weapon) I would have on clientside
function onTest(){ player.chat = "test"; }
Anyone have an idea why its not triggering?

Triggerclient does not work within any form of NPC, it works within Weapons.
That aside, there would be no player object within the onCreated event, you would have to do:

PHP Code:

findplayer("account").triggerClient(params); 


BlueMelon 03-23-2012 06:19 AM

Quote:

Originally Posted by ffcmike (Post 1689697)
Triggerclient does not work within any form of NPC, it works within Weapons.
That aside, there would be no player object within the onCreated event, you would have to do:

PHP Code:

findplayer("account").triggerClient(params); 


So there is no way to do it fully in the DB NPC?
Meh, I guess I could do that.

BlueMelon 03-23-2012 07:07 AM

NVM problem solved.

MattKan 03-23-2012 11:09 PM

Quote:

Originally Posted by BlueMelon (Post 1689739)
NVM problem solved.

Can you post how in case people have the same problem in the future?

BlueMelon 03-24-2012 12:55 AM

Quote:

Originally Posted by MattKan (Post 1689787)
Can you post how in case people have the same problem in the future?

I would have if it wouldn't have been posted in this thread.

I used triggerclient to a players weapon.


All times are GMT +2. The time now is 04:13 PM.

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