Skip to content

Snapshot Auto Equip

shastaxc edited this page Jul 6, 2024 · 5 revisions

Handles all the logic you need to determine which set your need for precast for Ranged Attacks. It calculates how much snapshot you need from gear after factoring in:

  • Currently-equipped weapons
  • Traits
  • Job points/gifts
  • Buffs such as Flurry, Flurry II, Embrava

Also has optional handling for separate sets for when Velocity Shot is on (RNG only).

Implementation

See the Installation page for details on first steps if you have not yet installed SilverLibs into your job lua. To implement this specific feature:

If Using Mote Libs

If the specified functions already exist, just put the silibs part inside of it in the appropriate spot. Please add the following:

function job_setup()
  silibs.enable_snapshot_auto_equip()
end

If Using Selindrile Libs

If the specified functions already exist, just put the silibs part inside of it in the appropriate spot. Please add the following in your char_job_gear.lua file:

function user_job_setup()
  silibs.enable_snapshot_auto_equip()
end

Set Names

In addition to enabling the feature, you need to create sets with different amounts of snapshot in them. SilverLibs will find the best available set to use when you activate a RA. This matching is based on set name. Your snapshot sets must follow the following pattern "Snapshot" plus a number representing how much Snapshot gear is in the set (excluding snapshot from weapons). Also do not include Snapshot from Traits, Job points/gifts, or buffs (these will all be calculated for you). Example:

sets.Snapshot50 = {
  head="Example",
  body="Example",
  ...
}
sets.Snapshot32 = {
  head="Example",
  body="Example",
  ...
}

On Ranger, you can also add extra sets for when Velocity Shot buff is on. This is optional. This should follow the same pattern but added to a "Velocity" table. Example:

sets.Velocity = {}
sets.Velocity.Snapshot50 = {
  head="Example",
  body="Example",
  ...
}
sets.Velocity.Snapshot32 = {
  head="Example",
  body="Example",
  ...
}

Note: The empty set sets.Velocity = {} is necessary to avoid errors.

Set Name Limitations

Your set names should not exceed Snapshot70 or go under Snapshot0 (duh). If your set has more than 70 snapshot, just call it sets.Snapshot70 anyway. 70 Snapshot is the cap for the stat so having more than that in a set doesn't make any difference.

Ranged attacks failing to fire?

You may experience an issue where your shots keep failing to fire in certain circumstances. This may be due to equipping one ammo in the snapshot set, and a different ammo in the midcast set. This actually has nothing to do with SilverLibs, but I'll give a tip on solving this anyway.

This can commonly happen if you change ammo depending on certain situations such as toggling a high accuracy mode. To get around this, you need to override the snapshot set with the ammo you intend to use in the midcast set. Here's an example of how to fix it:

Mote's

function job_post_precast(spell, action, spellMap, eventArgs)
  if state.RangedMode.value == 'Acc' then
    equip({ammo="Devastating Bullet"})
  end

  ----------- Non-silibs content goes above this line -----------
  silibs.post_precast_hook(spell, action, spellMap, eventArgs)
end

Selindrile's

function user_job_post_precast(spell, spellMap, eventArgs)
  if state.RangedMode.value == 'Acc' then
    equip({ammo="Devastating Bullet"})
  end
end

Clone this wiki locally