Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Projectile Hit Detection (https://forums.graalonline.com/forums/showthread.php?t=134266202)

xAndrewx 04-08-2012 01:43 PM

Projectile Hit Detection
 
1 Attachment(s)
When a projectile is fired (using shoot) and hits a wall on the serverside it calls this function in the Control-NPC

HTML Code:

function onActionProjectile(x, y, shootparams) {
but then the bullet doesn't disappear from the client. It still carries on flying past, even though it's hit an object.

Check the screenshot- the bullet hit the tree (fire starts on impact of hitting the tree on the serverside) but the bullet is still flying past.

Skyld 04-08-2012 01:54 PM

Does the tree have the same setshape both clientside and serverside? I think I remember issues with this when setshape was used both serverside and clientside with different values.

fowlplay4 04-08-2012 05:35 PM

I was under the impression that server-side hit detection is irrelevant to what the client actually sees since the client is basically simulating the shot on their screen, so if the blocking isn't the same on the client-side you'd see scenarios like that.

cbk1994 04-08-2012 05:50 PM

Quote:

Originally Posted by fowlplay4 (Post 1691482)
I was under the impression that server-side hit detection is irrelevant to what the client actually sees since the client is basically simulating the shot on their screen, so if the blocking isn't the same on the client-side you'd see scenarios like that.

This is correct.

xAndrewx 04-08-2012 06:27 PM

It not just happens on objects, it also happens on players too.

No real fix then? :[

cbk1994 04-08-2012 06:42 PM

Quote:

Originally Posted by xAndrewx (Post 1691492)
It not just happens on objects, it also happens on players too.

No real fix then? :[

I don't think it's broken..? As has been explained, you probably have different blocking policies on serverside than clientside (e.g. noplayerkilling on clientside but not serverside, different shapes on serverside, etc).

xAndrewx 04-08-2012 07:14 PM

Oh I see- darn

thanks

xXziroXx 04-08-2012 08:07 PM

Would be nice if there was a command to make players blocking/not blocking for projectiles. As it is now, scripting your own projectile system is mandatory if you want to have non-blocking players on clientside.

cbk1994 04-08-2012 08:20 PM

Quote:

Originally Posted by xXziroXx (Post 1691501)
Would be nice if there was a command to make players blocking/not blocking for projectiles. As it is now, scripting your own projectile system is mandatory if you want to have non-blocking players on clientside.

You can use noplayerkilling on clientside, but then players can walk through other players, which may not be what you want. I really do wish we had more customizable projectiles.

xXziroXx 04-08-2012 08:36 PM

Quote:

Originally Posted by cbk1994 (Post 1691502)
You can use noplayerkilling on clientside, but then players can walk through other players, which may not be what you want. I really do wish we had more customizable projectiles.

noplayerkilling on clientside makes projectiles behave different on each players screen, since every other player will be non-blocking for them. It creates some very annoying situations for an online game.

Gunderak 04-09-2012 11:23 AM

Having the same issue.
My fireball sets crops on fire then continues to pass.
http://www.wr3ckless.net/uploads/files/samehere.png

cbk1994 04-09-2012 01:02 PM

Quote:

Originally Posted by Gunderak (Post 1691564)
Having the same issue.
My fireball sets crops on fire then continues to pass.

Have you tried the solutions presented in this thread?

Gunderak 04-10-2012 03:59 AM

Yes, and it has the exact same setshape on the client and serverside.

cbk1994 04-10-2012 04:01 AM

Quote:

Originally Posted by Gunderak (Post 1691648)
Yes, and it has the exact same setshape on the client and serverside.

Post your code.

Gunderak 04-10-2012 04:02 AM

I'm not actually on my computer at the moment, I'm in these forums on my iPhone.
In fact I'm not even home lol..

cbk1994 04-10-2012 04:31 AM

Quote:

Originally Posted by Gunderak (Post 1691650)
I'm not actually on my computer at the moment, I'm in these forums on my iPhone.
In fact I'm not even home lol..

I can wait.

Gunderak 04-10-2012 09:51 AM

PHP Code:

function onActionProjectile(){
  if(
params[0] == "fireball"){
    if(
this.attr[5] == null){
      
this.attr[5] = "wheat_fire.gani";
      
scheduleevent(9"onStop");
    }
  }
}
function 
onCreated(){
  
this.setimg("corinthia_wheat.png");
  
this.setshape(03232);
  
this.maker null;
}
//Then there is some chopping down code for harvesting wheat
//#CLIENTSIDE
function onCreated(){
  
this.setshape(03232);



cbk1994 04-10-2012 01:16 PM

It should be setshape(1, 32, 32). Not sure if that will fix it, but besides that everything looks fine. Does it block on clientside when you try to walk through it?

Gunderak 04-10-2012 01:57 PM

No it does not block on the clientside.
It's wheat lol..
Just out of curiosity; what does the first paramater of setshape do?

Tolnaftate2004 04-10-2012 06:24 PM

Quote:

Originally Posted by Gunderak (Post 1691678)
Just out of curiosity; what does the first paramater of setshape do?

It's the shape, 1 => rectangle.
There are no other shapes defined afaik.

Crow 04-10-2012 06:44 PM

Quote:

Originally Posted by Tolnaftate2004 (Post 1691688)
There are no other shapes defined afaik.

Yup, you're right about that.

Gunderak 04-11-2012 02:55 AM

So what does doing setshape(0 achieve o_O?

Tricxta 04-11-2012 03:46 AM

Quote:

Originally Posted by Gunderak (Post 1691730)
So what does doing setshape(0 achieve o_O?

nothing at all

Crow 04-11-2012 07:08 AM

Quote:

Originally Posted by Tricxta (Post 1691733)
nothing at all

That's not quite~ right. It should just set a rectangle shape like all the other setShape() calls, I believe. But using 1 as the type is the right thing to do.

Gunderak 04-11-2012 11:04 AM

cbk changing that didn't fix the issue.
Is there any other way that you think you could make the fireball go through each NPC and set it on fire and continue passing; setting anything in it's path on fire?

cbk1994 04-11-2012 12:33 PM

Quote:

Originally Posted by Gunderak (Post 1691766)
cbk changing that didn't fix the issue.
Is there any other way that you think you could make the fireball go through each NPC and set it on fire and continue passing; setting anything in it's path on fire?

No, this is not how projectiles work on Graal. You'd have to rescript them.

And if they're not blocking clientside, that's your problem.

Gunderak 04-11-2012 02:12 PM

darn

Admins 04-14-2012 08:55 PM

setshape first parameter:
0 - disable
1 - rectangle
2 - tile based (requires setshape2())
Update: I've updated the description on wiki.graal.net for setshape and setshape2.

ffcmike 04-14-2012 09:14 PM

If possible it would be useful to be able to set shapes in the same way as polygon displays.

BlueMelon 04-14-2012 09:44 PM

Quote:

Originally Posted by ffcmike (Post 1692103)
If possible it would be useful to be able to set shapes in the same way as polygon displays.

You mean like showpoly?
That would be pretty cool.


All times are GMT +2. The time now is 11:41 PM.

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