Page 1 of 1
Option - run back after fight to wp
Posted: Sat Apr 27, 2013 2:06 am
by Jig
Hello,
i have follow problem, i want to farm some mobs, but without running - just standing still.
if i use wander with radius 0 then i have the problem the bot doesnt run to the original position. im using this atm:
Code: Select all
<waypoints>
<option name="PATH_TYPE" value="wander"/>
<option name="WANDER_RADIUS" value="0" />
<!-- # 1 --><waypoint x="x" z="z" y="y"> player:restrnd(100, 3, 10) </waypoint>
</waypoints>
so he runs back after every fight,
but the bot is circling his head, and that is obviously a bot after some minutes.
If i dont pause, the bot is circling his head continuously - but it doesnt fight or scan for targets.
Can someone help me?
Re: Option - run back after fight to wp
Posted: Sat Apr 27, 2013 4:44 am
by rock5
If you don't want it to move while it waits then you have to write some wait code
Eg.
Code: Select all
repeat
yrest(1000)
until player:findEnemy(false,nil,evalTargetDefault)
That should work. It should stand still and wait until a valid mob is in range and then continue normally and attack it. When there are no more mobs it should return to the wp to wait again.
Re: Option - run back after fight to wp
Posted: Sat Apr 27, 2013 5:05 am
by lisa
i really don't see how this part can work
Code: Select all
<option name="PATH_TYPE" value="wander"/>
<option name="WANDER_RADIUS" value="0" />
What I usually do though in this situation is do the code in onload and not even have any actual waypoints
If you are melee you would also need to add code to go back to the spot you want, if ranged it's pretty easy.
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
changeProfileOption("MAX_TARGET_DIST", 180);
changeProfileOption("COMBAT_DISTANCE", 180);
while (true) do
local done = false
local objectList = CObjectList();
objectList:update();
local objSize = objectList:size()
for i = 0,objSize do
obj = objectList:getObject(i);
if done ~= true and (obj.Name == "Puppet Warrior" or obj.Name == "Puppet Shaman" and obj.Type ~= 1) then
player:target(obj);
--player:update();
--if( player:haveTarget() ) then
player:fight();
done = true
--end
end
end
player:checkSkills(true);
end
</onLoad>
</waypoints>
Re: Option - run back after fight to wp
Posted: Sat Apr 27, 2013 5:15 am
by Jig
Thank you very much rock5 and lisa.
It works really great. Now its perfect.

Re: Option - run back after fight to wp
Posted: Sun Jun 16, 2013 11:03 pm
by minhtien86
lisa wrote:i really don't see how this part can work
Code: Select all
<option name="PATH_TYPE" value="wander"/>
<option name="WANDER_RADIUS" value="0" />
What I usually do though in this situation is do the code in onload and not even have any actual waypoints
If you are melee you would also need to add code to go back to the spot you want, if ranged it's pretty easy.
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
changeProfileOption("MAX_TARGET_DIST", 180);
changeProfileOption("COMBAT_DISTANCE", 180);
while (true) do
local done = false
local objectList = CObjectList();
objectList:update();
local objSize = objectList:size()
for i = 0,objSize do
obj = objectList:getObject(i);
if done ~= true and (obj.Name == "Puppet Warrior" or obj.Name == "Puppet Shaman" and obj.Type ~= 1) then
player:target(obj);
--player:update();
--if( player:haveTarget() ) then
player:fight();
done = true
--end
end
end
player:checkSkills(true);
end
</onLoad>
</waypoints>
How do i make char stand at one point and attack when enemy appear then go back ?