New Area Function? (Councilor's Garb)

Language: JP EN DE FR
2010-09-08
New Items
users online
Forum » Windower » Support » new area function? (Councilor's Garb)
new area function? (Councilor's Garb)
 Sylph.Elgorian
Offline
Server: Sylph
Game: FFXI
user: Elgorian
Posts: 305
By Sylph.Elgorian 2019-06-04 11:27:11
Link | Quote | Reply
 
I was wondering if there was some kind of function that checks when you enter a new area and changes gear accordingly?

Example: I'd like Councilor's Garb to equip when I enter one of the two Adoulin areas.

Right now I have it set-up to check for Western/Eastern in my Aftercast and old/new status. This requires an ability use or me to /rest and then stand up or something.

Just wondering if there was a way to just equip it without an input when I enter into a new zone.
 Asura.Epigram
Offline
Server: Asura
Game: FFXI
user: jlisic
Posts: 115
By Asura.Epigram 2019-06-04 11:56:22
Link | Quote | Reply
 
I haven't tried this, but this should work
Code
windower.register_event('zone change',function(new, old)

  -- Western is 256
  -- Eastern is 257

  if( new==256) then
    equip(sets.aftercast.IdleAdoulin)
  elseif ( new==257 ) then
    equip(sets.aftercast.IdleAdoulin)
  end

end)
 Bismarck.Xurion
Offline
Server: Bismarck
Game: FFXI
user: Xurion
Posts: 693
By Bismarck.Xurion 2019-06-04 12:07:22
Link | Quote | Reply
 
I had a feeling that may not work due to the loading phase after you zone but I can't validate it because I'm not at home.

I'd suggest locking the body slot until you zone out otherwise any other action will equip a different body.
Code
windower.register_event('zone change',function(zone_id)
  if zone_id == 256 or zone_id == 257 then
    equip(sets.aftercast.IdleAdoulin)
    disable('body')
  else
    enable('body')
  end 
end)
 Sylph.Elgorian
Offline
Server: Sylph
Game: FFXI
user: Elgorian
Posts: 305
By Sylph.Elgorian 2019-06-04 18:00:19
Link | Quote | Reply
 
Just wondering - where did you get the zone ids from?
 Asura.Chiaia
VIP
Offline
Server: Asura
Game: FFXI
user: Demmis
Posts: 1652
By Asura.Chiaia 2019-06-04 18:26:27
Link | Quote | Reply
 
Sylph.Elgorian said: »
Just wondering - where did you get the zone ids from?
Probably from here: Windower4\res\zones.lua

If you're going to be adding this to a gearswap lua you could just do this so you don't have to use IDs.
Code
windower.register_event('zone change',function()
  if world.area == 'Eastern Adoulin' or world.area == 'Western Adoulin' then
    equip(sets.aftercast.IdleAdoulin)
    disable('body')
  else
    enable('body')
  end 
end)
 Sylph.Elgorian
Offline
Server: Sylph
Game: FFXI
user: Elgorian
Posts: 305
By Sylph.Elgorian 2019-06-04 19:42:55
Link | Quote | Reply
 
Asura.Chiaia said: »
Sylph.Elgorian said: »
Just wondering - where did you get the zone ids from?
Probably from here: Windower4\res\zones.lua

If you're going to be adding this to a gearswap lua you could just do this so you don't have to use IDs.
Code
windower.register_event('zone change',function()
  if world.area == 'Eastern Adoulin' or world.area == 'Western Adoulin' then
    equip(sets.aftercast.IdleAdoulin)
    disable('body')
  else
    enable('body')
  end 
end)

I wasn't able to get this to work. The other one worked great though! Thanks
 Carbuncle.Kigensuro
Offline
Server: Carbuncle
Game: FFXI
user: dlsmd
Posts: 93
By Carbuncle.Kigensuro 2019-06-04 20:36:36
Link | Quote | Reply
 
you cant equip gear outside of gearswap called function chains
so you have to make gearswap call a function with gearswap.equip_sets

also world.area might not be updated fast enuf for the function as windower.register_event works from windower not from gearswap

this is how i did it
Code
--Zone_change_delay = 5 --uncomment this line and change to desired seconds if needed(default = 5)

cities = S{"Ru'Lude Gardens","Upper Jeuno","Lower Jeuno","Port Jeuno","Port Windurst","Windurst Waters","Windurst Woods","Windurst Walls","Heavens Tower",
    "Port San d'Oria","Northern San d'Oria","Southern San d'Oria","Chateau d'Oraguille","Port Bastok","Bastok Markets","Bastok Mines","Metalworks",
    "Aht Urhgan Whitegate","Tavnazian Safehold","Nashmau","Selbina","Mhaura","Norg","Eastern Adoulin","Western Adoulin","Kazham"}

windower.raw_register_event('zone change', function (new_id,old_id)
    local zones = gearswap.res.zones
    local new_zone = zones[new_id].name
    coroutine.schedule(gearswap.equip_sets:prepare('zone_change',nil,new_zone,zones[old_id].name,cities:contains(new_zone)),(Zone_change_delay or 5))
end)

function zone_change(new,old,city)
    ---------------------------------------
    --new     string    The name of the new zone
    --old     string    The name of the old zone
    --city    boolean   true if new zone is a city
    ---------------------------------------
    --change gear with
    --equip(<setname>)
    ---------------------------------------
    --example: rule (change gear on entering city)
    --if city then
    --  equip(sets.city)
    --end
    ---------------------------------------
    
end


yes the delay in this code is needed or else you could try to equip gear between zones
necroskull Necro Bump Detected! [93 days between previous and next post]
Offline
Posts: 281
By Galkapryme 2019-09-06 04:57:43
Link | Quote | Reply
 
Another option (that still requires an action of sorts) - Simply create an Adoulin Macro. While I have my town.idle sets, these require some kind of action. If I don't feel like waiting, I just hit my Adoulin Macro, which equips the Councilor's Garb, plus whatever leg or feet armor is associated with that job. This way, I essentially have an increased speed macro for any zone. This comes in handy when I am traveling to a party camp, as well.
Online
Posts: 665
By kishr 2019-09-06 07:28:25
Link | Quote | Reply
 
Your looking for something like this.
Code
----- MOVEMENT SETS      -- add this at the top you your lua inside your sets
sets.MoveSpeed = {feet = "Herald's Gaiters",}    --auto swaps when moving
sets.Adoulin = {body="Councilor's Garb",}   --auto swaps when in adoulin 


----- MOVEMENT           add this to the end of your lua
mov = {counter=0}
if player and player.index and windower.ffxi.get_mob_by_index(player.index) then
    mov.x = windower.ffxi.get_mob_by_index(player.index).x
    mov.y = windower.ffxi.get_mob_by_index(player.index).y
    mov.z = windower.ffxi.get_mob_by_index(player.index).z
end

moving = false
windower.raw_register_event('prerender',function()
    mov.counter = mov.counter + 1;
    if mov.counter>15 then
        local pl = windower.ffxi.get_mob_by_index(player.index)
        if pl and pl.x and mov.x then
            dist = math.sqrt( (pl.x-mov.x)^2 + (pl.y-mov.y)^2 + (pl.z-mov.z)^2 )
            if dist > 1 and not moving then
                send_command('gs c update')
                send_command('gs equip sets.MoveSpeed')
                if world.area:contains("Adoulin") then
                    send_command('gs equip sets.Adoulin')
                end
        moving = true
            elseif dist < 1 and moving then
                send_command('gs equip sets.idle')
                moving = false
            end
        end
        if pl and pl.x then
            mov.x = pl.x
            mov.y = pl.y
            mov.z = pl.z
        end
        mov.counter = 0
    end
end)


It auto swaps to Adoulin gear when in a Adoulin area.

Also auto changes your movement gear when you movement speed is greater than 1 and returns it to none movement gear when movement is less than 1.
Offline
Posts: 36
By Longsnake 2019-09-06 08:37:44
Link | Quote | Reply
 
Councilor's Garb is set to equip in this chain when in a zone whose name contains "Adoulin".


Code
function status_change(new,old)
	check_equip_lock()
	if Armor == 'PDT' then
		equip(sets.PDT)
	elseif new == 'Engaged' then
		equipSet = sets.Melee
		if equipSet[AccArray[AccIndex]] then
			equipSet = equipSet[AccArray[AccIndex]]
		end
		equip(equipSet)
	elseif new == 'Idle' then
		equipSet = sets.Idle
		if equipSet[IdleArray[IdleIndex]] then
			equipSet = equipSet[IdleArray[IdleIndex]]
		end
		if buffactive['Reive Mark'] then -- Equip Arciela's Grace +1 During Reive --
			equipSet = set_combine(equipSet,{neck="Arciela's Grace +1"})
		end
		if world.area:endswith('Adoulin') then -- Equip Councilor's Garb in Adoulin zones --
			equipSet = set_combine(equipSet,{body="Councilor's Garb"})
		end
		equip(equipSet)
	elseif new == 'Resting' then
		equip(sets.Resting)
	end
end
Log in to post.