Kjulo Posted September 19, 2013 Share Posted September 19, 2013 To test it out, i made this codeKmod_Addition_Traits.OnPlayerUpdate= function(player) getPlayer():setY(getPlayer():getY() + 1); --move playerendBut the player dosen't move or change cordinates. I have even tried setting it to 0 instead of adding, but nothing happens. Link to comment Share on other sites More sharing options...
blindcoder Posted September 19, 2013 Share Posted September 19, 2013 When is this function called? Anything in the log?It looks like it should work. setY(0); will cause the game to crash. Link to comment Share on other sites More sharing options...
Kjulo Posted September 19, 2013 Author Share Posted September 19, 2013 When is this function called? Anything in the log?It looks like it should work. setY(0); will cause the game to crash.Events.OnPlayerUpdate.Add(Kmod_Addition_Traits.OnPlayerUpdate); Link to comment Share on other sites More sharing options...
RoboMat Posted September 19, 2013 Share Posted September 19, 2013 http://theindiestone.com/forums/index.php/topic/734- dida had the same problem, but blindcoder helped him apparently:function hack.doWarp(x, y) if hack.warp == true then -- special thanks to blindcoder for this line local wx, wy = ISCoordConversion.ToWorld(x, y, getPlayer():getZ()); getPlayer():setY(wy); getPlayer():setX(wx); endend Link to comment Share on other sites More sharing options...
Kjulo Posted September 19, 2013 Author Share Posted September 19, 2013 http://theindiestone.com/forums/index.php/topic/734- dida had the same problem, but blindcoder helped him apparently:function hack.doWarp(x, y) if hack.warp == true then -- special thanks to blindcoder for this line local wx, wy = ISCoordConversion.ToWorld(x, y, getPlayer():getZ()); getPlayer():setY(wy); getPlayer():setX(wx); endend local wx, wy = ISCoordConversion.ToWorld(getPlayer():getX() + 1, getPlayer():getY() + 1, getPlayer():getZ()); getPlayer():setY(wy); getPlayer():setX(wx);Do i translate it into this? still can't seem to get it working Link to comment Share on other sites More sharing options...
RoboMat Posted September 19, 2013 Share Posted September 19, 2013 Ah I see... I just noticed that he uses the Mouse Click Event hence he has to convert the coordinates! Sorry, my bad I had played around with teleporting too, but I guess it is a bit harder than setting the coordinates of the player. Can't help you unfortunately Link to comment Share on other sites More sharing options...
blindcoder Posted September 19, 2013 Share Posted September 19, 2013 When is this function called? Anything in the log?It looks like it should work. setY(0); will cause the game to crash.Events.OnPlayerUpdate.Add(Kmod_Addition_Traits.OnPlayerUpdate); I'm not quite sure whet OnPlayerUpdate is triggered.Try adding a print() or pzdebug() statement to check if the function is called at all. Link to comment Share on other sites More sharing options...
RoboMat Posted September 19, 2013 Share Posted September 19, 2013 OnPlayerUpdate is called quite often (maybe strapped to the FPS), but certainly not as frequent as OnTick. Link to comment Share on other sites More sharing options...
Kjulo Posted September 19, 2013 Author Share Posted September 19, 2013 OnPlayerUpdate is called quite often (maybe strapped to the FPS), but certainly not as frequent as OnTick. OnPlayerUpdate is called quite often (maybe strapped to the FPS), but certainly not as frequent as OnTick.I've tried moving the SetX, and onTick is also incredibly useful. Link to comment Share on other sites More sharing options...
RoboMat Posted September 19, 2013 Share Posted September 19, 2013 Does it give you any error? Btw. the usage of OnTick is discouraged in most cases because it might impact the performance. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now