SphereCommunity
NPC Follow/Guard - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: NPC Follow/Guard (/Thread-NPC-Follow-Guard)



NPC Follow/Guard - Staff_Stanic - 05-16-2013 03:51 AM

It's possible to do a NPC follow or Guard another one?
Thanks xD


RE: NPC Follow/Guard - Gil Amarth - 05-16-2013 07:36 PM

It is possible, yes. But you have to script it. I use this system (it´s in spanish, sorry).

Code:
[ITEMDEF i_memory_npc_seguir]
ID = i_memory
NAME = Memoria de Seguir
TYPE = t_eq_script

ON=@EQUIP
    TIMER = 2
    TAG.PASOS = 1000            
    CONT.EVENTS +e_siguiendo
    
ON=@UNEQUIP
    CONT.ACTION=
    IF (<CONT.SPAWNITEM> == 0)
    CONT.TIMERF 300 HOMEDIST = 15
    ELSE
        CONT.TIMERF 300 CONT.HOMEDIST = <CONT.SPAWNITEM.MOREZ>            
        CONT.TIMERF 300 CONT.HOME = <CONT.SPAWNITEM.P>        
    ENDIF
    CONT.EVENTS -e_siguiendo
    
ON=@TIMER
    REF1 = <TAG.OBJETIVO_SEGUIR>
    IF (<REF1.ISCHAR>)
        IF (<REF1.DISTANCE <CONT.UID>> <= 15)
            IF (<TAG.PASOS> > 0)
                CONT.HOME = <REF1.P>
                CONT.ACTION = 06d
                IF !(<TAG0.NO_TIEMPO>)
                    TAG.PASOS -= 1
                ENDIF
                TIMER = 2
                RETURN 1
            ENDIF
        ENDIF
    ENDIF
    REMOVE
    RETURN 1
    
[EVENTS e_siguiendo]
ON=@ATTACK
    FINDID.i_memory_npc_seguir.REMOVE

ON=@GETHIT
    FINDID.i_memory_npc_seguir.REMOVE

You have to add this timer to the npc with the correct TAGs, TAG.OBJETIVO_SEGUIR and TAG.NO_TIEMPO, of course you can add more interrupts to the timer at the event.


RE: NPC Follow/Guard - Staff_Stanic - 05-17-2013 01:35 AM

I was thinking in something Hardcoded but I thing that don't exist =/
Thx Amarth =D