Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-27-2006, 02:50 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
triggeractions in classes

On Uprising we are using a class for dropped items. It's joined with putnpc2. But, we need to use triggeraction, but we can't get them to work the way you use them in weapons. Can anyone tell me how to use triggeractions in classes joined to npcs layed with putnpc2? Oh, and in normal NPCs as well.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #2  
Old 10-27-2006, 04:02 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
There shouldn't be differences to normal npc scripts. What exactly do you try to do with the trigger?
Reply With Quote
  #3  
Old 10-27-2006, 05:00 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Well, the person who was doing it was trying to get it to trigger to serverside to destroy when the player clicked on it. Of course, then I realized the onActionLeftMouse() worked serverside. lol
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #4  
Old 10-27-2006, 08:03 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Haha, that's correct =]
__________________
Reply With Quote
  #5  
Old 10-27-2006, 12:32 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by coreys View Post
On Uprising we are using a class for dropped items. It's joined with putnpc2. But, we need to use triggeraction, but we can't get them to work the way you use them in weapons. Can anyone tell me how to use triggeractions in classes joined to npcs layed with putnpc2? Oh, and in normal NPCs as well.


For future reference, you trigger to the serverside in class npcs the same you would in a level

PHP Code:
triggeraction(setanx,setay,"action",params); 

EXAMPLE:

PHP Code:
function onActionTest() {
 
player.chat "You just triggered! =)";
}

//#CLIENTSIDE
function onCreated {
 
triggeraction(x+0.5,y+0.5,"test","");


The format is different from the way it's set up for weapon npcs. Also take note that everything you put in the params will start with params[0] and not params[1].
Reply With Quote
  #6  
Old 10-28-2006, 10:06 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
PHP Code:
function onCreated() {
 
setshape(1,32,32);  // So the Trigger is Hits something Serverside.
}
function 
onActionTest() {
 if (
params[0] != idthis.chat "Some other npc hit me :(" SPC params[0];
 else 
this.chat "that tickles" SPC params[1];
}
//#CLIENTSIDE
function onCreated() {
 
triggeraction(x+1,y+1,"test",id,"lol"); //sending trigger

__________________
Quote:
Reply With Quote
  #7  
Old 11-28-2006, 02:06 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Well...I still haven't been able to get triggeractions in level npcs working. I've tried just about everything, including what you guys have mentioned.

Last thing I tried was this:
NPC Code:
function onActionTrigger() {
switch(params[0]) {
case "init":
message("Active...");
break;
}
}
//#CLIENTSIDE
function onCreated() {
triggeraction(x,y,"Trigger","init");
}

__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #8  
Old 11-28-2006, 02:55 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
You need to set a shape to the npc so that an object is set, and you need to specify an x and y when triggering in a level/class npc.

PHP Code:
function onCreated() {
  
setshape(1,32,32);
}

function 
onActionTrigger() {
  switch(
params[0]) {
    case 
"init":
    
message("Active..."); break;
  }
}

//#CLIENTSIDE
function onCreated() {
  
triggeraction(x+1.5,y+1.5,"Trigger","init");

Reply With Quote
  #9  
Old 11-28-2006, 03:04 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Ah! Thank you very much. =0
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #10  
Old 11-28-2006, 08:58 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
I am not too sure, but I am pretty sure you can use triggerserver, I think I've seen it used before inside a class...

Make a new function that finds the NPC and also sends the action to the serverside
function onCreated()
{
this.tiggerServer(pars);
}
That basically finds the current NPC (findNPC()) and then do the actionServerside part!
__________________

Last edited by xAndrewx; 11-28-2006 at 09:13 AM..
Reply With Quote
  #11  
Old 11-28-2006, 10:01 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
I've never heard nor seen triggerserver being used in classes/level npcs, for I've always been under the impression that it is not possible. Why don't you test it out and report your results?
Reply With Quote
  #12  
Old 11-29-2006, 09:14 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by Gambet View Post
I've never heard nor seen triggerserver being used in classes/level npcs, for I've always been under the impression that it is not possible. Why don't you test it out and report your results?
No time, going away in like five hours :[
''http://forums.graalonline.com/forums/showthread.php?p=1248203#post1248203''
__________________
Reply With Quote
Reply


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 08:07 PM.


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