SphereCommunity

Full Version: Spell and Run
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Guys, How are you?

I'm trying to make my pet use spell and walk at the same time. Someone know how to do that?
The script i'm using to make the spell and the go function is down there, but when i use magic and try to make the pet walk the magic is cancelled.

PHP Code:
[SPEECH fala_galinha]

// the speech to make it use spell
ON=*use bola de fogo*
    
    IF (<
ISMYPET>)
          IF (<
MAGIAFOGO> >=100 )    
            
SRC.CTAG.NPCCast.Src=<UID>
            
SRC.TARGETF f_npc_boladefogo
             
Return 1
        
ENDIF
    ENDIF

// the speech to make pet go where i want
ON=*VAI PARA LA*

    IF (<
ISMYPET>)    

        
SRC.CTAG.VAI.Src=<UID>
        
SRC.TARGETFG f_npc_vaiparala
        
return 1
    
ENDIF


// the function to use the fireball magic
[FUNCTION f_npc_boladefogo]
IF (<
ARGO.ISCHAR>)
  
REF1=<CTAG0.NPCCast.Src>
  IF (<
REF1.ISMYPET>)
    
REF1.TAG.ELEMENTOFOGO 1
    REF1
.TAG.DIFICULDADE 100
    REF1
.NPCCAST <DEF0.s_boladefogo>,<ARGO>
      ENDIF
ENDIF

CTAG.NPCCast.Src=


// the function to pet go where i want

[FUNCTION f_npc_vaiparala]

  
REF1=<CTAG0.VAI.Src>
  
REF1.GOTO <TARGP


Thanks for the support.
I never played with "scripted" NPC actions because usually it's not a good idea replace the internal AI actions with any kind of scripted behavior (it will mess the AI action). But anyway, I think it's not possible make the NPC walk and cast spells at the same time because to make it walk you need to set ACTP and start action 074 ("runningto") and to make it cast spells you must set ACTPRV, ACTARG1 and start action 25 ("skill_magery"), so one action will override the other. Even if you call ATTACK function it will probably also override the previous action

long story short: NPC AI can't handle 2 actions at the same time
Reference URL's