![]() |
move()
PHP Code:
P.S. Yeah, I basically rescripted offline movement to GS2 with move(). And yeah, anyone could use this script for there own server.. assuming it worked correctly =[. |
/bump
help please =[ |
We need more details, what do you mean "weird"?
|
The gani keeps setting because it isn't finishing the movement. I even tried setting walk only once, still happens.
|
You mean the gani is 'stuck' on the first frame?
Probably because it's being set in a timeout, try doing something like: if (this.gani!="walk") setcharani("walk",); or however it'd be done in GS2. |
Quote:
Quote:
|
I made a move() tutorial awhile back, I'll upload it when I find it, it's in another move() thread I believe.
Found it. It was for making a baddy move but it may help, here you go. move(x,y,time,options); x = move how far from current position horizontally y = move how far from current position vertically time = time it takes to get from starting point to ending point options = cachtype(0,1,2) blockcheck(4) eventwhendone(8) applydir(16) blockcheck = test to see if the tile is blocking or not eventwhendone = stops moving after one movement. other wise the NPC will move forever in that direction. applydir = if the the char current gani has 4 dir it will apply it when it moves Here's a NPC I use for a townsfolk randomly move PHP Code:
|
Quote:
|
Quote:
That's what he said. |
eventwhendone = stops moving after one movement. other wise the NPC
will move forever in that direction. ? |
No..
eventwhendone = true; onMovementFinished() will be called. eventwhendone = false; onMovementFinished() will NOT be called. |
Quote:
|
Quote:
|
Also, the definition you posted for the time param is wrong as well. That param is reserved for how many tiles it moves per a certain amount of time I am not sure of at the moment.
|
Quote:
Quote:
|
Quote:
What do you think the two first parameters are for? Just for looks? They decide how FAR it will move. |
Test it >_> the x and y are like the slope of the direction to move, the npc goes on forever without 8 in the options part.
|
From newfeatures2001:
PHP Code:
|
Quote:
Quote:
|
Quote:
|
Quote:
|
I haven't used move() in like 2 years, I couldn't comment.
|
Quote:
|
Quote:
|
Well it was in a timeout, that's what kept it going.
|
Quote:
|
Why are people even using move()? Seems like a custom move() scripting would be simpler, and much more effective ...
|
Move keeps the movement of the NPC smooth on the serverside, I don't think there's a way to replicate that.
|
HTML Code:
else |
But that isn't the problem.
For some reason, when a move() resets.. the gani resets. This should be fixed by stefan, if anything. |
no it doesn't...?
HTML Code:
function onCreated() |
Quote:
|
You'll probably have to change the gani's outside of the move.
|
Quote:
|
Quote:
What move actually does, like shoot, is run a clientside effect. You are not actually seeing the npcs current position serverside. Many of the new scripts in classic that we do achieve the same thing. The actual visual movement is scripted clientside (to appear smooth), but positioning and other such things are kept serverside. It makes for a much more visuably pleasing effect, and cuts down processing power on this server. The npc's acutal x,y, after doing a series of moves in the same tic, will be the end result. if you try to get the position in the same tic (cycle, function, whatever) you used move, it will still be at the origin until the next tic. |
How do you keep it synced with the serverside data though?
|
Quote:
P.S. How do you send serverside data to a client for a specific npc? |
Quote:
|
Well definitely would be the actual coordinates of the NPC, so players aren't seeing the NPC in two different locations because of local lag.
|
Quote:
|
| All times are GMT +2. The time now is 04:11 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.