![]() |
Simple Poly Line (to mouse)
Okay this is an easy one, but for some reason I cannot get a line to draw to the players mouse from a given x/y of a npc.. Any suggestions here, i know its top left, top right, bottom right, and bottom left for the order of cords.. or am i wrong here?
PHP Code:
It seems to be twisting, but i cant get the cords working right, grr !! |
Try swapping x, y with x-(2/16), y - (2/16)
and your explanation sounds misunderstood, it's from point to point to point. |
ohh.. guess your right on point-to-point.. hmm
line kinds dissapears at certain angles.. is this normal tho? |
Quote:
|
Quote:
|
Quote:
|
|
So why does this NOT work?
PHP Code:
|
Quote:
|
Quote:
|
Nvm, problem solved. I used the DrawLine() custom function and it worked perfectly.. hmm now to redo the other script I had and use this new-found information.
Thanks everyone for the help. |
Well just using 2 (ox, oy, tx, ty) points works fine as well.
|
Quote:
Quote:
|
What's the reasoning for adding pi/2, getangle a fraud?
|
This doesnt seem to be choosing the random correctly..
PHP Code:
|
It's in radians, not degrees.
PHP Code:
You can also use degtorad but it's not recommended to use degrees in scripting anyway. |
edit: been said, but there is functionality in Graal to convert to and from it.
Functions: degtorad(degrees) radtodeg(degrees) I.e: this.angle = random(this.angle - degtorad(15), this.angle + degtorad(15)); |
oh, i guess i learn somethign every day XD
|
Quote:
|
PHP Code:
A degree is a value between 0 and 360, which we can write as [0,360]. A radian is a value between 0 and 2*pi, which we can write as [0,2*pi]. This is how degtorad would work:
(The way I wrote it in the code was divide by 180 then multiple by pi. Same thing.) radtodeg would just be the opposite. Also worth noting, 0 points to the right, and positive values rotate counterclockwise. |
Someone really needs to go through forum posts, categorize them, and organize them into a tutorial/documentation.
|
New problem, move() only works first time then stops.. any particular reason behind this?
PHP Code:
|
Quote:
|
so something like
PHP Code:
|
move doesn't work like that.
TServerNPC.move(float, float, float, int) - moves the npc smoothly - parameters: delta x, delta y, time options: cache type (0, 1-cache, 2-append) + blockcheck(4) + eventwhendone(8) + applydir(16) move(dx, dy, time, flags); I.e: PHP Code:
|
Quote:
|
Quote:
newmove -> onMovementFinished -> newmove -> onMovementFinished -> newmove -> ... If you only want to do it a certain amount of times, you could track it in a this variable which you start at say, 3, and then decrease every time the movement is finished. |
it looks like i have alot more scripting to do haha .. oh well im bored anyways
yeah it's only suspose to plan 3 moves and then move the paths.. then im gonna need onwall checks .. gah tho technically it's supose to continiously move.. maybe randomly pause a second or 2.. lol |
move() is the worst interpolation system EVER created.
When I get my main CPU back, I'll write a REAL interpolation system. I've already written one for Delteria, and it looks lightyears ahead of "move" and reduces server strain a lot. A .25 timeout looks just as good as a .05, and you don't have to deal with using that ****ty move() command where if you change your direction during the middle of the movement, it jumps around. You just do movement like normal, and set a certain attr to a certain value. Easy. |
Quote:
|
| All times are GMT +2. The time now is 06:49 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.