SphereCommunity
Knockback - wall check - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Knockback - wall check (/Thread-Knockback-wall-check)



Knockback - wall check - tleilax - 09-09-2012 11:01 PM

Hello,

I hope I can get some ideas how to script knockback.

Knockback itself isn't such a problem, but checking players not to fall through walls/impassable tiles is something that I currently cannot think of any solution.

Is there any hardcoded check for this or can anyone point me in right direction?


RE: Knockback - wall check - Shaklaban - 09-09-2012 11:36 PM

you can try canmove function:

if <canmove n>
say i can move to north
endif


RE: Knockback - wall check - Rayvolution - 09-10-2012 01:23 PM

This is my server's "Knockback" enchantment, written by EXTREME. It works pretty well. Wink

There's 3 levels, Minor, Moderate and Major. All it really does is raise the chance to knockback.

It's designed to be applied to a weapon, so if you just want to apply it to a monster/NPC directly, simplypull the ON=@DAMAGE portion out of the TYPEDEF and stick it on the monster/NPC or it's EVENTS script. Smile

Code:
[TYPEDEF E_WEAPON_ENCHANT_KNOCKBACK_MINOR]
ON=@DAMAGE
IF <R1,10> == 1
SRC.KNOCKBACK <TOPOBJ.DIR>
SRC.EFFECT 3,i_fx_glow_spike,1,17,0
SRC.SOUND 314
ENDIF

[TYPEDEF E_WEAPON_ENCHANT_KNOCKBACK_MODERATE]
ON=@DAMAGE
IF <R1,5> == 1
SRC.KNOCKBACK <TOPOBJ.DIR>
SRC.EFFECT 3,i_fx_glow_spike,1,17,0
SRC.SOUND 314
ENDIF

[TYPEDEF E_WEAPON_ENCHANT_KNOCKBACK_MAJOR]
ON=@DAMAGE
IF <R1,2> == 1
SRC.KNOCKBACK <TOPOBJ.DIR>
SRC.EFFECT 3,i_fx_glow_spike,1,17,0
SRC.SOUND 314
ENDIF

[FUNCTION KNOCKBACK]
IF <ARGS>
LOCAL.DIR <EVAL <ARGS>+4>
IF <dLOCAL.DIR> > 7
  LOCAL.DIR -= 8
ENDIF
ELSE
LOCAL.DIR <DIR>
ENDIF
DOSWITCH <dLOCAL.DIR>
BEGIN
  IF (<CANMOVE S>)
   MOVE S
  ENDIF
END
BEGIN
  IF (<CANMOVE SW>)
   MOVE SW
  ENDIF
END
BEGIN
  IF (<CANMOVE W>)
   MOVE W
  ENDIF
END
BEGIN
  IF (<CANMOVE NW>)
   MOVE NW
  ENDIF
END
BEGIN
  IF (<CANMOVE N>)
   MOVE N
  ENDIF
END
BEGIN
  IF (<CANMOVE NE>)
   MOVE NE
  ENDIF
END
BEGIN
  IF (<CANMOVE E>)
   MOVE E
  ENDIF
END
BEGIN
  IF (<CANMOVE SE>)
   MOVE SE
  ENDIF
END
BEGIN
  IF (<CANMOVE S>)
   MOVE S
  ENDIF
END
ENDDO



RE: Knockback - wall check - tleilax - 09-11-2012 11:36 PM

Thanks, rayvolution. Knockback works. But my character can be knocked through doors, walls and other impassable stuff.

Is anything set wrong in my sphere.ini or something?

Edit: My bad, for players with plevel 0 it works like a charm. Thanks a lot!


RE: Knockback - wall check - Rayvolution - 09-12-2012 07:38 AM

hehe, yeah, GMs totally ignore walls/non-passable objects. The only reason GMs even "stop" when they hit a wall is because the client says no, not the server. Tongue

So, in the case of GMs, they always pass the "Canmove" check no matter what. Wink