Graal Forums

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

wild8900 08-02-2008 11:45 AM

Serverside onActionProjectile?
 
I cant seem to get it working on serversided scripts. Dont tell me Ill have to use a bunch of triggeractions !pissed!

cbk1994 08-02-2008 03:02 PM

Yeah, I was having this problem a while back. Did you use setshape() on serverside?

EDIT: Do you mean onActionProjectile() for players, or for an NPC?

wild8900 08-02-2008 10:00 PM

An NPC that uses showcharacter(). Ill try the setshape when I get back from work :O

Stryke 08-02-2008 11:06 PM

Yeah, it doesn't seem to work on the serverside. What I did was just use a triggeraction.

TheStan 08-03-2008 12:56 AM

I believe the proper function is onActionProjectile2()

Crow 08-03-2008 01:10 AM

I think it's onActionSProjectile(). Almost sure ;f

Nevermind, that's for serverside projectiles, says the wiki :oo:
onActionProjectile() triggers on serverside when a "projectile has landed". There doesn't seem to be an event when something is hit for serverside stuff, guess you have to do those checks yourself ;P

cbk1994 08-03-2008 01:19 AM

Quote:

Originally Posted by TheStan (Post 1410965)
I believe the proper function is onActionProjectile2()

That's for when a projectile lands, anywhere.

Chompy 08-03-2008 01:30 AM

Quote:

Originally Posted by cbk1994 (Post 1410971)
That's for when a projectile lands, anywhere.

When does projectiles land? I thought they crashed..

cbk1994 08-03-2008 01:56 AM

Quote:

Originally Posted by Chompy (Post 1410974)
When does projectiles land? I thought they crashed..

:blush:

Pheonixfire 08-03-2008 04:28 AM

You might be able to use an OnActionProjectile() clientside and then use a triggeraction() in response. That works for weapons... But it may be different for showcharacter NPCs.

wild8900 08-03-2008 04:56 AM

ergh doing setshape didn't fix it, and yes its a clientside projectile hitting a serverside npc.

Pheonixfire 08-03-2008 05:19 AM

Allow me to clarify. I would add a clientside section with the "function OnActionProjectile()" code, and inside that function put a triggerserver() for a weapon. You could try a triggeraction() since it's not a weapon, and put the onaction in the serverside part of the code. That should work...

wild8900 08-03-2008 06:42 AM

Ugh so I tried a trigger, why wont this work?
hurtenemy is a function I made in the serverside section of the script that does some other functions. I intentionally left out a few params on the triggeraction, just for testing purposes. Doesn't work though.
NPC Code:
function onActionClientproj() {
hurtenemy();
}
//#CLIENTSIDE
function onActionProjectile() {
triggeraction(x + 0.5, y + 0.5, "Clientproj");
}


TheStan 08-03-2008 07:56 AM

Uh, setshape on the clientside portion of the class of the npc then?

cbk1994 08-03-2008 08:21 AM

Quote:

Originally Posted by wild8900 (Post 1411041)
Ugh so I tried a trigger, why wont this work?
hurtenemy is a function I made in the serverside section of the script that does some other functions. I intentionally left out a few params on the triggeraction, just for testing purposes. Doesn't work though.
NPC Code:
function onActionClientproj() {
hurtenemy();
}
//#CLIENTSIDE
function onActionProjectile() {
triggeraction(x + 0.5, y + 0.5, "Clientproj");
}


As Stan said, set the shape, but also, you should use this.x and this.y since this is GS2.

Chompy 08-03-2008 12:17 PM

Quote:

Originally Posted by cbk1994 (Post 1411051)
As Stan said, set the shape, but also, you should use this.x and this.y since this is GS2.

You don't need to use this.x and this.y when there's no other scopes involved (This is for npcs, not for players). It's about personal preference.

Also, you need a setshape serverside for the serverside to detect triggers and a setshape clientside for the clientside to detect triggers

Quote:

Originally Posted by cbk1994 (Post 1410981)
:blush:

:]

Crow 08-03-2008 02:27 PM

onActionProjectile() triggers clientside when the player is hit with it. You should use onActionProjectile2() I guess, not sure if onActionProjectile() works for NPCs.
For onActionProjectile2():
params[0] is the x where the projectile lands
params[1] is the y
params[2 .. n] are the shoot paramaters (setShootParams() I think)

cbk1994 08-03-2008 05:51 PM

Quote:

Originally Posted by Chompy (Post 1411065)
You don't need to use this.x and this.y when there's no other scopes involved (This is for npcs, not for players). It's about personal preference.

People actually take that as personal preference? x_x

That's just being lazy in my opinion, and it can make it hard to go back and edit.

Chompy 08-03-2008 05:53 PM

Quote:

Originally Posted by cbk1994 (Post 1411099)
People actually take that as personal preference? x_x

That's just being lazy in my opinion, and it can make it hard to go back and edit.

Lazy? All scripters are lazy, so what's your point? =D

cbk1994 08-03-2008 05:55 PM

Quote:

Originally Posted by Chompy (Post 1411101)
Lazy? All scripters are lazy, so what's your point? =D

^^

Crow 08-03-2008 06:22 PM

Quote:

Originally Posted by cbk1994 (Post 1411099)
People actually take that as personal preference? x_x

That's just being lazy in my opinion, and it can make it hard to go back and edit.

I don't see anything wrong with it, and it's not really being lazy either. Sometimes it adds to the readability of a formula or something similar.

kingdom_90 08-03-2008 11:06 PM

I say it depends on what you do, like what you're working with. I would use this. if I were to handle with (alot of) other scopes.


All times are GMT +2. The time now is 01:35 AM.

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