View Single Post
  #22  
Old 01-08-2014, 03:36 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by callimuc View Post
triggerserver() does not work inside level NPCs, you would need to use triggerAction() for this case
Have to fix this statement, you can use triggerServer() inside level NPCs to trigger DB NPCs or weapons (and classes being joined to those). I figured this would be the best solution if you also want to receive the onActionServerSide() inside level NPCs (or NPCs created via putNPC2()) and classes being joined to those


Quote:
Originally Posted by cbk1994 View Post
You can also do

PHP Code:
function onCreated() {
  
this.level.tapThis this;
}

function 
onPow() {
  
this.chat "ouch!";
}

//#CLIENTSIDE
function onPlayerChats() {
  
triggerServer("npc""TriggerControl""Trigger"this.level.name"tapThis""Pow");

and then in an NPC TriggerControl

PHP Code:
function onActionTrigger(levelNamenpcNamecommand) {
  
findLevel(levelName).(@ npcName).trigger(command);

Though you'd want to add some security features. Usually something like this is preferable since you never know if a trigger will be received when using x/y.
__________________
MEEP!
Reply With Quote