I have been playing around with a script, but I am having problems. I try to drag the NPC using this script but it only triggers if I mouseup on the same spot it origonally was.. which is odd.. and when it triggers.. it triggers every NPC that is joined to the class.. anyone got any ideas whats wrong o.O
PHP Code:
function onActionServerside(command, nx, ny) {
chat = command;
}
//#CLIENTSIDE
function onCreated() {
this.catchEvent(GraalControl, "onMouseDragged", "onMouseDragged");
setshape2(1, getimgwidth(this.image), getimgheight(this.image));
}
function onMouseDown() {
if ( mousex in |x,x+getimgwidth(this.image)/16| && mousey in |y,y+getimgheight(this.image)/16| ) {
this.ox = mousex - x;
this.oy = mousey - y;
this.candrag = true;
// clicked on it
}
}
function onMouseUp() {
this.candrag = false;
triggeraction(mousex, mousey, "Serverside", "test");
}
function onMouseDragged(obj, mod, mx, my) {
if ( this.candrag = true ) {
//triggeraction(x, y, "Serverside", "test");
x = mousex - this.ox;
y = mousey - this.oy;
}
}
I have tried triggering at the following cords:
PHP Code:
this.ox, this.oy
mousex, mousey
x, y
With no luck, both before and after updating the x/y values.