Hello, I started working on this by using the "Gearswap for Dummies" and then moved on to referencing examples of other .lua files. I cant get rid of an error change_defense_mode () nil function. Any help would be greatly appreciated in finding and learning what exactly I am doing wrong.
Here is the code so far....
-------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job. Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------
-- Initialization function for this job file.
function get_sets()
mote_include_version = 2
-- Load and initialize the include file.
include('Mote-Include.lua')
end
-- Setup vars that are user-independent. state.Buff vars initialized here will automatically be tracked.
function job_setup()
state.Buff.Sentinel = buffactive.sentinel or false
state.Buff.Cover = buffactive.cover or false
state.Buff.Doom = buffactive.Doom or false
end
-------------------------------------------------------------------------------------------------------------------
-- User setup functions for this job. Recommend that these be overridden in a sidecar file.
-------------------------------------------------------------------------------------------------------------------
-- Setup vars that are user-dependent. Can override this function in a sidecar file.
function user_setup()
state.OffenseMode:options('XcalOchain', 'XcalAegis', 'BurtOchain', 'BurtAegis')
state.DefenseMode:options('DTOchain', 'DTAegis', 'Reraise')
state.WeaponskillMode:options('Normal', 'Acc')
state.ExtraDefenseMode = M{['description']='Extra Defense Mode', 'None', 'MP', 'Knockback', 'MP_Knockback'}
update_defense_mode()
send_command('bind @f9 gs c cycle OffenseMode')
send_command('bind @f10 gs c cycle DefenseMode')
send_command('bind @f11 gs c cycle WeaponskillMode')
send_command('bind @f12 gs c cycle ExtraDefenseMode')
select_default_macro_book()
end
function user_unload()
send_command('unbind @f9')
send_command('unbind @f10')
send_command('unbind @f11')
send_command('unbind @f12')
end
-- Define sets and vars used by this job file.
function init_gear_sets()
--------------------------------------
-- Precast sets
--------------------------------------
-- Precast sets to enhance JAs
sets.precast.JA['Invincible'] = {legs="Caballarius Breeches +1"}
sets.precast.JA['Holy Circle'] = {feet="Reverence Leggings +1"}
sets.precast.JA['Shield Bash'] = {hands="Caballarius Gauntlets +1"}
sets.precast.JA['Sentinel'] = {feet="Caballarius Leggings +1"}
sets.precast.JA['Rampart'] = {head="Caballarius Coronet +1"}
sets.precast.JA['Fealty'] = {body="Caballarius Surcoat +1"}
sets.precast.JA['Divine Emblem'] = {feet="Chev. Sabatons +1"}
sets.precast.JA['Cover'] = {head="Reverence Coronet +1"}
sets.precast.JA['Invincible'] = {legs="Caballarius Surcoat +1"}
sets.precast.JA['Provoke'] = {
ammo="Sepierce Orb",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Caballarius Breeches +1",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Creed Baudrier",
left_ear="Hades Earring +1",
right_ear="Hades Earring +1",
left_ring="Defending Ring",
right_ring="Odium Ring",
back="Rudianos's Mantle"}
-- Chivalry
sets.precast.JA['Chivalry'] = {hands="Caballarius Gauntlets +1"}
-- Fast cast sets for spells
sets.precast.FC = {ammo="Incantor Stone", body="Odyss. Chestplate", hands="Leyline Gloves",
head="Cizin Helm",ear2="Loquacious Earring",ring2="Prolix Ring",legs="Enif Cosciales"}
sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
-- Weaponskill sets
-- Default set for any weaponskill that isn't any more specifically defined
sets.precast.WS = { ammo="Amar Cluster",
head="Valorous Mask",
body="Valorous Mail",
hands="Chev. Gauntlets +1",
legs="Valorous Hose",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Assuage Earring",
right_ear="Digni. Earring",
left_ring="Chirich Ring",
right_ring="Patricius Ring",
back="Rudianos's Mantle"}
sets.precast.WS.Acc = { ammo="Amar Cluster",
head="Valorous Mask",
body="Valorous Mail",
hands="Chev. Gauntlets +1",
legs="Valorous Hose",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Assuage Earring",
right_ear="Digni. Earring",
left_ring="Chirich Ring",
right_ring="Patricius Ring",
back="Rudianos's Mantle"}
-- Specific weaponskill sets. Uses the base set if an appropriate WSMod version isn't found.
sets.precast.WS['Requiescat'] = set_combine(sets.precast.WS, {ring1="Leviathan Ring",ring2="Aquasoul Ring"})
sets.precast.WS['Requiescat'].Acc = sets.precast.WS.Acc
sets.precast.WS['Chant du Cygne'] = sets.precast.WS
sets.precast.WS['Chant du Cygne'].Acc = sets.precast.WS.Acc
sets.precast.WS['Sanguine Blade'] = sets.precast.WS
sets.precast.WS['Atonement'] = sets.precast.WS
--------------------------------------
-- Midcast sets
--------------------------------------
sets.midcast.FastRecast = {ammo="Amar Cluster",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Carmine Cuisses +1",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Assuage Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back="Rudianos's Mantle"}
sets.midcast.Enmity = {
ammo="Sepierce Orb",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Caballarius Breeches +1",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Creed Baudrier",
left_ear="Hades Earring +1",
right_ear="Hades Earring +1",
left_ring="Defending Ring",
right_ring="Odium Ring",
back="Rudianos's Mantle"}
sets.midcast.Flash = sets.midcast.Enmity
sets.midcast.Stun = sets.midcast.Flash
sets.midcast.Cure = {ammo="Incantor Stone",
head={ name="Souveran Schaller", augments={'HP+80','Enmity+7','Potency of "Cure" effect received +10%',}},
body={ name="Jumalik Mail", augments={'HP+40','Attack+10','Enmity+7',}},
hands={ name="Leyline Gloves", augments={'Accuracy+5','Mag. Acc.+7',}},
legs={ name="Carmine Cuisses +1", augments={'Accuracy+12','DEX+12','MND+20',}},
feet={ name="Odyssean Greaves", augments={'Attack+17','Damage taken-3%','VIT+9','Accuracy+14',}},
neck="Phalaina locket",
waist="Asklepian Belt",
left_ear="Mendi. Earring",
right_ear="Andoaa Earring",
left_ring="Defending Ring",
right_ring="Prolix Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},
}
--sets.midcast.Phalanx
sets.midcast['Enhancing Magic'] = {neck="Colossus's Torque",waist="Olympus Sash",legs="Reverence Breeches +1"}
sets.midcast.Protect = {ring1="Sheltered Ring"}
sets.midcast.Shell = {ring1="Sheltered Ring"}
--------------------------------------
-- Idle/resting/defense/etc sets
--------------------------------------
sets.Reraise = {head="Twilight Helm", body="Twilight Mail"}
sets.resting = {neck="Creed Collar",
ring1="Sheltered Ring",ring2="Paguroidea Ring",
waist="Austerity Belt"}
-- Idle sets
sets.idle = { ammo="Amar Cluster",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Carmine Cuisses +1",
feet="Chev. Sabatons +1",
neck="Creed Collar",
waist="Dynamic Belt +1",
left_ear="Assuage Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
sets.idle.Town = {main="Burtgang", sub="Ochain", ammo="Amar Cluster",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Carmine Cuisses +1",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Assuage Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
sets.idle.Weak = { ammo="Amar Cluster",main="Burtgang", sub="Ochain",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Carmine Cuisses +1",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Assuage Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back="Rudianos's Mantle"}
sets.idle.Weak.Reraise = set_combine(sets.idle.Weak, sets.Reraise)
sets.Kiting = {legs="Carmine Cuisses +1"}
sets.latent_refresh = {waist="Fucho-no-obi"}
--------------------------------------
-- Defense sets
--------------------------------------
-- Extra defense sets. Apply these on top of melee or defense sets.
sets.Knockback = {back="Repulse Mantle"}
sets.MP = {neck="Creed Collar",waist="Flume Belt +1"}
sets.MP_Knockback = {neck="Creed Collar",waist="Flume Belt +1",back="Repulse Mantle"}
-- Basic defense sets.
sets.defense.DTOchain = { ammo="Amar Cluster", main="Burtgang", sub="Ochain",
head={ name="Odyssean Helm", augments={'Attack+15','Damage taken-3%','DEX+2',}},
body="Chev. Cuirass +1",
hands={ name="Odyssean Gauntlets", augments={'Accuracy+28','Damage taken-2%','Attack+2',}},
legs={ name="Odyssean Cuisses", augments={'Damage taken-3%','STR+8','Attack+8',}},
feet={ name="Odyssean Greaves", augments={'Attack+17','Damage taken-3%','VIT+9','Accuracy+14',}},
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Assuage Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
sets.defense.DTAegis = { ammo="Amar Cluster", main="Burtgang", sub="Aegis",
head={ name="Odyssean Helm", augments={'Attack+15','Damage taken-3%','DEX+2',}},
body="Chev. Cuirass +1",
hands={ name="Odyssean Gauntlets", augments={'Accuracy+28','Damage taken-2%','Attack+2',}},
legs={ name="Odyssean Cuisses", augments={'Damage taken-3%','STR+8','Attack+8',}},
feet={ name="Odyssean Greaves", augments={'Attack+17','Damage taken-3%','VIT+9','Accuracy+14',}},
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Assuage Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
sets.defense.Reraise = {ammo="Amar Cluster",
head="Twilight Helm",
body="Twilight Mail",
hands="Chev. Gauntlets +1",
legs="Carmine Cuisses +1",
feet="Chev. Sabatons +1",
neck="Twilight Torque",
waist="Dynamic Belt +1",
left_ear="Assuage Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
--Resist Charm in progress
-- sets.defense.Charm = {ammo="Amar Cluster",
-- head="Souveran Schaller",
--body="Chev. Cuirass +1",
--hands="Chev. Gauntlets +1",
--legs="Carmine Cuisses +1",
--feet="Chev. Sabatons +1",
--neck="Diemer Gorget",
--waist="Dynamic Belt +1",
--left_ear="Assuage Earring",
--right_ear="Thureous Earring",
--left_ring="Defending Ring",
--right_ring="Vocane Ring",
--back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
sets.defense.DTOchain.Repulse = set_combine(sets.defense.DTOchain, sets.Repulse)
sets.defense.DTAegis.Repulse = set_combine(sets.defense.DTAegis, sets.Repulse)
sets.defense.DTOchain.Reraise = set_combine(sets.defense.DTOchain, sets.Reraise)
sets.defense.DTAegis.Reraise = set_combine(sets.defense.DTAegis, sets.Reraise)
sets.defense.DTOchain.RepulseReraise = set_combine(sets.defense.DTOchain, sets.Reraise, sets.Repulse)
sets.defense.DTAegis.RepulseReraise = set_combine(sets.defense.DTAegis, sets.Reraise, sets.Repulse)
--------------------------------------
-- Engaged sets
--------------------------------------
sets.engaged.XcalOchain = {main="Excalibur", sub="Ochain",
ammo="Amar Cluster",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Carmine Cuisses +1",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Digni. Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
sets.engaged.XcalAegis = {main="Excalibur", sub="Aegis",
ammo="Amar Cluster",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Carmine Cuisses +1",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Digni. Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
sets.engaged.BurtOchain = {main="Burtgang", sub="Ochain",
ammo="Amar Cluster",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Carmine Cuisses +1",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Digni. Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
sets.engaged.BurtAegis = {main="Burtgang", sub="Aegis",
ammo="Amar Cluster",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Carmine Cuisses +1",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Digni. Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
sets.engaged = {main="Burtgang", sub="Ochain",
ammo="Amar Cluster",
head="Souveran Schaller",
body="Chev. Cuirass +1",
hands="Chev. Gauntlets +1",
legs="Carmine Cuisses +1",
feet="Chev. Sabatons +1",
neck="Diemer Gorget",
waist="Dynamic Belt +1",
left_ear="Digni. Earring",
right_ear="Thureous Earring",
left_ring="Defending Ring",
right_ring="Vocane Ring",
back={ name="Rudianos's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Enmity+10',}},}
--sets.engaged.DW = sets.engaged
--sets.engaged.DW.Acc = sets.engaged
--------------------------------------
-- Custom buff sets
--------------------------------------
sets.buff.Doom = {ring2="Saida Ring"}
sets.buff.Cover = {head="Reverence Coronet +1", body="Caballarius Surcoat +1"}
sets.engaged.Reraise = set_combine(sets.engaged, sets.Reraise)
--sets.engaged.DW.PDT =sets.engaged
--sets.engaged.DW.Acc.PDT = sets.engaged
--sets.engaged.DW.Reraise = set_combine(sets.engaged, sets.Reraise)
--sets.engaged.DW.Acc.Reraise = set_combine(sets.engaged, sets.Reraise)
--------------------------------------
-- Custom buff sets
--------------------------------------
sets.buff.Doom = {ring2="Saida Ring"}
sets.buff.Cover = {head="Reverence Coronet +1", body="Caballarius Surcoat"}
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for standard casting events.
-------------------------------------------------------------------------------------------------------------------
function job_midcast(spell, action, spellMap, eventArgs)
-- If DefenseMode is active, apply that gear over midcast
-- choices. Precast is allowed through for fast cast on
-- spells, but we want to return to def gear before there's
-- time for anything to hit us.
-- Exclude Job Abilities from this restriction, as we probably want
-- the enhanced effect of whatever item of gear applies to them,
-- and only one item should be swapped out.
if state.DefenseMode.value ~= 'None' and spell.type ~= 'JobAbility' then
handle_equipping_gear(player.status)
eventArgs.handled = true
end
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for non-casting events.
-------------------------------------------------------------------------------------------------------------------
--Called when the player's status changes.
function job_state_change(field, new_value, old_value)
classes.CustomDefenseGroups:clear()
classes.CustomDefenseGroups:append(state.ExtraDefenseMode.current)
classes.CustomMeleeGroups:clear()
classes.CustomMeleeGroups:append(state.ExtraDefenseMode.current)
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------
-- Called by the 'update' self-command, for common needs.
-- Set eventArgs.handled to true if we don't want automatic equipping of gear.
function job_update(cmdParams, eventArgs)
update_defense_mode()
end
-- Modify the default idle set after it was constructed.
function customize_idle_set(idleSet)
if state.Buff.Doom then
idleSet = set_combine(idleSet, sets.buff.Doom)
end
return idleSet
end
-- Modify the default melee set after it was constructed.
function customize_melee_set(meleeSet)
if state.Buff.Doom then
meleeSet = set_combine(meleeSet, sets.buff.Doom)
end
return meleeSet
end
function customize_defense_set(defenseSet)
if state.ExtraDefenseMode.value ~= 'None' then
defenseSet = set_combine(defenseSet, sets[state.ExtraDefenseMode.value])
end
if state.Buff.Doom then
defenseSet = set_combine(defenseSet, sets.buff.Doom)
end
return defenseSet
end
function display_current_job_state(eventArgs)
if state.DefenseMode.value ~= 'None' then
msg = msg .. ', Defense: ' .. state.DefenseMode.value .. ' (' .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ')'
end
if state.ExtraDefenseMode.value ~= 'None' then
msg = msg .. ', Extra: ' .. state.ExtraDefenseMode.value
end
if state.Kiting.value == true then
msg = msg .. ', Kiting'
end
add_to_chat(122, msg)
eventArgs.handled = true
end
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
-- Default macro set/book
if player.sub_job == 'DNC' then
set_macro_page(5, 2)
elseif player.sub_job == 'NIN' then
set_macro_page(4, 2)
elseif player.sub_job == 'RDM' then
set_macro_page(3, 2)
else
set_macro_page(7, 1)
end
end