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 08-24-2004, 10:09 PM
prozac424242 prozac424242 is offline
Registered User
prozac424242's Avatar
Join Date: May 2001
Location: Gone crazy: back soon
Posts: 356
prozac424242 is on a distinguished road
Send a message via ICQ to prozac424242 Send a message via AIM to prozac424242
triggeraction x y and putnpc2 x y

I am trying to get a clientside triggeraction to place an npc serverside:

My question is, how do I access the x and y, sent from the triggeraction, on the server, in the putnpc2 command?

Here is the clientside part
NPC Code:


if (actionplant)
{
putnpc2 x,y,
{
setimage ion.gif;
message I am an ion;
}
}


#//CLIENTSIDE
if (weaponfired)
{
//set animation or sprite
freezeplayer .1;
playersprite=33;
// perform an action in front of the player
triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,
plant,;
}



Any help would be appreciated.
__________________

Useful links:
Graal Stats
Client Script Functions-GS1 to GS2
Serverside Script Functions-Gscript page
Particle Engine-Player Attributes
Server Options-Admin rights-Gmaps
Quote:
Originally Posted by Admins
Thanks for developing and improving playerworlds and such
Reply With Quote
  #2  
Old 08-24-2004, 10:16 PM
vahn32 vahn32 is offline
oner uf grawl +1 LOL
vahn32's Avatar
Join Date: Jan 2003
Location: See Bible.
Posts: 177
vahn32 is on a distinguished road
Send a message via AIM to vahn32
Ok, first of all it's not #//CLIENTSIDE, it's //#CLIENTSIDE.
Second of all you need to trigger the weapon itself to run a script in it serverside.
Example:
NPC Code:
if (actionserverside) {
//stuff here
}
//#CLIENTSIDE
if (weaponfired) {
triggeraction 0,0,serverside,WEAPONNAME,params;
}


To access any params sent from a triggeraction, use #p(0-#)
They are strings, so you convert them to integers for use in X and Y placements, use strtofloat(#p(#0));
Then again I haven't scripted in awhile but I think that's everything you need to know.
[Edit]Edited because I think I was under the influence of fatigue while typing.
__________________

Last edited by vahn32; 08-25-2004 at 01:09 AM..
Reply With Quote
  #3  
Old 08-24-2004, 10:17 PM
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
  • //#CLIENTSIDE
  • Weapon triggeractions take the form:
    triggeraction 0,0,serverside,weaponname,params;
  • They are received with the if (actionserverside) event, it is usually good to assign a name to the first parameter (and then check it on the serverside part) so it is easy to add other triggeractions to it later

Quote:
Originally Posted by vahn32
Example:
NPC Code:
if (actiondoop) {
//stuff here
}
//#CLIENTSIDE
if (weaponfired) {
triggeraction 0,0,serverside,WEAPONNAME,params;
}

Refer to bullet 3
Reply With Quote
  #4  
Old 08-24-2004, 11:39 PM
prozac424242 prozac424242 is offline
Registered User
prozac424242's Avatar
Join Date: May 2001
Location: Gone crazy: back soon
Posts: 356
prozac424242 is on a distinguished road
Send a message via ICQ to prozac424242 Send a message via AIM to prozac424242
Still does not put the npc on my server,
I tried putting in other ways to tell if the npc was created

NPC Code:

/////////////////////////////
//action of this npc = plant (for farming)
/////////////////////////////

if (actionplant)
{
putexplosion 1,x,y;
putnpc2 30,30,{
setimg ion.gif;
setplayerprop #c, I am an ion;
shootarrow up;
}
}

//#CLIENTSIDE

if (weaponfired && isweapon)
{
//set animation or sprite
freezeplayer .1;
playersprite=33;

triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,plant,Planting,;

}





Why does this still not work?
__________________

Useful links:
Graal Stats
Client Script Functions-GS1 to GS2
Serverside Script Functions-Gscript page
Particle Engine-Player Attributes
Server Options-Admin rights-Gmaps
Quote:
Originally Posted by Admins
Thanks for developing and improving playerworlds and such
Reply With Quote
  #5  
Old 08-25-2004, 01:37 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Quote:
Originally Posted by Lance
  • Weapon triggeractions take the form:
    triggeraction 0,0,serverside,weaponname,params;
Is this automatically set, or is this some sort of 'agreement' between scripters?
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #6  
Old 08-25-2004, 03:07 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
If you read newfeatures, there is a way to use triggeraction from server-side to client-side on weapons, if you did not know, here is what is written and may help you.

Quote:
- server-side scripts can do
'triggeraction 0,0,clientside,weapon,params'
to directly trigger the client-side part of
weapon of the player - catch it with
'if (actionclientside) actions;'
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #7  
Old 08-25-2004, 03:50 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Quote:
Originally Posted by osrs
If you read newfeatures, there is a way to use triggeraction from server-side to client-side on weapons, if you did not know, here is what is written and may help you.
Ah, comme ça. Thanks, yeah I read that part but I thought it was a weapon that did a serverside trigger...
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #8  
Old 08-25-2004, 06:05 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Quote:
Originally Posted by GoZelda
Ah, comme ça. Thanks, yeah I read that part but I thought it was a weapon that did a serverside trigger...
It can be done from the server-side part of a weapon too.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #9  
Old 08-24-2004, 11:49 PM
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
IF i understand this right, that is all in the same NPC.

Since you have:
NPC Code:
triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe  rdir)*2,pl  ant,Planting,;



the (actionplant) stuff needs to be in another NPC.
__________________
Maniaman

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

Reply With Quote
  #10  
Old 08-25-2004, 12:00 AM
prozac424242 prozac424242 is offline
Registered User
prozac424242's Avatar
Join Date: May 2001
Location: Gone crazy: back soon
Posts: 356
prozac424242 is on a distinguished road
Send a message via ICQ to prozac424242 Send a message via AIM to prozac424242
(missing the days of graal 1.28 when I understood npcs)

Why does it need to be in another npc?

Does anyone have a working example to share
that uses triggeractoin to perform a putnpc2 ccommand?
__________________

Useful links:
Graal Stats
Client Script Functions-GS1 to GS2
Serverside Script Functions-Gscript page
Particle Engine-Player Attributes
Server Options-Admin rights-Gmaps
Quote:
Originally Posted by Admins
Thanks for developing and improving playerworlds and such
Reply With Quote
  #11  
Old 08-25-2004, 05:00 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
Quote:
Originally Posted by prozac424242
Why does it need to be in another npc?
Because of the way you were using the triggeraction.

Quote:
Originally Posted by falco34896732947823insertrandomnumbershere34875234 49057239
Yeh well when u trigger something serverside u do 0,0 so it hits the npc server
I doubt this is a valid statement.
__________________
Maniaman

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

Reply With Quote
  #12  
Old 08-25-2004, 12:17 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
I can do something with triggeraction and a putnpc2


NPC Code:

if (actionserverside) {

putnpc2 strtofloat(#p(0)),strtofloat(#p(1)),{

//stuff happens here

}



}


//#CLIENTSIDE
if (weaponfired) {
triggeraction 0,0,serverside,weponname,#v(playerx+vecx(playerdir )*2+1.5),#v(playery+2+vecy(playerdir)*2);
}





There I didn't check over it so there may be spelling errors but that should do the trick.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #13  
Old 08-25-2004, 01:12 AM
prozac424242 prozac424242 is offline
Registered User
prozac424242's Avatar
Join Date: May 2001
Location: Gone crazy: back soon
Posts: 356
prozac424242 is on a distinguished road
Send a message via ICQ to prozac424242 Send a message via AIM to prozac424242
THanks, I got it to work!

Interesting that the first two paramaters have to be 0.
__________________

Useful links:
Graal Stats
Client Script Functions-GS1 to GS2
Serverside Script Functions-Gscript page
Particle Engine-Player Attributes
Server Options-Admin rights-Gmaps
Quote:
Originally Posted by Admins
Thanks for developing and improving playerworlds and such
Reply With Quote
  #14  
Old 08-25-2004, 06:00 PM
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
Quote:
Originally Posted by prozac424242
THanks, I got it to work!

Interesting that the first two paramaters have to be 0.
They don't have to be - it just doesn't make sense to throw in (more) irrelevant, unused values.

In the new scripting engine, this is much simpler.

Last edited by Lance; 08-25-2004 at 06:14 PM..
Reply With Quote
  #15  
Old 08-25-2004, 03:05 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Yeh well when u trigger something serverside u do 0,0 so it hits the npc server
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #16  
Old 08-25-2004, 03:08 PM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
I believe its automatically set , esp sence GScript is a 3rd party scripting engine

~Sern
Reply With Quote
  #17  
Old 08-25-2004, 08:31 PM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Quote:
Originally Posted by ZeroTrack
I believe its automatically set , esp sence GScript is a 3rd party scripting engine

~Sern
How is it third party?
Reply With Quote
  #18  
Old 08-25-2004, 10:56 PM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
Quote:
Originally Posted by Rick
How is it third party?
I believe it uses delphi or C to covert the engine
Reply With Quote
  #19  
Old 08-25-2004, 03:34 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Yeah well i knew my statement wasnt the actual reason it just made me feel better since it basically made sense
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #20  
Old 08-25-2004, 08:01 PM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
Easiest way to do it with putnpc2 is just join it with a class npc
Reply With Quote
  #21  
Old 08-25-2004, 11:20 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
yeah gscript is based on a different scripting language and has builtin commands that basically makes it 3rd party
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #22  
Old 08-26-2004, 01:49 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Wrong expression/words for that context.
Reply With Quote
  #23  
Old 08-26-2004, 03:04 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
hows that?
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #24  
Old 08-26-2004, 06:33 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Third party means that it was developed outside of the team/company that made the original product.

Such as Graal User Statistics (Graal.us) is third party software for GraalOnline.
Reply With Quote
  #25  
Old 08-26-2004, 05:00 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Oh I'm probably thinking of some other word that has the definition that i said but het cant blame me for my stupidity!
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #26  
Old 08-26-2004, 07:13 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Quote:
Originally Posted by falco10291029
Oh I'm probably thinking of some other word that has the definition that i said but het cant blame me for my stupidity!
No, neither can you blame those that crashed into Twin Towers
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
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 02:06 AM.


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