Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   The GK bow (https://forums.graalonline.com/forums/showthread.php?t=51343)

Gman4pwnu 02-26-2004 03:28 PM

The GK bow
 
its cool, im wondering what commands are needed to get somethin like it.

I know this.angle=getangle(mousex-playerx,mousey-playery); gives you the angle the mouse is pointin at, but how do I get like to power it needs?

Btw, i dont know any sine or cosine, havn't taken trig yet. Or whatever sine and cosine are taught in

Dach 02-26-2004 04:34 PM

use shoot, it's in newfeatures and most updated commands.rtf, but if you don't get it search the forums I'm sure it's been explained in detail before
Also check out the arrow gani in Graal shop and the image to see how that works. Well that's about it other than handing you an algorithm, see how far you get.

Gman4pwnu 02-26-2004 10:26 PM

I know how to use shoot. I just need an algorithm for the z and the power to match mouse location.

Python523 02-27-2004 02:24 AM

Problem solving is a valuble skill; learn it.

Goboom 02-27-2004 02:54 AM

Try getting from point A to point B before comming here (point C). ;)

Dach 02-27-2004 03:46 AM

Quote:

Originally posted by Gman4pwnu
I know how to use shoot. I just need an algorithm for the z
you mean the z value you give in the shoot function after the x and y? that is the player's z, it's part of the initial position of your projectile

Quote:

and the power to match mouse location.
Ouch, that requires knowledge of some (basic) physics, I won't give this to you since most likely you'll just copy and paste and that takes all the fun out of me teaching it to you ;) , meh there have been some decent bow scripts posted on here anywho

hmm, I just realized I never finished my physics tutorial on projectiles... darn

Duwul 02-27-2004 04:54 AM

I remember seeing an arrow game you made where you click the target and it shot the arrow at it. You had an equation for the power, it was too confusing for me at the time. =X

ZeLpH_MyStiK 02-27-2004 05:05 AM

I think he meant the z angle when he mentioned 'z'. Well anyways, I doubt GK bows have different angles so you can set the z to a constant angle, something like pi/6. The power is sort of hard to explain...i'll try to come up with an easy way of explaining it later =\

Dach 02-27-2004 06:33 AM

Quote:

Originally posted by ZeLpH_MyStiK
I think he meant the z angle when he mentioned 'z'. Well anyways, I doubt GK bows have different angles so you can set the z to a constant angle, something like pi/6. The power is sort of hard to explain...i'll try to come up with an easy way of explaining it later =\
pi/4 will give you the greatest disance on level ground ;)

that power algorythm I made was a bit more complicated than I inititially thought it would be... ohwell

WanDaMan 02-27-2004 03:10 PM

You know some stuff, but you don't know how to do that? :p

Polo 02-27-2004 03:46 PM

(Note: I don't have Graal installed here, so I cannot check the definition of power within the shoot command. As a result i'm giving pointers to 2 solutions, so pick whichever one is relevant for the shoot command (ie: whether power is launch velocity or distance to travel))

Solution One - Velocity Based
If power is related to the speed at which the projectile is launched, then the distance travelled if i remember correctly would be proportional to power^2. As I dont know how close the Graal physics are to real life, I can't verify that, nor am I able to give you any constants, as I do not know what constants graal uses internally. You can rearrange to find power from distance fairly easily.

Solution Two - Distance Based
If the power is related to how far you want it to travel, then you can use a rearrangement of the pythagorous theorem to calculate the distance.

If you still need help after this, send a Forum PM, or drop me an e-mail.

WanDaMan 02-27-2004 05:21 PM

We was doing about Velocity In science today, It's interesting.

XxDarkrazorxX 02-27-2004 08:03 PM

newfeatures2004-V3:

- new script variable 'gravity': when you
change that variable then the behaviour
of projectiles changes - by default the z attribute
of a projectile is decreased by 2 each second
(0.1 each frame); if you increase the gravity,
then the arrows fall down faster, if you decrease
the gravity then arrows fly longer; if you
decrease the gravity and shoot it in a low angle
(between 0 and 0.5) you can easier simulate
pistoles or guns;
don't forget to change the gravity variable on both
client and server side

Dach 02-27-2004 08:39 PM

Quote:

Originally posted by XxDarkrazorxX
newfeatures2004-V3:

- new script variable 'gravity': when you
change that variable then the behaviour
of projectiles changes - by default the z attribute
of a projectile is decreased by 2 each second
(0.1 each frame); if you increase the gravity,
then the arrows fall down faster, if you decrease
the gravity then arrows fly longer; if you
decrease the gravity and shoot it in a low angle
(between 0 and 0.5) you can easier simulate
pistoles or guns;
don't forget to change the gravity variable on both
client and server side

shouldn't use that just to affect how far a projectile goes :\
it is meant more for shooting in areas of different gravity (obviously) or when shooting something heavy (as in pertaining to the air resistance really, like a cannonball or something)

Polo 02-28-2004 01:08 AM

Quote:

Originally posted by Dach
...or when shooting something heavy (as in pertaining to the air resistance really, like a cannonball or something)
Actually a cannonball doesn't accelerate towards the ground any faster than say, a small pebble. The density of an object doesn't affect its falling speed.

Sorry... but I had to be fussy :P


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

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