lotrointerface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Lua Programming Help (L)

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Unread 11-21-2015, 05:15 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 340
Quote:
Originally Posted by Elliss11
CombatChanged = function(sender, args)
if not localPlayer:IsInCombat() then
--BodyStatus:SetText("6")

<<<<<<<


killcount=6;
do_update()
end
end
AddCallback(localPlayer, "InCombatChanged", CombatChanged)



Is it still possible here with a sleep function to install ??

because the buff after end of the fight still goes 9sec
This is a tiny bit more complicated - instead of testing the combat state whenever you exit combat, it sounds as though you want to determine when the buff ends. That raises a new question, do you want the status changed whenever the buff ends, or only when it ends out of combat? In either case, you want an event handler that tracks the player EffectList, not the combat state change. Unfortunately, I haven't played with effect lists much and without knowing exactly which effect you are trying to track, I can't provide the exact code, but the basic idea is that you want to handle the EffectRemoved event for the local player EffectList and test for the specific effect you are using as a condition.

The general idea is something like:
Code:
  localPlayer=Turbine.Gameplay.LocalPlayer:GetInstance();
  effectList=localPlayer:GetEffects()
  EffectRemovedHandler=function(sender,args)
    if args.Effect:GetName()=="some effect" then
      killcount=6;
      do_update()
    end
  end
  AddCallback(effectList,"EffectRemoved",EffectRemovedHandler)
where "some effect" is the actual name of the Effect you are looking for.
Note, I didn't have a chance to test this in game so the args.Effect element may not exist in which case you would have to check what the actual elements in the args table are. To list the elements, use:
Code:
  EffectRemoved=function(sender,args)
    for k,v in pairs(args) do
      Turbine.Shell.WriteLine(tostring(k)..":"..tostring(v))
    end
  end
If you only want to set the status when out of combat then just add a test for localPlayer:IsInCombat() to the handler:
Code:
  localPlayer=Turbine.Gameplay.LocalPlayer:GetInstance();
  effectList=localPlayer:GetEffects()
  EffectRemovedHandler=function(sender,args)
    if args.Effect:GetName()=="some effect" and not localPlayer:IsInCopmbat() then
      killcount=6;
      do_update()
    end
  end
  AddCallback(effectList,"EffectRemoved",EffectRemovedHandler)

Last edited by Garan : 11-21-2015 at 05:17 PM. Reason: grammar
Reply With Quote
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
16.5, now in beta on Bullroarer, has one Lua fix magill Interface Requests (L) 0 09-26-2015 06:17 AM
Update 15 has Lua Fixes !!!! magill General Authoring Discussion (L) 4 11-05-2014 01:17 PM
Multiply variable reading of io.open Calax Lua Programming Help (L) 1 10-29-2011 03:36 AM
Combat Chat bar londarhawk LotRO Wish List (L) 1 11-26-2010 06:31 PM
Chat Box AUtz Interface Help (D) 1 05-21-2009 10:56 AM


All times are GMT -5. The time now is 06:48 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui