RNG Gearswap Coding Help: Trueshot Setting

Eorzea Time
 
 
 
Language: JP EN FR DE
Version 3.1
New Items
users online
Forum » FFXI » Jobs » Ranger » RNG Gearswap coding help: Trueshot setting
RNG Gearswap coding help: Trueshot setting
 Phoenix.Lucasta
Offline
Server: Phoenix
Game: FFXI
user: lucasta
Posts: 87
By Phoenix.Lucasta 2020-06-23 01:38:22
Link | Quote | Reply
 
Hi all. I'm trying to make (hack) something simple for my rng.lua that would change the distance option when i change weapons. I cannot get it to function other than on initial load. Can someone point me in the right direction or does anyone have something that would work? I have added the function into the user setup.


Thanks in advance.
 Leviathan.Celebrindal
Offline
Server: Leviathan
Game: FFXI
Posts: 3753
By Leviathan.Celebrindal 2020-06-23 05:11:08
Link | Quote | Reply
 
I know what you're seeking- you want the DistancePlus addon to change modes as you change weapon types, so you can quickly and easily see the "sweet spot" as it varies between weapons.

Personally, I created simple sets of just main/sub/range/ammo-

sets.Gastraphetes
sets.Fomalhaut
etc

Then, I change weapons via standard macros that look like this:

/console gs equip sets.Gastraphetse
/echo "Gastraphetes Equipped"
/console dp xbow

then vary as needed for different weapon types. This combines everything in the simplest way this non-coder could do. I'm sure it can be automated within a single lua and would love to see some more graceful methods!
 Phoenix.Lucasta
Offline
Server: Phoenix
Game: FFXI
user: lucasta
Posts: 87
By Phoenix.Lucasta 2020-06-23 11:44:43
Link | Quote | Reply
 
Leviathan.Celebrindal said: »
/console gs equip sets.Gastraphetse
/echo "Gastraphetes Equipped"
/console dp xbow

This is a good workaround for now. I have the single item weapons sets i was trying to use them in the coding as well. I just don't know enough of the specifics of how the gs functions are supposed to be used or syntax. I'm definitely code by observation! Thanks for the input.
necroskull Necro Bump Detected! [85 days between previous and next post]
Offline
Posts: 4
By Caliper 2020-09-16 00:21:32
Link | Quote | Reply
 
This was more complicated than i first thought, i'll give you my thought process for this coding flow.

As far as i'm aware, we need to build a table of weapons which allow us to map the skill type onto them. So i did the following table and assigned it to a class:
Code
ranged_weapons = {
	["Gastraphetes"]='Marksmanship',
	["Fomalhaut"]='Marksmanship',
	["Armageddon"]='Marksmanship',
	["Annihilator"]='Marksmanship',
	["Fail-Not"]='Archery',
	["Gandiva"]='Archery',
	["Yoichinoyumi"]='Archery',
	["Sparrowhawk +2"]='Archery',
}
classes.rangedSkill = ranged_weapons


Since we need to track the distance plus setting, it would need to be declared globally, i typically do this under job_setup() using:
Code
dpsetting = nil 


Now we can use this code to update a variable of our choosing as follows:
Code
skill = classes.rangedSkill[player.equipment.range]


And now were ready to do a function for assigning that value into Distanceplus:
Code
function set_trueShot_range() -- Requires distancePlus
        skill = classes.rangedSkill[player.equipment.range]
	if not dpsetting then
		if skill == 'Marksmanship' and player.equipment.range == "Gastraphetes" then
			dpsetting = 'xbow'
		else
			dpsetting = 'gun'
		end
		if skill == 'Archery' then
			dpsetting = 'Bow'
		end
		
		if dpsetting then
			send_command('dp '..dpsetting..'')
		end
	end
end


So now that we have those pieces, we need it to check regularly, i found the best place to do this is in the precast() functions as follows:
Code
if spell.type == 'WeaponSkill' or spell.action_type == 'Ranged Attack' then	
	set_trueShot_range()
end


As a sidebar, if you have an ammo checking or handling function, you may need to weave this into it, or use this as an augment.

I hope you found this helpful in some way, i'd be happy to discuss it in more detail if youre interested in that.
[+]
 Phoenix.Lucasta
Offline
Server: Phoenix
Game: FFXI
user: lucasta
Posts: 87
By Phoenix.Lucasta 2020-09-18 13:30:36
Link | Quote | Reply
 
Excellent. Thanks for the great input. I will try to incorporate this and see if it works.
 Leviathan.Celebrindal
Offline
Server: Leviathan
Game: FFXI
Posts: 3753
By Leviathan.Celebrindal 2020-09-18 13:39:12
Link | Quote | Reply
 
very cool stuff, but remember that Guns and Crossbows, while both Marksmanship, have different "sweet spots".

Technically the same for Longbows vs Shortbows, but that's a much smaller concern for Rangers.

bg-wiki info on Distance Correction.

Wonderful- its there already. I was replying because I saw how you classified each weapon at the start of the code by WS family, but then later specify in the dsplus setting "Gun" "Xbow", etc to cover it.