Page 2 of 2

Re: Stop Movement on Boss Detection

Posted: Mon Aug 15, 2011 2:11 am
by rock5
Looks like it is running from something other than a mob. Maybe we should add a mob type check. Cgange the eval function to

Code: Select all

    function eliteEval(address)
		local target = CPawn(address)
		
		-- Check if mob
		if target.Type ~= PT_MONSTER then
			return false
		end
		
		-- Check hp against elite factor
		if( player.MaxHP * settings.profile.options.AUTO_ELITE_FACTOR > target.MaxHP ) then
		   return false
		end
		
		return true
	end
I changed it around a bit so it will be easier to add more checks if needed.

Re: Stop Movement on Boss Detection

Posted: Mon Aug 15, 2011 3:18 am
by whome
Thanks Rock for the help! Unfortunately when I used your code it got this error....

Code: Select all

Loaded waypoint path 8_Ostriches.xml
No return path with default naming 1-9SS/8_Ostriches_return.xml found.
We use the normal waypoint path 8_Ostriches.xml now.
GM detection started
Moving to waypoint #1, (4046, 7804)
[string "   elites()   "]:1: attempt to call global 'elites' (a nil value)
when I used this however, it worked.... at least it ran away, but it didnt stay away for long enough. It detected, ran away, then reseumed after it looped through several times. This is what I used...

Code: Select all

     function eliteEval(address)
            local target = CPawn(address)
            if( target.MaxHP > player.MaxHP * settings.profile.options.AUTO_ELITE_FACTOR ) then
               return true
            end
            return false
            end

            function elites()
            mob = player:findNearestNameOrId("Bronze Shell Scooray",nil,eliteEval)
            if mob then
	    print("Running away from "..(mob.Name or "<no name>"))
            __WPL:setWaypointIndex(1); -- put what you want to do here if elite nearby
            end
      end
Can I enter a pause somewhere for a set time?

Re: Stop Movement on Boss Detection

Posted: Mon Aug 15, 2011 5:24 am
by rock5
whome wrote:[string " elites() "]:1: attempt to call global 'elites' (a nil value)
I didn't say to delete the elites() function. I said to replace the eval function.

Code: Select all

<onload>
	function eliteEval(address)
		local target = CPawn(address)
		
		-- Check if mob
		if target.Type ~= PT_MONSTER then
			return false
		end
		
		-- Check hp against elite factor
		if( player.MaxHP * settings.profile.options.AUTO_ELITE_FACTOR > target.MaxHP ) then
		   return false
		end
		
		return true
	end

	function elites()
		mob = player:findNearestNameOrId("Bronze Shell Scooray",nil,eliteEval)
		if mob then
			print("Running away from "..(mob.Name or "<no name>"))
			__WPL:setWaypointIndex(1); -- put what you want to do here if elite nearby
		end
	end
</onLoad>

Re: Stop Movement on Boss Detection

Posted: Mon Aug 15, 2011 5:45 am
by whome
Doh, sorry, im such a dud when it comes to this stuff....... You guys are such whizzes :mrgreen: I am learning a little by little, slowly, slowly. Thanks for all the help anyway.... Ill give the new stuff a go and post only if I need. Thanks heaps :)