Boat heading and movement.

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Sylar88
Posts: 113
Joined: Sun Feb 06, 2011 6:34 pm

Boat heading and movement.

Post by Sylar88 »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:
L2JDP Revision Number:

I made the following function that is supposed to "move" a boat with a given distance and a given change in its angle from a given anchor point ( x, y ). It basically calculates the new point based on the polar coordinate and returns the cartesian coordinates. With zero angle , isnt it supposed to go forward instead of turning ? Im testing it and it seems the ship is always turning randomply.

Code: Select all

public int[] calculatePoint2(int x, int y, int rotate, int distance)    {        int angle = (int) (boat.getHeading()/182.044444 + rotate);        if(angle > 360)            angle = angle -360;        if(angle < 0)            angle = 360 - angle;        int dx = (int) (Math.cos(angle)* distance);        int dy = (int) (Math.sin(angle)* distance);                int[] result = new int[2];        result[0] = x + dx;        result[1] = y + dy;        return result;    }
Someone who didnt bother reading the svn or ant manual and just waited for you to make him a visual guide for eclipse is not a guy that is willing to learn ... He is the definition of the leecher.
User avatar
tukune
Posts: 533
Joined: Sun Mar 29, 2009 2:35 pm
Location: Japan

Re: Boat heading and movement.

Post by tukune »

http://download.oracle.com/javase/1.4.2 ... 8double%29
public static double cos(double a)
Parameters:
a - an angle, in radians.
Sylar88
Posts: 113
Joined: Sun Feb 06, 2011 6:34 pm

Re: Boat heading and movement.

Post by Sylar88 »

HUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUGE THANKS :) Im so stupid i didnt read the declaration of the function.
Someone who didnt bother reading the svn or ant manual and just waited for you to make him a visual guide for eclipse is not a guy that is willing to learn ... He is the definition of the leecher.
User avatar
badboy29
Posts: 417
Joined: Fri Apr 24, 2009 5:34 am
Location: Brazil

Re: Boat heading and movement.

Post by badboy29 »

Also boat have missing sounds:

Code: Select all

itemsound.ship_5minitemsound.ship_1min

Code: Select all

GIRAN_SOUND5 = new PlaySound(0, "itemsound.ship_5min", 1, _boat.getObjectId(), GIRAN_DOCK.x, GIRAN_DOCK.y, GIRAN_DOCK.z); GIRAN_SOUND1 = new PlaySound(0, "itemsound.ship_1min", 1, _boat.getObjectId(), GIRAN_DOCK.x, GIRAN_DOCK.y, GIRAN_DOCK.z);
Aka UnHoly
Sylar88
Posts: 113
Joined: Sun Feb 06, 2011 6:34 pm

Re: Boat heading and movement.

Post by Sylar88 »

There are many things missing/wrong in the boats. Atm im in official files server checking the packets in the boat.
Someone who didnt bother reading the svn or ant manual and just waited for you to make him a visual guide for eclipse is not a guy that is willing to learn ... He is the definition of the leecher.
Post Reply