Small problem with reloading ammunition
Small problem with reloading ammunition
While playing on scout I noticed 2 things.
1.
I have alot of waypoints which only have an 'onload' section and then the bot routine "-- reloading ammunition" doesnt get used. It seems it only gets to the routine if u have a 'proper' <waypoint></waypoint> line.
2.
When ur first (and maybe only) skill is a skill that uses 2 or more arrows (combo , piercing, etc.) and you only have 1 arrow left in slot the reloading ammunition routine doesnt work.
1.
I have alot of waypoints which only have an 'onload' section and then the bot routine "-- reloading ammunition" doesnt get used. It seems it only gets to the routine if u have a 'proper' <waypoint></waypoint> line.
2.
When ur first (and maybe only) skill is a skill that uses 2 or more arrows (combo , piercing, etc.) and you only have 1 arrow left in slot the reloading ammunition routine doesnt work.
Re: Small problem with reloading ammunition
1. just add this to your onload section of profile.leroy wrote:While playing on scout I noticed 2 things.
1.
I have alot of waypoints which only have an 'onload' section and then the bot routine "-- reloading ammunition" doesnt get used. It seems it only gets to the routine if u have a 'proper' <waypoint></waypoint> line.
2.
When ur first (and maybe only) skill is a skill that uses 2 or more arrows (combo , piercing, etc.) and you only have 1 arrow left in slot the reloading ammunition routine doesnt work.
Code: Select all
if (player.Class2 == CLASS_SCOUT or player.Class1 == CLASS_SCOUT) then
if inventory:getAmmunitionCount() == 0 then
inventory:reloadAmmunition("arrow");
end
end
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Small problem with reloading ammunition
1. Well if there are no waypoints then it wont be fighting so it doesn't need ammo. Of course you might have some custom fighting code in the onload. It looks like ammo is only checked in the main bot loop. Shouldn't ammo be checked as part of the fight sequence? If you run out of ammo in the middle of a fight does it reload without custom code in your profile?
2. Autoshot might ensure you use up all your ammo but if your skill sequence has a skill that uses 2 arrows as the next skill but you only have 1 then wont it skip that skill possibly making your sequence less efficient? Maybe it would be a good idea to make sure you have a minimum ammo count that insures all skills can be executed at their appropriate time.
2. Autoshot might ensure you use up all your ammo but if your skill sequence has a skill that uses 2 arrows as the next skill but you only have 1 then wont it skip that skill possibly making your sequence less efficient? Maybe it would be a good idea to make sure you have a minimum ammo count that insures all skills can be executed at their appropriate time.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: Small problem with reloading ammunition
I suppose the Rogue could run into this same issue with Combo Throw, and R/M even more so since they have an elite that raises the number of projectiles to 4 per combo throw.
Re: Small problem with reloading ammunition
Might not be as efficient as it could be but it's simple.
It 'could' be changed so in the skill usage code it checks for the number of items required and if you have less than required amount it could do the code to load more.
Trouble with this is you could end up with many little stacks in your bag of 1-3 items. Doing it this way won't help with autoshot when you run out though because the bot only does that skill once and usually at the start of the fight.
Just typing as I think about this really.
Maybe best option is to make up a function in the bot with 2 args, first being type of projectile and second being number required for the skill.
Question is do we get the info for skill requirements from memory?
"ConsumableNumber" number required
"Consumable" type required
Having it as a function means people can add it to their own combat code or to profiles and such.
It 'could' be changed so in the skill usage code it checks for the number of items required and if you have less than required amount it could do the code to load more.
Trouble with this is you could end up with many little stacks in your bag of 1-3 items. Doing it this way won't help with autoshot when you run out though because the bot only does that skill once and usually at the start of the fight.
Just typing as I think about this really.
Maybe best option is to make up a function in the bot with 2 args, first being type of projectile and second being number required for the skill.
Question is do we get the info for skill requirements from memory?
"ConsumableNumber" number required
"Consumable" type required
Code: Select all
function lisa_reloadammo(_type,_numrequired)
_numrequired = _numrequired or 1
_type = _type or string.lower(settings.profile.options.RELOAD_AMMUNITION)
-- reloading ammunition
if ( settings.profile.options.RELOAD_AMMUNITION ) then
if _type ~= "thrown" and _type ~= "arrow" then
print("RELOAD_AMMUNITION can only be arrow or thrown!");
elseif _type == "thrown" and (player.Class1 == CLASS_ROGUE or (player.Class2 == CLASS_ROGUE and player.Level > 11 and player.Level2 > 11)) then
if _numrequired > inventory:getAmmunitionCount() then
inventory:reloadAmmunition(_type);
end
elseif _type == "arrow" and (player.Class2 == CLASS_SCOUT or player.Class1 == CLASS_SCOUT) then
if _numrequired > inventory:getAmmunitionCount() then
inventory:reloadAmmunition(_type);
end
end
end
end
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Small problem with reloading ammunition
With a similar function to last post it could be added it to skill:use()
Code: Select all
if self.ConsumableNumber then reloadAmmo(self.Consumable,self.ConsumableNumber) end
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Small problem with reloading ammunition
The answer to the question is yes we do. Ammo gets added to the skill as a Consumable and the number of items it consumes are stored in ConsumableNumber. Eg.lisa wrote:Question is do we get the info for skill requirements from memory?
- skill.Consumable = "arrow"
skill.ConsumableNumber = 1
About the little stacks, it seems to me reloadammunition should use and unpacked ammo first before opening another ammo bag. You could end up with the situation where there is a 1 arrow stack and reloadammunition uses that but it's still not enough ammo for the skill. I think it would be good if there was some check somewhere where if there is a small stack of matching ammo in your inventory and it fits in your ammo slot then it should get added. Eg. you have 5 Stone Arrows in your inventory. After a battle you have 993 Stone Arrows in your ammo slot, so it moves the 5 arrows into the ammo slot. That keeps your ammo topped up and clears a space in your inventory. Then when there are no more free arrows in your inventory it waits until you need more arrows before opening another ammo bag.
Still, in this case I can't see any harm in having a threshold at which it reloads, eg. when you have less than 20 arrows then reload. Having a threshold just means those small stack will be a bit bigger. Of course you don't know how many arrows you will use in a fight so you might still need to check during a fight. Hm... There's a bit to think about.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: Small problem with reloading ammunition
using the exact same code I posted and not needing any more arrows I did this test.
Some points to keep in mind, the code is only done for skills that actually need arrows or daggers, so it will only add time to those skills.
I think 1/5000 of a second to do the code is acceptable =)
As for the set number to check, I think since we already have the info of needed amount then during combat can just leave it as checking if enough for that skill.
Now no reason we couldn't call this same function before combat starts and check for a set number and it would use the exact same function.
lisa_reloadammo("arrow",100)
if less than 100 arrows in the slot then it will reload with more.
--=== Note ===--
Obviously the name of the function wouldn't be what I have posted here, it could be added to the inventory class, same as the reload code.
Code: Select all
Command> local timeStart = getTime() for i = 1,1 do lisa_reloadammo("arrow",5) end print(deltaTime( getTime(), timeStart ))
0.18302687579602
Command> local timeStart = getTime() for i = 1,10 do lisa_reloadammo("arrow",5)end print(deltaTime( getTime(), timeStart ))
1.7303868345907
Command> local timeStart = getTime() for i = 1,100 do lisa_reloadammo("arrow",5) end print(deltaTime( getTime(), timeStart ))
13.965652496211
Command> local timeStart = getTime() for i = 1,1000 do lisa_reloadammo("arrow",5) end print(deltaTime( getTime(), timeStart ))
141.45709909421
I think 1/5000 of a second to do the code is acceptable =)
As for the set number to check, I think since we already have the info of needed amount then during combat can just leave it as checking if enough for that skill.
Now no reason we couldn't call this same function before combat starts and check for a set number and it would use the exact same function.
lisa_reloadammo("arrow",100)
if less than 100 arrows in the slot then it will reload with more.
--=== Note ===--
Obviously the name of the function wouldn't be what I have posted here, it could be added to the inventory class, same as the reload code.
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Who is online
Users browsing this forum: Semrush [Bot] and 1 guest