LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Interface Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=3)
-   -   Thoughts on toggling a toolbar when on a warsteed? (https://www.lotrointerface.com/forums/showthread.php?t=1863)

Delone 08-25-2012 02:51 AM

Thoughts on toggling a toolbar when on a warsteed?
 
From the Rohan prelim notes posted here:
http://www.lotrointerface.com/forums...ead.php?t=1862

I see:
• Added GetMount to LocalPlayer.
• Added Mount, BasicMount, and CombatMount.

If I've been using this to toggle a UI quickslot bar on/off when in combat,

self.player = Turbine.Gameplay.LocalPlayer.GetInstance();
AddCallback(self.player, "InCombatChanged", function(sender, args)
self:SetVisible( self.player:IsInCombat() );
end);

What would be the correct structure for changing this to work to toggle the quickslot on whilst using a CombatMount given the above information?
On Bullroarer, replacing "InCombatChanged" with "MountChanged" works to trigger an event when I mount and dismount (either a normal mount or a warsteed), but can't work out what to use to get visiblility of the quickslot to change in place of (self.player:IsInCombat)
Any suggestions?

MrJackdaw 09-01-2012 06:30 AM

Finally got on the beta - similar thoughts to yourself and nearly working. Can't work out how to figure out if it is a combat mount or not.

Delone 09-01-2012 10:52 AM

Weird thing is, if I put a writeline after using MountChanged to show when it triggers, it fires 3 times when mounting, and twice when dismounting.

/emote confused.

MrJackdaw 09-01-2012 12:11 PM

I have been testing this;

Code:

import "Turbine.Gameplay"

player = Turbine.Gameplay.LocalPlayer.GetInstance()

player.MountChanged=function(sender,args)

        Geoff=player:GetMount()
       

        --No mount? Then Geoff==nil else it points to an object for which we can get Morale, Power etc.

        if Geoff~=nil then
                        Turbine.Shell.WriteLine(Geoff:GetName())
                        --How to test if it is a combat mount or not?
                        --How about calling a skill that ONYL WORKS FOR COMBAT MOUNTS?
                        Turbine.Shell.WriteLine(Geoff:GetTurnRate())
        end

end

And it seems to work - throws an error of course if the mount is not a combat mount.

Now, and this is a big problem, I can't figure out how to get a combat mount without progressing the epic story - and I want to leave that until I get the expansion, not ruin it for myself.

Can anyone confirm that this throws an error if the mount is NOT a combat mount, but doesn't throw an error for a combat mount.

Oh! And the multiple trigger thing is quite common - don't worry about it. It's to do with the way buffs are handled.

Garan 09-01-2012 12:26 PM

Quote:

Originally Posted by MrJackdaw (Post 8133)
Finally got on the beta - similar thoughts to yourself and nearly working. Can't work out how to figure out if it is a combat mount or not.

I haven't had a chance to check on war steeds yet, but you could try using GetMount() to get a mount instance and then check what methods are available for the mount. Regular steeds only have Constructor(), IsA(), GetName(), IsLocalPlayer(), GetMaxMorale() and GetMorale(). I believe the war steed instance will have additional methods since they have additional properties. You could then test for the existance of any additional method to determine if it is a war steed. You would also have to check into what it shows as available when the war steed is used for travelling outside Rhohan, I don't know if the methods will not be available as with a regular mount or if they will return nil or zero or their regular values. Hopefully I will be able to convince my game machine to stop spewing smoke long enough to check into this further.

EDIT: I see you posted a similar solution while I was busy checking the mount methods. In your case, you can assign a variable to the existance of the GetTurnRate method on the mount, Geoff:

isWarSteed=(Geoff.GetTurnRate==nil)


Of course, it would be better if Turbine implemented a MountInfo object that the mount instance could provide which could then have the MountType enumeration and any other info that is mount related. Unfortunately this does not exist, at least not yet.

bsmorgan 09-01-2012 02:19 PM

Quote:

Originally Posted by MrJackdaw (Post 8135)
Now, and this is a big problem, I can't figure out how to get a combat mount without progressing the epic story - and I want to leave that until I get the expansion, not ruin it for myself.

You can get a combat mount by doing all the Langhold quests (the first quests in Rohan).

Delone 09-01-2012 06:49 PM

Quote:

Originally Posted by MrJackdaw (Post 8135)
I have been testing this;

Code:

import "Turbine.Gameplay"

player = Turbine.Gameplay.LocalPlayer.GetInstance()

player.MountChanged=function(sender,args)

        Geoff=player:GetMount()
       

        --No mount? Then Geoff==nil else it points to an object for which we can get Morale, Power etc.

        if Geoff~=nil then
                        Turbine.Shell.WriteLine(Geoff:GetName())
                        --How to test if it is a combat mount or not?
                        --How about calling a skill that ONYL WORKS FOR COMBAT MOUNTS?
                        Turbine.Shell.WriteLine(Geoff:GetTurnRate())
        end

end

And it seems to work - throws an error of course if the mount is not a combat mount.

Now, and this is a big problem, I can't figure out how to get a combat mount without progressing the epic story - and I want to leave that until I get the expansion, not ruin it for myself.

Can anyone confirm that this throws an error if the mount is NOT a combat mount, but doesn't throw an error for a combat mount.

Oh! And the multiple trigger thing is quite common - don't worry about it. It's to do with the way buffs are handled.

Confirmed for throwing error. Going out for Fathers day, should be able to test further later. Thanks :)

Delone 09-02-2012 12:05 AM

Probably not at all an optimal way of doing things, but confirmed working method to show plugin "mountslots" only when on the Warsteed

Code:

self.player = Turbine.Gameplay.LocalPlayer.GetInstance()
self.player.MountChanged=function(sender,args)
    selfmount=self.player:GetMount()
    if selfmount==nil then
    mountslots:SetVisible( false );
            else
          if  selfmount.GetTurnRate~=nil then
          mountslots:SetVisible( true );
          else
          mountslots:SetVisible( false );
          end
    end
end


MrJackdaw 09-02-2012 12:45 AM

Excellent!

Like you say, I am sure there will be a Mount:IsCombatMount() function or soemthing similar, but if this works we have a workaround!

EDIT:

Tried this, seems "Nicer";

Code:

import "Turbine.Gameplay"

player        = Turbine.Gameplay.LocalPlayer.GetInstance()


function player:IsCombatMount()
        local Mount        = self:GetMount()
        if Mount~=nil then
                return (Mount.GetTurnRate~=nil)
        end
end

function player:IsMounted()
        local Mount        = self:GetMount()
        return Mount~=nil
end

player.MountChanged=function(sender,args)       

        if player:IsMounted() then
                        local Mount        = player:GetMount()
                        Turbine.Shell.WriteLine(Mount:GetName())
                if player:IsCombatMount() then
                        Turbine.Shell.WriteLine("Combat Mount")
                else
                        Turbine.Shell.WriteLine("Non Combat Mount")
                end
        else
                        Turbine.Shell.WriteLine("No Mount")
        end

end


MrJackdaw 09-02-2012 12:54 AM

I have noticed some very interesting things happening when you get out your mount when you are in a stance - it disappears! *All* buffs appear to disappear when you mount now, making a "IsMounted" function really important.

Off topic, but has any information been released for the Toolbar so we can run off and fix our skins?


All times are GMT -5. The time now is 04:05 PM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI