Small problem with reloading ammunition

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
leroy
Posts: 19
Joined: Thu Sep 19, 2013 11:57 am

Small problem with reloading ammunition

#1 Post by leroy » Tue Oct 20, 2015 4:26 am

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.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Small problem with reloading ammunition

#2 Post by lisa » Tue Oct 20, 2015 6:38 pm

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.
1. just add this to your onload section of profile.

Code: Select all

			if (player.Class2 == CLASS_SCOUT or player.Class1 == CLASS_SCOUT) then
				if inventory:getAmmunitionCount() == 0 then
					inventory:reloadAmmunition("arrow");
				end
			end
2. it only reloads when you are empty on arrows, regardless of your skills, autoshot always uses just 1 arrow and so as long as you actually have autoshot in your skills then that shouldn't be an issue and to be honest there is no reason not to have autoshot. Some people believe their DPS is higher without autoshot but after many hours of rigorous testing I can assure you autoshot adds to DPS and never reduces it.
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

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Small problem with reloading ammunition

#3 Post by rock5 » Thu Oct 22, 2015 9:24 pm

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.
  • 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

User avatar
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

#4 Post by Bill D Cat » Fri Oct 23, 2015 6:10 am

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.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Small problem with reloading ammunition

#5 Post by lisa » Fri Oct 23, 2015 4:37 pm

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

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
Having it as a function means people can add it to their own combat code or to profiles and such.
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

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Small problem with reloading ammunition

#6 Post by lisa » Fri Oct 23, 2015 5:15 pm

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

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Small problem with reloading ammunition

#7 Post by rock5 » Fri Oct 23, 2015 8:06 pm

lisa wrote:Question is do we get the info for skill requirements from memory?
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.
  • skill.Consumable = "arrow"
    skill.ConsumableNumber = 1
How long does it take for ReloadAmmunition to run? Will it slow down attacks?

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

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Small problem with reloading ammunition

#8 Post by lisa » Fri Oct 23, 2015 11:50 pm

using the exact same code I posted and not needing any more arrows I did this test.

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
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.
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

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest