Skip to content

AI Script: Follow Leader, still maintain other functions (including Stealth).

1MMRAM1MMRAM Member Posts: 4
With my very basic attempts so far, I'm having a hard time combining effects such as MoveToObject(Player 1) or MoveToObjectFollow(Player1), etc, while still processing other functions like remaining in stealth (MTO seems to preserve stealth state, but MTOF leaves it), or other IF/THEN combat statements. Is there some way to have a hierarchy of actions?

What's I'd like is something like this:

1. If stealth is available, enter stealth
2. Run attack functions when enemies are in range
3. Move to Player 1 if past certain distance

As it stands, the first two functions only resolve when the third completes entirely. Irritatingly MoveToObject also constantly pushes Player1 around, while MTOF() and Formation() seem to be constant states that don't process other parts of the script until they are ended.

Any tips or direction appreciated!

Comments

  • kjeronkjeron Member Posts: 2,367
    IF
    	See([ENEMY])
    THEN
    	RESPONSE #100
    		AttackOneRound(LastSeenBy(Myself))
    END
    IF
    	ActionListEmpty()
    	!ModalState(STEALTH)
    THEN
    	RESPONSE #100
    		Hide()
    END
    IF
    	!Range(Player1,30)
    THEN
    	RESPONSE #100
    		MoveToObjectOffset(Player1,[5.0])
    END
    ?
    1MMRAM
  • 1MMRAM1MMRAM Member Posts: 4
    Thanks for the guidance.

    I gather I can't have another function evaluate while MoveToObject*() is in process though? Just testing it now, stealth disengages when MoveToObjectOffset() starts and doesn't reinitialise until Player2 reaches Player1. I was envisioning an overriding imperative to re-enter stealth regardless of any other action currently in process, but that might be beyond the scope of the scripting language here.
  • kjeronkjeron Member Posts: 2,367
    edited May 2018
    That's what I get for testing without sound, try:
    FollowObjectFormation(Player1,1,1)
    1MMRAMJuliusBorisov
  • 1MMRAM1MMRAM Member Posts: 4
    FollowObjectFormation() along with dropping the ActionListEmpty() trigger on Hide() did the trick. Thank you!
  • ShadowMShadowM Member Posts: 573
    I'm having a similar issue with detect mode.
    FollowObjectFormation / ActionListEmpty
    Are these nwnx functions?
  • kjeronkjeron Member Posts: 2,367
    @ShadowM
    This issue was related to the Infinity Engine (BG/IWD), not Aurora Engine(NWN), it was just posted in wrong forum (not that the Infinity Engine has a scripting subforum).
    JuliusBorisov
  • ShadowMShadowM Member Posts: 573
    kjeron said:

    @ShadowM
    This issue was related to the Infinity Engine (BG/IWD), not Aurora Engine(NWN), it was just posted in wrong forum (not that the Infinity Engine has a scripting subforum).

    Yep, after doing some searches I realized that , thanks though :)
    JuliusBorisov
  • TressetTresset Member, Moderator Posts: 8,262
    Moved to the IE modding forum.
    JuliusBorisov
Sign In or Register to comment.