Help with script / Action

bob_the_builder

Well-Known Member
This is what I am trying to use. Problem is it loops once through each action then never goes past Action 1

Code:
function Combat_Init()
{
        Action[1]:Set[Nuke2]
	SpellRange[1,1]:Set[61]

	Action[2]:Set[Nuke1]
	SpellRange[2,1]:Set[60]

	Action[3]:Set[Melee_Attack1]
	SpellRange[3,1]:Set[151]

	Action[4]:Set[Melee_Attack2]
	SpellRange[4,1]:Set[152]
}
And then my combat:

Code:
function Combat_Routine(int xAction)
{
	AutoFollowingMA:Set[FALSE]
	if ${Me.ToActor.WhoFollowing(exists)}
	{
		EQ2Execute /stopfollow
	}

	switch ${Action[${xAction}]}
	{
		case Nuke1
			if ${Me.Ability[${SpellType[${SpellRange[${xAction},1]}]}].IsReady}
			{
				call CastSpellRange ${SpellRange[${xAction},1]} 0 0 0 ${KillTarget}
				eq2echo Nuke1 Action ${xAction}
			}
			break
			
		case Nuke2
			if ${Me.Ability[${SpellType[${SpellRange[${xAction},1]}]}].IsReady}
			{
				call CastSpellRange ${SpellRange[${xAction},1]} 0 0 0 ${KillTarget}
				eq2echo Nuke2 Action ${xAction}
			}
			break

		case Melee_Attack1
			if ${Me.Ability[${SpellType[${SpellRange[${xAction},1]}]}].IsReady}
			{
				call CastSpellRange ${SpellRange[${xAction},1]} 0 1 0 ${KillTarget}
				eq2echo Melee_Attack1 Action ${xAction}
			}
			break
		case Melee_Attack2
			if ${Me.Ability[${SpellType[${SpellRange[${xAction},1]}]}].IsReady}
			{
				call CastSpellRange ${SpellRange[${xAction},1]} 0 1 0 ${KillTarget}
				eq2echo Melee_Attack2 Action ${xAction}
			}
			break

		Default
			xAction:Set[4]
			break
	}
}
Seems to go through each action once then gets stuck in action 1

Bob
 

Pygar

EQ2Bot Specialist
Couple things...

Echo your ${xAction} before the switch case, would like to see if the number increments as expected.

What happens is eq2bot calls combat_routine 40 times, with xaction incrementing each time. The expected behavior is when there is no action defined for the xaction on the call, the loop does nothing, just wasted cycles, or on a healer, it checks heals a lot. However, I've not debugged this, its feasable it uses the last action in the switch if the current action is null, till it gets to an action that is defined again.... if that makes any sense.

Anyway, I added something to eq2bot very recently in an attempt to stop all these excess cycles.

change your default case to this:
Code:
   Default
      return "Melee Complete"
I updated eq2bot to check for this return value from the combat function, and if it is returned, it will jump the combat loop to the end so it will restart.

I've not had time to test, but my expected result, is when the switch is called with an undefined action, it should use the default case and return the value eq2bot is checking for.

If that isn't the observed behavior, let me know and I'll look into it further, but that is how I expect lavish to react.
 

bob_the_builder

Well-Known Member
Maybe I just dont want to use action. Would this accomplish the same thing as action, checking each ability:

Code:
  if  $(OffenseMode)
    {
    if ${Me.Ability[${SpellType[61]}].IsReady}
      call CastSpell 61 0 0 0 ${KillTarget}
			
    if ${Me.Ability[${SpellType[60]}].IsReady}
      call CastSpell 60 0 0 0 ${KillTarget}	
    if ${Target.Distance}<10
    {
       if ${Me.Ability[${SpellType[151]}].IsReady}
         call CastSpell 151 0 0 0 ${KillTarget}

       if ${Me.Ability[${SpellType[152]}].IsReady}
         call CastSpell 152 0 0 0 ${KillTarget}		
    }
    else
      call GetBehind
    }
 
Last edited:

Pygar

EQ2Bot Specialist
You can do something like that, I don't because it doesn't allow you for check for conditions between attacks.

Like maybe starting an HO, advancing an HO, checking for heals or cures between attacks, checking for aggro, checking for the killtarget being dead, etc, etc.

We set it up to 'pulse' thru combat for fairly sound reasons. There is nothing stopping you from using the method you describe, we've done it differently for what I feel are fairly sound reasons.
 
Top Bottom