Page 1 of 2
Stop Movement on Boss Detection
Posted: Sat Aug 13, 2011 2:17 am
by whome
Is there a way to have bot stop when a random, roaming boss is located for a set period of time? I know the game gives a warning when nearing a roaming boss, but the bot does not detect such a warning....... thanks in advance if possible.
EDIT:-
So, I guess there is no such option. How about someone please looking at why my profile options are not working, please..... Here are the parts I have edited.....
Code: Select all
<!-- Combat options -->
<option name="COMBAT_TYPE" value="" /> <!-- leave empty or choose ranged/melee if not using class default -->
<option name="COMBAT_RANGED_PULL" value="true" /> <!-- only important for melees -->
<option name="COMBAT_DISTANCE" value="150" />
<option name="MAX_FIGHT_TIME" value="15" /> <!-- Max time without damage before break -->
<option name="DOT_PERCENT" value="90" />
<option name="ANTI_KS" value="false" />
<option name="MAX_TARGET_DIST" value="140" />
<option name="AUTO_ELITE_FACTOR" value="4" /> <!-- mobs with x * your HP value counts as 'Elite' and we will not target it -->
and
Code: Select all
<onLoad><![CDATA[
-- Additional Lua code to execute after loading the profile
-- and before the bot starts. e.g. You could overwrite profile settings here
-- like: changeProfileOption("HP_REST", 60);
startGMDetect()
local target = player:getTarget();
if( target.HP == target.MaxHP > player.MaxHP * settings.profile.options.AUTO_ELITE_FACTOR ) then
yrest(2000)
end
]]></onLoad>
as you can see, I am a total learner, but cannot think of any other way to stop moevement when an elite is detected....... sorry in advance
Re: Stop Movement on Boss Detection
Posted: Sat Aug 13, 2011 7:36 pm
by whome
I edited my original post. Maybe some kind soul can check why I can't get it to work.......
Re: Stop Movement on Boss Detection
Posted: Sat Aug 13, 2011 8:31 pm
by lisa
By putting it in the onload section of your profile though it means the code will only be checked when the character is first started.
I guess easiest way to use it would be in your WP file and just do it at the coords where elites sometimes reside.
To make it easier could make it a function in the onload of WP and then call the function at the waypoint coords where you want.
So in WP file
Code: Select all
<onLoad><![CDATA[
function elites()
local obj = nil;
local objectList = CObjectList();
objectList:update();
for i = 0,objectList:size() do
obj = objectList:getObject(i);
if( obj ~= nil ) then
if( obj.Type == PT_MONSTER then
local pawn = CPawn(obj.Address);
pawn:update();
local _target = pawn:getTarget();
if( _target.MaxHP > player.MaxHP * settings.profile.options.AUTO_ELITE_FACTOR ) then
yrest(2000) -- put what you want to do here if elite nearby
end
end
end
end
end
]]></onLoad>
then at coords use elites()
Code: Select all
<waypoint x="12794" z="1601" y="59"> elites() </waypoint>
Re: Stop Movement on Boss Detection
Posted: Sat Aug 13, 2011 8:36 pm
by whome
Thanks so much Lisa, ill take a look asap
Re: Stop Movement on Boss Detection
Posted: Sat Aug 13, 2011 9:27 pm
by rock5
Lisa, that doesn't look right. If "pawn" = the object then you want to check its hp, not its targets hp.
Anyway you could also use an eval function.
Code: Select all
<onLoad><![CDATA[
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("",nil,eliteEval)
if mob then
yrest(2000) -- put what you want to do here if elite nearby
end
end
]]></onLoad>
Re: Stop Movement on Boss Detection
Posted: Sat Aug 13, 2011 11:07 pm
by whome
Can i enter in my profile that I would like to, say, start a particular waypoint (in the part where I can enter what I choose to do if an elite is detected)? This would have me run away, back to beginning of a loop, thus avoiding the elite?
And if I use Rocks suggestion, do I still change my waypoint to include 'elite'?
Re: Stop Movement on Boss Detection
Posted: Sat Aug 13, 2011 11:54 pm
by rock5
whome wrote:Can i enter in my profile that I would like to, say, start a particular waypoint (in the part where I can enter what I choose to do if an elite is detected)? This would have me run away, back to beginning of a loop, thus avoiding the elite?
If I understand you correctly, yes, you can put
Code: Select all
if mob then
loadPaths("escapefile") -- put what you want to do here if elite nearby
end
whome wrote:And if I use Rocks suggestion, do I still change my waypoint to include 'elite'?
Yes you would still need to add "elite()" to the waypoints where you want to check for the boss.
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 2:00 am
by whome
When i put 'elite()' at the end of each waypoint i want to check I get error message "We can't find your waypoint file 'C:/program Files etc etc/scripts/rom/waypoints/myfile.xml'. Please create a valid waypoint file within the 'waypoints folder blah blah.
What am I doing wrong??
Code: Select all
<waypoints type="Normal">
<!-- # 1 --><waypoint x="4046" z="7804" y="-22"> </waypoint>
<!-- # 2 --><waypoint x="4281" z="8018" y="-31"> elites() </waypoint>
<!-- # 3 --><waypoint x="4599" z="8071" y="-42"> elites() </waypoint>
<!-- # 4 --><waypoint x="4325" z="8258" y="-33"> elites() </waypoint>
<!-- # 5 --><waypoint x="4141" z="8582" y="-29"> elites() </waypoint>
<!-- # 6 --><waypoint x="4161" z="8820" y="-40"> elites() </waypoint>
<!-- # 7 --><waypoint x="4029" z="8859" y="-19"> elites() </waypoint>
<!-- # 8 --><waypoint x="3766" z="8678" y="0"> elites() </waypoint>
<!-- # 9 --><waypoint x="3794" z="8428" y="-14"> elites() </waypoint>
<!-- # 10 --><waypoint x="3628" z="8086" y="-19"> elites() </waypoint>
<!-- # 11 --><waypoint x="3660" z="7791" y="-37"> elites() </waypoint>
<!-- # 12 --><waypoint x="3840" z="7723" y="-35">
if( player.Level > 21 ) then
loadPaths("mywaypointfiles")
end
</waypoint>
</waypoints>
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 2:10 am
by rock5
Does "myfile.xml" exist? Double check the name.
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 2:16 am
by whome
Sorry, thats just my dodgy file name for this submission.... I'll post the whole original thing.
Program Files/ blah blah/scripts/rom/waypoints/1-9SS (and 9 waypoint files located within) this one called '8_Ostriches'
Code: Select all
<waypoints type="Normal">
<!-- # 1 --><waypoint x="4046" z="7804" y="-22"> elites() </waypoint>
<!-- # 2 --><waypoint x="4281" z="8018" y="-31"> elites() </waypoint>
<!-- # 3 --><waypoint x="4599" z="8071" y="-42"> elites() </waypoint>
<!-- # 4 --><waypoint x="4325" z="8258" y="-33"> elites() </waypoint>
<!-- # 5 --><waypoint x="4141" z="8582" y="-29"> elites() </waypoint>
<!-- # 6 --><waypoint x="4161" z="8820" y="-40"> elites() </waypoint>
<!-- # 7 --><waypoint x="4029" z="8859" y="-19"> elites() </waypoint>
<!-- # 8 --><waypoint x="3766" z="8678" y="0"> elites() </waypoint>
<!-- # 9 --><waypoint x="3794" z="8428" y="-14"> elites() </waypoint>
<!-- # 10 --><waypoint x="3628" z="8086" y="-19"> elites() </waypoint>
<!-- # 11 --><waypoint x="3660" z="7791" y="-37"> elites() </waypoint>
<!-- # 12 --><waypoint x="3840" z="7723" y="-35">
if( player.Level > 21 ) then
loadPaths("1-9SS/8_Ostriches-Tagena")
end
</waypoint>
</waypoints>
Because I wanted it to go back to waypoint one, I ask it to load that file 'Ostriches', which it tries to load even when an elite is not present. At least thats what I think it is doing.....
Code: Select all
<onLoad><![CDATA[
-- Additional Lua code to execute after loading the profile
-- and before the bot starts. e.g. You could overwrite profile settings here
-- like: changeProfileOption("HP_REST", 60);
if( player.PetPtr == 0 or ( player.Pet.HP/player.Pet.MaxHP*100 ) < 20 ) then
player:cast("WARDEN_SUMMON_SPIRIT_OF_THE_OAK");
yrest(8000);
end;
startGMDetect()
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("",nil,eliteEval)
if mob then
loadPaths("1-9SS/8_Ostriches"); -- put what you want to do here if elite nearby
end
end
]]></onLoad>
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 3:04 am
by whome
OK, think I messed up and typed 'elites()' instead of 'elite()' - anyway, changed that and now get this error.....
"[string " elite() "]:1: attempt to call global 'elite' (a nil value)"
EDIT: Changed back to 'elites() and now it just loops without moving to second waypoint.....?
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 3:30 am
by rock5
Something I think I should point out is when you load a waypoint file it doesn't necessarily start at waypoint 1. It starts at the closest waypoint.
If the file you are trying to load is the file itself, you could just use
to make it go to waypoint 1.
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 3:41 am
by whome
SSooo, this isn't working? Gosh darnit.....
Code: Select all
<onLoad><![CDATA[
-- Additional Lua code to execute after loading the profile
-- and before the bot starts. e.g. You could overwrite profile settings here
-- like: changeProfileOption("HP_REST", 60);
if( player.PetPtr == 0 or ( player.Pet.HP/player.Pet.MaxHP*100 ) < 20 ) then
player:cast("WARDEN_SUMMON_SPIRIT_OF_THE_OAK");
yrest(8000);
end;
startGMDetect()
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("",nil,eliteEval)
if mob then
loadPaths("_WPL:setWaypointIndex(1)); -- put what you want to do here if elite nearby
end
end
]]></onLoad>
It loops and won't progress past the first waypoint.
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 3:50 am
by rock5
loadPaths("_WPL:setWaypointIndex(1));
Besides being wrong there is definately a syntax error there. Try this instead
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 4:23 am
by whome
I tried:
Code: Select all
<onLoad><![CDATA[
-- Additional Lua code to execute after loading the profile
-- and before the bot starts. e.g. You could overwrite profile settings here
-- like: changeProfileOption("HP_REST", 60);
if( player.PetPtr == 0 or ( player.Pet.HP/player.Pet.MaxHP*100 ) < 20 ) then
player:cast("WARDEN_SUMMON_SPIRIT_OF_THE_OAK");
yrest(8000);
end;
startGMDetect()
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("",nil,eliteEval)
if mob then
_WPL:setWaypointIndex(1); -- put what you want to do here if elite nearby
end
end
]]></onLoad>
and got this error.....
[string "..."]:21: attempt to index global '_WPL' (a nil value)
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 9:57 am
by lisa
I think the issue is you are placing the code in the onload of your profile when you should probably do it in your WP file.
Code: Select all
<waypoints type="Normal">
<onLoad><![CDATA[
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("",nil,eliteEval)
if mob then
loadPaths("1-9SS/8_Ostriches"); -- put what you want to do here if elite nearby
end
end
]]></onLoad>
<!-- # 1 --><waypoint x="4046" z="7804" y="-22"> elites() </waypoint>
<!-- # 2 --><waypoint x="4281" z="8018" y="-31"> elites() </waypoint>
<!-- # 3 --><waypoint x="4599" z="8071" y="-42"> elites() </waypoint>
<!-- # 4 --><waypoint x="4325" z="8258" y="-33"> elites() </waypoint>
<!-- # 5 --><waypoint x="4141" z="8582" y="-29"> elites() </waypoint>
<!-- # 6 --><waypoint x="4161" z="8820" y="-40"> elites() </waypoint>
<!-- # 7 --><waypoint x="4029" z="8859" y="-19"> elites() </waypoint>
<!-- # 8 --><waypoint x="3766" z="8678" y="0"> elites() </waypoint>
<!-- # 9 --><waypoint x="3794" z="8428" y="-14"> elites() </waypoint>
<!-- # 10 --><waypoint x="3628" z="8086" y="-19"> elites() </waypoint>
<!-- # 11 --><waypoint x="3660" z="7791" y="-37"> elites() </waypoint>
<!-- # 12 --><waypoint x="3840" z="7723" y="-35">
if( player.Level > 21 ) then
loadPaths("1-9SS/8_Ostriches-Tagena")
end
</waypoint>
</waypoints>
and make you profile onload back to this
Code: Select all
<onLoad><![CDATA[
if( player.PetPtr == 0 or ( player.Pet.HP/player.Pet.MaxHP*100 ) < 20 ) then
player:cast("WARDEN_SUMMON_SPIRIT_OF_THE_OAK");
yrest(8000);
end;
startGMDetect()
]]></onLoad>
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 10:26 am
by rock5
whome wrote:[string "..."]:21: attempt to index global '_WPL' (a nil value)
Like it says "_WPL" is a nil value but "__WPL" isn't.
Try that instead.
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 5:04 pm
by whome
OK, tried these things. No luck, it keeps saying it is 'moving to waypoint #1' and that scrolls till I pause/quit......
Code: Select all
<!-- Combat options -->
<option name="COMBAT_TYPE" value="" /> <!-- leave empty or choose ranged/melee if not using class default -->
<option name="COMBAT_RANGED_PULL" value="true" /> <!-- only important for melees -->
<option name="COMBAT_DISTANCE" value="150" />
<option name="MAX_FIGHT_TIME" value="15" /> <!-- Max time without damage before break -->
<option name="DOT_PERCENT" value="90" />
<option name="ANTI_KS" value="false" />
<option name="MAX_TARGET_DIST" value="140" />
<option name="AUTO_ELITE_FACTOR" value="4" /> <!-- mobs with x * your HP value counts as 'Elite' and we will not target it -->
and
Code: Select all
<onLoad><![CDATA[
-- Additional Lua code to execute after loading the profile
-- and before the bot starts. e.g. You could overwrite profile settings here
-- like: changeProfileOption("HP_REST", 60);
if( player.PetPtr == 0 or ( player.Pet.HP/player.Pet.MaxHP*100 ) < 20 ) then
player:cast("WARDEN_SUMMON_SPIRIT_OF_THE_OAK");
yrest(8000);
end;
startGMDetect()
]]></onLoad>
<onDeath><![CDATA[
-- Additional Lua code to execute on death
-- pauseOnDeath(); -- Stop the script
-- player:logout(); -- logout
]]></onDeath>
<onLeaveCombat><![CDATA[
-- Additional Lua code to execute after killing an enemy
catchCavy("cavy")
player:update()
if 65 > (player.Pet.HP/player.Pet.MaxHP * 100) then
player:target( player.Pet )
player:cast("WARDEN_ELVEN_PRAYER")
yrest(1000)
end
]]></onLeaveCombat>
and
Code: Select all
<waypoints type="Normal">
<onLoad><![CDATA[
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("",nil,eliteEval)
if mob then
__WPL:setWaypointIndex(1); -- put what you want to do here if elite nearby
end
end
]]></onLoad>
<!-- # 1 --><waypoint x="4046" z="7804" y="-22"> elites() </waypoint>
<!-- # 2 --><waypoint x="4281" z="8018" y="-31"> elites() </waypoint>
<!-- # 3 --><waypoint x="4599" z="8071" y="-42"> elites() </waypoint>
<!-- # 4 --><waypoint x="4325" z="8258" y="-33"> elites() </waypoint>
<!-- # 5 --><waypoint x="4141" z="8582" y="-29"> elites() </waypoint>
<!-- # 6 --><waypoint x="4161" z="8820" y="-40"> elites() </waypoint>
<!-- # 7 --><waypoint x="4029" z="8859" y="-19"> elites() </waypoint>
<!-- # 8 --><waypoint x="3766" z="8678" y="0"> elites() </waypoint>
<!-- # 9 --><waypoint x="3794" z="8428" y="-14"> elites() </waypoint>
<!-- # 10 --><waypoint x="3628" z="8086" y="-19"> elites() </waypoint>
<!-- # 11 --><waypoint x="3660" z="7791" y="-37"> elites() </waypoint>
<!-- # 12 --><waypoint x="3840" z="7723" y="-35">
if( player.Level > 21 ) then
loadPaths("1-9SS/8_Ostriches-Tagena")
end
</waypoint>
</waypoints>
If it could move to the beginning of the waypoint as in #1, it would effectively run away from the elite. Leaving it load the path as I first tried would have it simply find the nearest waypoint (as suggested by Rock) and would be no good at all...... sorry for all the trouble guys
Re: Stop Movement on Boss Detection
Posted: Sun Aug 14, 2011 10:54 pm
by rock5
Do the mobs around you have 4 x your hp?
Try adding this line to the elites() function after the "if mob then"
Code: Select all
print("Running away from "..(mob.Name or "<no name>"))
Re: Stop Movement on Boss Detection
Posted: Mon Aug 15, 2011 1:31 am
by whome
OMG, check this out, I have no idea what this is??? It ran from a silly ostrich, there was no elite around. I put in what you suggested Rock. At least it ran to my waypoint #1
Code: Select all
Use MACRO: MAGE_FIREBALL => <UNKNOWN> (1000/1000)
Fight finished. Killed 2 Young Ostrich. (fight #2 / runtime 0 minutes)
Use MACRO: Looting target in distance 21.
Clearing target.
Moving to waypoint #3, (4599, 8071)
Running away from ▲¤ö ♥↨|y→╦Ç ♦↨|ß(ÃE ♣↨â®E▒↓ ♠↨ÅDB¿↨ ↨Ü
<¬↨úÞ9»▼ ↨½·5│%
↨┬(=ã- ♫↨ã¼CÍ9 ☼↨╔VOÎ2 ►↨╬üM┘4 ◄↨ð├\ÛD ↕↨ËjIÕK ‼↨ıXk¸Z ¶↨Í,l³t §↨Í▲u¹ö ▬↨Èùp³É ↨
↨ÈÔ`·⌂ ↑↨Èùf¹z ↓↨ı2q²å →|¹ò ←↨ËÅn³ê ∟↨Ë`y²s ↔↨È[m¹n ▲↨Èòk³é ▼↨È#o·Ö ↨Ê£⌂³É !↨ʦ
a¾ª "↨¤Äı│ #↨╬¡ÿÝÀ $↨╩‗ÀÈ╩ %↨ã╝╗═╬ &↨┴«║╔Ë '↨╝u╗ãÈ (↨ÂÔ©─Ï )↨░╬┐╔╬ *↨¡"║¦╝ +↨¬Ý
ã̬ ,↨®◄ãÔí -↨ºÃ┬Õá .↨ª▬¢µª /↨ñW╣Ò░ 0↨íÿ╣▄¥ 1↨×2ÂË╠ 2↨ÖQ│─█ 3↨Æ?░¢Ô 4↨è┌á¥þ 5↨âD
×┬Õ 6↨|■ù╔Ò 7↨w↨ö┼µ 8↨o┘ÿ║ý 9↨føº¥Õ :↨aQ╣Ãı ;↨[╦ã┐Ê <↨Uú╚╣È =↨Nâ╚ÂÍ >↨GH╬─┼ ?↨EB
╩õâ @↨F█▓þL
Moving to waypoint #1, (4046, 7804)
Moving to waypoint #2, (4281, 8018)
Paused. (Delete) to continue, (CTRL+L) exit to shell, (CTRL+C) quit
Waypoint file now looks like this.....
Code: Select all
<waypoints type="Normal">
<onLoad><![CDATA[
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("",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>
<!-- # 1 --><waypoint x="4046" z="7804" y="-22"> elites() </waypoint>
<!-- # 2 --><waypoint x="4281" z="8018" y="-31"> elites() </waypoint>
<!-- # 3 --><waypoint x="4599" z="8071" y="-42"> elites() </waypoint>
<!-- # 4 --><waypoint x="4325" z="8258" y="-33"> elites() </waypoint>
<!-- # 5 --><waypoint x="4141" z="8582" y="-29"> elites() </waypoint>
<!-- # 6 --><waypoint x="4161" z="8820" y="-40"> elites() </waypoint>
<!-- # 7 --><waypoint x="4029" z="8859" y="-19"> elites() </waypoint>
<!-- # 8 --><waypoint x="3766" z="8678" y="0"> elites() </waypoint>
<!-- # 9 --><waypoint x="3794" z="8428" y="-14"> elites() </waypoint>
<!-- # 10 --><waypoint x="3628" z="8086" y="-19"> elites() </waypoint>
<!-- # 11 --><waypoint x="3660" z="7791" y="-37"> elites() </waypoint>
<!-- # 12 --><waypoint x="3840" z="7723" y="-35">
if( player.Level > 21 ) then
loadPaths("1-9SS/8_Ostriches-Tagena")
end
</waypoint>
</waypoints>