Graal Forums

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

mrnothersan 05-14-2011 08:48 PM

NPC Help
 
Hello,

Can someone tell me how to change the default message of the NPC that somebody gets when they enter the game?
Also, can someone tell me how to give the NPC Server commands? For example when someone says "/staffapp" they will receive the staff application automatically.

Regards

cbk1994 05-14-2011 08:57 PM

There is no default message that players receive on login from the NPC-server. If you mean a PM, somebody must have added that to your server, it's probably in the Control-NPC script.

Use TServerPlayer.sendPM(str message) for sending players PMs. Serverside only.

Example:

PHP Code:

function onActionServerSide(temp.cmdtemp.chat) {
  if (
temp.cmd == "chat") {
    
player.sendPM("You said:\n" temp.chat);
  }
}

//#CLIENTSIDE
function onPlayerChats() {
  
triggerServer("gui"this.name"chat"player.chat);



mrnothersan 05-14-2011 09:22 PM

Quote:

Originally Posted by cbk1994 (Post 1649712)
There is no default message that players receive on login from the NPC-server. If you mean a PM, somebody must have added that to your server, it's probably in the Control-NPC script.

Use TServerPlayer.sendPM(str message) for sending players PMs. Serverside only.

i put

PHP Code:

function onActionServerSide(temp.cmdtemp.chat) {
  if (
temp.cmd == "chat") {
    
player.sendPM("You said:\n" temp.chat);
  }
}

//#CLIENTSIDE
function onPlayerChats() {
  
triggerServer("gui"this.name"chat"player.chat);


in npcscript and it didnt work when i tried saying chat...

mrnothersan 05-14-2011 09:30 PM

Quote:

Originally Posted by mrnothersan (Post 1649709)
Hello,

Can someone tell me how to change the default message of the NPC that somebody gets when they PM the NPC-Server?
Regards

it says

Quote:

I am the npcserver for
this game server. Almost
all npc actions are controlled
by me

cbk1994 05-14-2011 10:16 PM

Quote:

Originally Posted by mrnothersan (Post 1649719)
it says

In the Control-NPC,

PHP Code:

function onCreated() {
  
this.setPM("");
}

function 
onInitialized() {
  
this.trigger("created");


For the chat thing, that will need to be in a weapon, not the Control-NPC.

mrnothersan 05-14-2011 10:30 PM

Quote:

Originally Posted by cbk1994 (Post 1649725)
In the Control-NPC,

PHP Code:

function onCreated() {
  
this.setPM("");
}

function 
onInitialized() {
  
this.trigger("created");


For the chat thing, that will need to be in a weapon, not the Control-NPC.


Error...
Script: Function setPM not found at line 2 in script of Control-NPC

cbk1994 05-14-2011 10:41 PM

Quote:

Originally Posted by mrnothersan (Post 1649731)
Error...
Script: Function setPM not found at line 2 in script of Control-NPC

Try replacing this.setPM with setpm.


All times are GMT +2. The time now is 09:32 PM.

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