SphereCommunity
Is Character Moving ? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Is Character Moving ? (/Thread-Is-Character-Moving)

Pages: 1 2


Is Character Moving ? - EOSCPM - 04-02-2014 11:32 PM

Hi,

How can i check is character moving. I have an event and i wanna when character move under this event, saying IAM MOVING.

How can i do this ?


Best regards,
Thank you.


RE: Is Character Moving ? - XuN - 04-02-2014 11:38 PM

@RegionStep for characters.

@Step for regions.


RE: Is Character Moving ? - EOSCPM - 04-02-2014 11:46 PM

Hi,

I tried but not working.

[events e_test]
ON=@RegionStep
say test


There is no reaction when i walk with this event.


RE: Is Character Moving ? - XuN - 04-03-2014 12:14 AM

Right, it seems I dreamed about it ^^, forget it. There is only a region-based trigger: @Step.


RE: Is Character Moving ? - EOSCPM - 04-03-2014 12:22 AM

So, we can't handling player movement right ?


RE: Is Character Moving ? - XuN - 04-03-2014 12:58 AM

This trigger was never implemented because it would be so heavy in performance meanings, it was placed under region definition to limit it usage (I think).

What you can do is:

Adding r_regions_custom to EventsRegion in your sphere.ini

create [regiontype r_regions_custom]
ON=@Step
src.say I'm moving


RE: Is Character Moving ? - wuffel - 04-03-2014 04:19 AM

itemdef i_memory_moving
id=i_memory

on=@timer
morep= <cont.p> // for the last position, so you can check if last cont.p changed from last timer to new timer. you can also you tags for this.


serv.log <cont.p>

timer=1 // or timerd=something
return 1


RE: Is Character Moving ? - Coruja - 04-04-2014 04:40 AM

you can check for FLAG statf_fly, it works when the chars is running, but not when just walking

Code:
IF (<FLAGS> & statf_fly)
  ...
ENDIF



RE: Is Character Moving ? - JohnVeritas - 04-06-2014 11:43 AM

Well another idea from me;

Under sphere.ini add this packet

PACKET2=f_moving

[function f_moving]
obj=<local.char>
if (<obj.isevent.<yourevent>)
obj.trigger @move
endif

and under your custom event;

on=@move
src.sayua 048,6,6,0 I AM MOVING // think this one is green Smile

Let me know if it works ^_^


RE: Is Character Moving ? - Coruja - 04-07-2014 05:00 AM

im quite sure JohnVeritas code will work fine
Code:
PACKET2=f_moving  //add this line on sphere.ini

[FUNCTION f_moving]
UID.<LOCAL.CHAR>.TRIGGER @Move
this will call the trigger @Move when you move, so now you just need to add @Move on your event

but as XuN already said, doing a script/check like this will cause heavy load on sphere and your server will waste much performance. Just imagine if 1 char walk 1000 steps, it will call 1000x @Move. Now imagine 50 chars walking taking 1000 steps at the same time, it's 50.000x @Move