Off topic a bit... but this reminded me of every time I work on a gearswap lua (or programming in general).
youtube.com/watch?v=8fnfeuoh4s8
Off topic a bit... but this reminded me of every time I work on a gearswap lua (or programming in general).
youtube.com/watch?v=8fnfeuoh4s8
Where might I find a snippet of code that won't let me RA weaponskill if I am out of range? Thanks
Damn ; ; ok thanks!
This is adapted from a different block, but will probably do the trick - may need a few tweaks.
If you're not using a mote-based file, just stick it in precast, and change the eventargs.cancel line to be whatever the default command to cancel is.Code:function job_precast(spell, action, spellMap, eventArgs) require('Vectors') --This might not be needed, there was an angle/facing component to the source that's not present below local Pos = require 'position' ... local t = windower.ffxi.get_mob_by_target('t') or windower.ffxi.get_mob_by_target('st') local s = windower.ffxi.get_mob_by_target('me') local distance = windower.ffxi.get_mob_by_index(target)['distance'] if 3+t.model_size+s.model_size < math.sqrt(distance) then eventArgs.cancel = true end ... end
Edit: This is for melee-WS, ranged stuff is I believe 20+model sizes
Thank you as well. I will mess around with this later tonight. My COR lua is a Mote based one so I will see if I have enough knowledge to get it working^^
Essentially, I would be fine with it not even factoring in the mob size. Just if I was over 20 distance away, it would stop me from trying to RA weaponskill. I forget too often that even though I can shoot from over 20, I cannot WS from over 20.
Gun-it
Did you solve your meditate issue? First does the gear just need to be on when the ability is activated, or does it need to be worn the duration of the meditation buff? One thing i noticed is when you first gave your equipment you put:
sets.JA['Meditate']
you only need the ['Words Words'] when there are two words. but as i scrolled down i noticed in the actual file it had:
sets.JA.Meditate
so I am not sure if these are conflicting or not. Both sets seem to have the same gear in them. I dont really understands Motes stuff, I try to write my simpler own files, but I dont see a:
state.Buff.Hasso = buffactive.Hasso or false
type line for Meditate. Im not currently subbed and cant remember if Meditate gives you a buff while active or not. If it does maybe thats why it isnt working? I dont really know how his files even register a JA went off.
Never got it working. I swapped between sets.JA.Meditate and sets.JA['Meditate'] trying to get it to work. The gear only needs to equipped when meditate is used and you do not get a status buff.
At this point I am trying to find a new SAM Lua to use (Hoping this fixes the problem0, but I have not found one detailed enough yet.
Is using the format ==> {main={name="itemname",priority=X} <== still the only way to avoid two items not equipping?
I have an issue with 2x Stikini Ring +1. When I launch my sets that have both rings equipped in left and right fingers, sometimes (often!) I get only one ring equipping.
If you have any other solution to solve this I'd be very thankful, I find the priority thing very annoying and I'd like to avoid going back to that if possible Q_Q
Ooooh, so if they're in different bags the problem is solved without the use of priority?
Hmmm NEAT.
I'm gonna try that when I get back home. Thanks for getting my hopes up! ^-^
Works perfectly, thanks dlsmd! ^_^
0_0 im glad -_-
Seeing the error of my ways, I've cast aside my hybrid lua attempts, and have been spending the past few days writing a COR lua for myself. I can't seem to get it to swap to my elemental obi when using the appropriate shot though, and for some reason my job abilities aren't switching either. Paste below. Can anyone tell me what I've done wrong?
https://pastebin.com/bQVvW9jD
Edit: I've done some further reading on here and it seems that making my JA sets read something like sets.ja['Phantom Roll'] should get the job abilities that have multiple names working. I'm at work now so I can't test it, but even my fold set doesn't switch, and from what I understand, the way I've written the precast sets.ja.Fold should be working, but isn't. Do I need to just use it as sets.ja['Fold'] as well?
Edit 2: I've fixed the elemental obi switching. There was just some minor formatting issues, however I still can't get my job abilities to switch gear.
So, I'm going through and rebuilding my LUAs and this is something that's been bugging me. The function you guys helped me build to automatically upgrade spells works most of the time, but the part that checks to see if my current job is capable of casting the output seems to fail. At 99, this is just a matter of puttin in some blacklisted spells, but when sub-99 this can be awkward.
I can't figure out what's wrong with the checks. It looks like it should work.Code:if spell.action_type == 'Magic' then if spell.english:startswith("Protect") or spell.english:startswith("Shell") or spell.english:startswith("Dia") or spell.english:startswith("Fire") or spell.english:startswith("Stone") or spell.english:startswith("Thunder") or spell.english:startswith("Water") or spell.english:startswith("Blizzard") or spell.english:startswith("Aero") or spell.english:startswith("Bio") or spell.english:startswith("Poison") or spell.english:startswith("Sleep") or spell.english:startswith("Raise") or spell.english:startswith("Holy") or spell.english:startswith("Banish") or spell.english:startswith("Enlight") or spell.english:startswith("Endark") or spell.english:startswith("Drain") or spell.english:startswith("Aspir") or spell.english:startswith("Reraise") or spell.english:startswith("Regen") then for _,lvl in pairs({" VI"," V"," IV"," III"," II",""}) do --print("current spell checking = "..string.mgsub(spell.english, "%s.+", "")..""..lvl) local spellR = gearswap.res.spells:with("name", string.mgsub(spell.english, "%s.+", "")..""..lvl) if spellR then local reject = S{"Banishga III","Banish IV","Diaga II"} if not reject:contains(spellR.en) then --print("spellR is good") if spell.english == spellR.en and windower.ffxi.get_spell_recasts()[spellR.recast_id] == 0 and spellR.mp_cost <= player.mp then --print("spell confirmed as casted spell and is good to cast") --print("casted spell = "..spell.english) break elseif spell.english ~= spellR.en and ((spellR.levels[player.main_job_id] and spellR.levels[player.main_job_id] <= player.main_job_level) or (spellR.levels[player.sub_job_id] and spellR.levels[player.sub_job_id] <= player.sub_job_level)) and windower.ffxi.get_spell_recasts()[spellR.recast_id] == 0 and spellR.mp_cost <= player.mp then --print("spell confirmed as new spell and is good to cast = "..spellR.en) eventArgs.cancel = true send_command('input /ma "'..spellR.en..'"'..spell.target.raw) break end end end end --print("spell test end") end end
It tries to cast a spell I don't have. Like Fire 4 when I only have Fire 1. It seems to just be casting the highest spell that exists, not the highest spell I know.
you need to check if you have the spell then
Code:if spell.action_type == 'Magic' then if spell.english:startswith("Protect") or spell.english:startswith("Shell") or spell.english:startswith("Dia") or spell.english:startswith("Fire") or spell.english:startswith("Stone") or spell.english:startswith("Thunder") or spell.english:startswith("Water") or spell.english:startswith("Blizzard") or spell.english:startswith("Aero") or spell.english:startswith("Bio") or spell.english:startswith("Poison") or spell.english:startswith("Sleep") or spell.english:startswith("Raise") or spell.english:startswith("Holy") or spell.english:startswith("Banish") or spell.english:startswith("Enlight") or spell.english:startswith("Endark") or spell.english:startswith("Drain") or spell.english:startswith("Aspir") or spell.english:startswith("Reraise") or spell.english:startswith("Regen") then for _,lvl in pairs({" VI"," V"," IV"," III"," II",""}) do --print("current spell checking = "..string.mgsub(spell.english, "%s.+", "")..""..lvl) local spellR = gearswap.res.spells:with("name", string.mgsub(spell.english, "%s.+", "")..""..lvl) if spellR then local reject = S{"Banishga III","Banish IV","Diaga II"} if not reject:contains(spellR.en) then --print("spellR is good") if spell.english == spellR.en and windower.ffxi.get_spell_recasts()[spellR.recast_id] == 0 and spellR.mp_cost <= player.mp then --print("spell confirmed as casted spell and is good to cast") --print("casted spell = "..spell.english) break elseif spell.english ~= spellR.en and ((spellR.levels[player.main_job_id] and spellR.levels[player.main_job_id] <= player.main_job_level) or (spellR.levels[player.sub_job_id] and spellR.levels[player.sub_job_id] <= player.sub_job_level)) and windower.ffxi.get_spell_recasts()[spellR.recast_id] == 0 and spellR.mp_cost <= player.mp and windower.ffxi.get_spells()[spellR.id] then --print("spell confirmed as new spell and is good to cast = "..spellR.en) eventArgs.cancel = true send_command('input /ma "'..spellR.en..'"'..spell.target.raw) break end end end end --print("spell test end") end end
That did it, thank you!