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 12-07-2003, 02:15 AM
Luigi1 Luigi1 is offline
The OtherOther Shaded Leg
Join Date: Jul 2003
Location: In front of a monitor
Posts: 333
Luigi1 is on a distinguished road
Triggeraction from serverside to clientside?

Note: I mean in a local DB NPC, not a weapon.

I want to do something like this: (Well, what I need this for isn't for this script, but still... this is an example of the scenario)

NPC Code:
if (created || playerenters) {
setshape 1,32,32;
setstring this.test,hahaha.;
triggeraction x+.5,y+.5,test,#v(id),#s(this.test);
}

//#CLIENTSIDE
if (created) {
setshape2 2,2,{22,22,
22,22};
}

if (actiontest) {
if (strtofloat(#p(0)) == id) // So that it is received only by this NPC.
message received - #p(1);
}



... But that doesn't seem to work.

Is there a way to make this work? I can't use save[#0-299], because I believe you can only transfer variables with those, unless I'm mistaken.
__________________
Quote:
Originally Posted by mystic2k
that post did really makes me think how much braincells you have.
*waits for nifty Graal admin person to tell me what happened to vip.graal.net*
Reply With Quote
  #2  
Old 12-07-2003, 02:33 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Find out exactly what part doesn't work - eliminate all extraneous code.
Reply With Quote
  #3  
Old 12-07-2003, 02:40 AM
xManiamaNx xManiamaNx is offline
Supreme Dictator
xManiamaNx's Avatar
Join Date: Nov 2002
Location: 127.0.0.1
Posts: 385
xManiamaNx is on a distinguished road
Send a message via MSN to xManiamaNx Send a message via Yahoo to xManiamaNx
Does triggeraction even work serverside? It never does for me.
__________________
Maniaman

Play Maloria Now: [2.3] [3]
Maloria Website

Reply With Quote
  #4  
Old 12-07-2003, 02:44 AM
Luigi1 Luigi1 is offline
The OtherOther Shaded Leg
Join Date: Jul 2003
Location: In front of a monitor
Posts: 333
Luigi1 is on a distinguished road
Triggeraction does seem to work serverside, but it can't go to the clientside part of a script (unless you do it in a weapon with "triggeraction 0,0,clientside,weapon,params")
__________________
Quote:
Originally Posted by mystic2k
that post did really makes me think how much braincells you have.
*waits for nifty Graal admin person to tell me what happened to vip.graal.net*
Reply With Quote
  #5  
Old 12-07-2003, 02:47 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Exactly.
I suggest you just set client. flags and strings which the client subsequently may unset.
Reply With Quote
  #6  
Old 12-07-2003, 05:32 AM
KuJiGX KuJiGX is offline
Registered User
Join Date: Dec 2003
Location: New York
Posts: 52
KuJiGX is on a distinguished road
Send a message via AIM to KuJiGX
Re: Triggeraction from serverside to clientside?

Quote:
Originally posted by Luigi1
NPC Code:

triggeraction x+.5,y+.5,test,#v(id),#s(this.test);


Wouldn't you do triggeraction x,y,test,#v(id),#s(this.test);
Reply With Quote
  #7  
Old 12-07-2003, 07:41 AM
xManiamaNx xManiamaNx is offline
Supreme Dictator
xManiamaNx's Avatar
Join Date: Nov 2002
Location: 127.0.0.1
Posts: 385
xManiamaNx is on a distinguished road
Send a message via MSN to xManiamaNx Send a message via Yahoo to xManiamaNx
perhaps the npc is x+.55 and y+.5 from the npc triggering the action.
__________________
Maniaman

Play Maloria Now: [2.3] [3]
Maloria Website

Reply With Quote
  #8  
Old 12-07-2003, 07:45 AM
KuJiGX KuJiGX is offline
Registered User
Join Date: Dec 2003
Location: New York
Posts: 52
KuJiGX is on a distinguished road
Send a message via AIM to KuJiGX
well if you trigger it on its x + y then its sending to its own NPC i believe. One of my scripts are like that.
Grab npc and it sends a script to the join npc.
if (created) join pwnt;
if (actiongrab) triggeraction x,y,test,pwnt;


then in join class:
if (actiontest) message #p(0); or something
__________________
-KuJi
Reply With Quote
  #9  
Old 12-07-2003, 10:08 AM
Luigi1 Luigi1 is offline
The OtherOther Shaded Leg
Join Date: Jul 2003
Location: In front of a monitor
Posts: 333
Luigi1 is on a distinguished road
No. (x,y) does not point inside of the NPC. (|x+.25,x+1.75|,|y+.25,y+1.75|) (probably a greater range than that, but not to ({x,x+2},{y,y+2})) does.

Also, I don't see why an if clause with the created event is needed when using the join command... join is like an include. (Or, "require" in PHP, which is an alias of include... although PHP does have the "include" command.)
__________________
Quote:
Originally Posted by mystic2k
that post did really makes me think how much braincells you have.
*waits for nifty Graal admin person to tell me what happened to vip.graal.net*
Reply With Quote
  #10  
Old 12-07-2003, 04:06 PM
KuJiGX KuJiGX is offline
Registered User
Join Date: Dec 2003
Location: New York
Posts: 52
KuJiGX is on a distinguished road
Send a message via AIM to KuJiGX
Quote:
Originally posted by Luigi1
No. (x,y) does not point inside of the NPC. (|x+.25,x+1.75|,|y+.25,y+1.75|) (probably a greater range than that, but not to ({x,x+2},{y,y+2})) does.

Also, I don't see why an if clause with the created event is needed when using the join command... join is like an include. (Or, "require" in PHP, which is an alias of include... although PHP does have the "include" command.)
So what do you do?
join pwnt;
if (actiongrab) triggeraction x,y,test,pwnt;


then in join class:
if (actiontest) message #p(0); or something

anyway u dont need it. And in PHP (I seen some php sources) your right. I think they do that in C++ also
__________________
-KuJi
Reply With Quote
  #11  
Old 12-07-2003, 04:14 PM
KuJiGX KuJiGX is offline
Registered User
Join Date: Dec 2003
Location: New York
Posts: 52
KuJiGX is on a distinguished road
Send a message via AIM to KuJiGX
That script is fine for me... What isn't working?

NPC Code:

if (created || playerenters) {
setshape 1,32,32;
setstring this.test,hahaha.;
triggeraction x,y,test,#v(id),#s(this.test);
}
//#CLIENTSIDE
if (created) setshape 1,32,32;
if (actiontest) {
if (strtofloat(#p(0)) == id) // So that it is received only by this NPC.
message received - #p(1);
}

__________________
-KuJi
Reply With Quote
  #12  
Old 12-07-2003, 08:06 PM
Luigi1 Luigi1 is offline
The OtherOther Shaded Leg
Join Date: Jul 2003
Location: In front of a monitor
Posts: 333
Luigi1 is on a distinguished road
If you test it offline, it works, because in offline mode, it doesn't care at all about clientside and serverside. Basically, the entire thing is "clientside" (although I do believe with() works in offline mode, from what I've heard). However, if you test in online mode, it does not.

Anyway, I got it to work by setting client. strings to everyone on the server (and they get deleted by the NPC when it changes that to the this. string)
__________________
Quote:
Originally Posted by mystic2k
that post did really makes me think how much braincells you have.
*waits for nifty Graal admin person to tell me what happened to vip.graal.net*
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 11:23 PM.


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