I'm trying to butcher together a GS lua for drg and have no idea how healing breaths would be handled. Any of you guys have an idea?
Also, if someone's in serious need of a challenge, is there a GS in the works for Apoc and aftermath handling the way Nightfyre's amazing xml handled it? I'm fine trying to butcher together anything but AM sets and toggled that recognise stuff like "TP set was acc, so AM set has to be acc, too". Waaaay over my head.
pretty much you can use midcast(spell, action) to equip your healing breath trigger gear, either aftercast(spell, action) or pet_midcast(spell, action) to equip your healing breath potency gear and pet_aftercast(spell, action) to requip your engaged/idle gear
If you are using the /pet command, it would be aftercast or pet_midcast and pet_aftercast
I have a question of my own for you guys. I have desert boots, can you make a function weather_change(id, name) function and how would you do it. the wiki says event_weather_change(id, name) so here is my idea as to how it would be done.
Code:function event_weather_change(id, name) if world.weather_element == 'Earth' then -- do code for desert boots else -- do code for no desert boots end end
Register event may still break LuaCore (not sure if that has been pushed live yet, but:
Then set up self_command to respond to Desert Boots On / Desert Boots Off by equipping or unequipping Desert Boots. If you don't push it through send_command, the equip function won't have any effect.Code:windower.register_event('weather change',function(id,name) if world.weather_element == 'Earth' or buffactive.sandstorm then send_command('gs c Desert Boots On') else send_command('gs c Desert Boots Off') end end)
On the spellcast side I would always have put this check on the aftercast/autoset (ie: if autoset was idle, it would do this check afterwards and put the boots on after if it matches), but course that method on that end didn't un-equip them if the weather were to suddenly change.
@haruhigumi (and others): New handling of player.inventory (and sack/satchel/case) should be live now.
It no longer uses the quantity of the item as the direct value for each entry. Instead, each entry contains a table of values, of which one field is 'count'. Rather than:
you'd haveCode:if player.inventory[DefaultAmmo] < 15
You can, of course, still do a simple existence check:Code:if player.inventory[DefaultAmmo].count < 15
Code:if player.inventory[DefaultAmmo] then .. end
Further, there are entries for both the short and long name for items. Thus both of these checks will work (and both would have the same count value):
Each item's table contains three to four values (id, count, shortname, and possibly longname), of which only count will be of interest to most people. The others are useful for certain utility functions. longname only exists if it's different than the short name.Code:DefaultAmmo = "Dark Adaman Bolt" if player.inventory[DefaultAmmo] then .. end DefaultAmmo = "Drk. Adm. Bolt" if player.inventory[DefaultAmmo] then .. end
For silly ascii art illustration:
Code:player.inventory Drk. Adm. Bolt ---> count=99, shortname=Drk. Adm. Bolt, longname=Dark Adaman Bolt Dark Adaman Bolt / Brutal Earring ---> count=1, shortname=Brutal Earring Rajas Ring -------> count=1, shortname=Rajas Ring Theo. Cap +1 -----> count=1, shortname=Theo. Cap +1, longname=Theophany Cap +1 Theophany Cap +1 / Etc....
Cool, I imagine the other values may be useful in terms of error handling or notification if you have multiple checks in a table. Would a check for .count error out if there's no item in the inventory for that, or would it simply return a nil ?
If the item isn't in inventory, player.inventory[itemname] will return nil (it doesn't exist; nothing will ever have a count of 0, unless you want to keep a table of every single item in the game, which is silly). If you don't check for that and just try player.inventory[itemname].count, yes, that will generate an error if you don't have the item, since you'll essentially be trying to request nil.count.
So, player.inventory[itemname] to see if you have the item at all; if you do, then you can check player.inventory[itemname].count to see how many (if that's relevant).
On minor problem I noticed.
In theory this would work fine (I have an empty/unlimited shot check above it). But let's say for example in my ammo slot is 5 Tulfaire Arrows, and there's also a stack of 20 tulfaire arrows in my inventory (ie: when you scavenge while using that stack of 99 down, you have an unmerged amount to the side).Code:if not buffactive['unlimited shot'] then -- If not empty, and if unlimited shot is not active -- Not doing it for unlimited shot to avoid excessive log if player.inventory[player.equipment.ammo].count < 15 then add_to_chat(122,"Ammo '"..player.inventory[player.equipment.ammo].shortname.."' running low ("..player.inventory[player.equipment.ammo].count..")") end end
The problem is, with the ammo being 5 in the ammo slot, there's no warning because the count is returned as a total of all items in the inventory, not just what's in the ammo slot, so it still calculates as being 25. Normally this wouldn't be a problem from shot-to-shot as when the slot is empty it will be re-quipped with the default ammo, but it can be an issue for multi-shot WS and JA like Barrage.
GS can know if a ja/spell is ready(recast 0)?
Is there a player.state command ? For example can I do
if player.state ~= 'engaged' then ... cancel, Reason I ask is I had a interesting side effect of being able to fire off Jishnu's Radiance without being engaged, but not only does that create an unfair advantage to other players, if I accidentally fire it off while in idle state there's going to be a chance of someone reporting for hack.
Couldnt find answer to these questions.
I do same, load empty spellcast and gearswap. Problem is, that //c4 will cure my target, but gearswap doesnt seem to recognise it, and dont swap at all.
Also, I am having trouble with temp item macro's in VW. /item "remedy" <me> works, /item "Fanatic's Drink" <me> with voidwatch status doesn't. Different jobs, different lua files all have same problem. They only will work after unloading gearswap.
Well for the first the solution was simple, the Shortcuts addon which is also written by Byrth, as a means of replacing that function of spellcast.
Far as the latter, I found that leaving spellcast enabled while using gearswap can interfere with some of the macro'd switches or commands (ie: spellcast would 'fix' the command, but then the event wouldn't get parsed by gearswap), the solution for me was to disable spellcast completely and switch to GearSwap+Shortcuts. Unlike spellcast, with shortcuts you can even just type /cure4 /bountyshot etc.
Thanks, I added it to my precast function under weaponskill (and changed the way it cancels the spell, since I'm using Mote's setup).
Code:if spell.type:lower() == 'weaponskill' then if player.status ~= "Engaged" or player.tp < 100 then eventArgs.cancel = true return end if (spell.target.distance >8 and not ranged_ws[spell.name]) or (spell.target.distance >21) then -- Cancel Action if distance is too great, saving TP add_to_chat(122,"Distance too great for WeaponSkill /Canceling") eventArgs.cancel = true return elseif state.Defense.Active then -- Don't gearswap for weaponskills when Defense is on. eventArgs.handled = true end end
I deliberately didn't account for subjobs such as /pld or /drk or /brd because this is an example.Code:function get_sets() sets.Idle = { head = "Twilight Helm" } sets.Engaged = { head = "Otomi Helm" } sets.HB = {} sets.HB.Pre = { head = "Vishap Armet +1" } sets.HB.Mid = { head = "Wyrm Armet +2" } end function midcast(spell, action) if spell.type:find('Magic') then -- Should handle white/black/blue magic as an example if player.hpp < 51 then equip(sets.HB.Pre) end end end function pet_midcast(spell, action) if spell.english:find('Healing Breath') then equip(sets.HB.Mid) end end function pet_aftercast(spell, action) then equip(sets[player.status]) end
OK, trying to make a few autoexec style events for GearSwap.
Things like when MNK SAM NIN reaches 100% HP and I am Idle then will auto change from Regen items to normal Idle DT gear. Usually I did it with varying success with AE event but want to move away from AE completely if I can.
People have offered help but for some reason I cant get it working, for MNK tried using this:
I tried it placed inside get_sets() as well as moving it to the top on a global level and it doesnt seem to work.Code:windower.register_event('hp change', function(hp) local player = windower.ffxi.get_player() if hp == player.max_hp and player.status ~= 'Engaged' then windower.add_to_chat(8,'HP 100') gear_modes() end end)
The code is some what beyond me so I kinda understand it and kinda dont.
Any help with that would be amazing, might need it dumbed down for me.
It does create a second problem however, with the above code in my MNK.lua if I try to //gs reload it will cause the game to instantly crash.
I have tested //gs reload 20 times in a row without the code and no crash.
No idea if this info will help anyone at all but this is what Win7 shows in the crash report:
Wish I could be more help or understood things better but since I dont I tend to rely on your alls wisdom.Code:Problem Event Name: APPCRASH Application Name: pol.exe Application Version: 1.18.13.0 Application Timestamp: 4e3bcddc Fault Module Name: luacore.DLL Fault Module Version: 1.4.2.4 Fault Module Timestamp: 52d233c0 Exception Code: c0000005 Exception Offset: 000a10e0 OS Version: 6.1.7601.2.1.0.256.1 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789