Jump to content


Photo

Switching locomotors via LocomotorSetUpgrade


  • Please log in to reply
No replies to this topic

#1 Echo

Echo

    T3A:Online

  • T3A Staff
  • 1,069 posts
  • Location:Germany
  • Projects:Lot3A
  •  ~~
  • Division:BFME
  • Job:T3A Moderator
  • Donated

Posted 06 September 2019 - 03:07 AM

Hey, so has someone actually successfully killed a locomotor upgrade properly to reactivate it later? I know there this in the Tower Guard's code:

Spoiler


I don't know if this is supposed to work, but it doesn't work properly for me. The triggering upgrades however (assigned through LUA), do work. They successfully trigger commandset upgrades back and forth. Just the locomotor won't change correctly - it just upgrades or removes the locomotor completely in reverse to my intention. I found out that the first time the locomotor is supposed to be upgraded, it doesn't upgrade. After that, it upgrades every time. Therefore the conditions are switched and it looks silly because it then uses the correct locomotors in the wrong Model Condition States.


My locomotors:

    LocomotorSet
        Locomotor     = NormalMeleeUnitLocomotor
        Condition     = SET_NORMAL
        Speed         = LOT3A_NORMAL_GOOD_INFANTRY_UNIT_SPEED
    End

    LocomotorSet
        Locomotor = NormalUpgradedUnitLocomotor
        Condition = SET_NORMAL_UPGRADED
        Speed     = LOT3A_NORMAL_UPGRADED_UNIT_SPEED
    End

My locomotor enabling:

    ; Start NOT upgraded - not sure if needed but EA has it too. Doesn't make any difference for me though. Result is the same
    Behavior = GrantUpgradeCreate ModuleTag_09
        UpgradeToGrant = Upgrade_RevertUpgrade
    End

    ; Remove Upgrade locomotor 
    Behavior = LocomotorSetUpgrade ModuleTag_KillUpgradedLocomotor
        TriggeredBy = Upgrade_RevertUpgrade
        RemovesUpgrades = Upgrade_DoUpgrade
        KillLocomotorUpgrade = Yes ;Removes the PlantShield locomotor. ; But at the wrong time ffs <_<
    End

    ; This works just fine. All the time and at the correct time
    Behavior = CommandSetUpgrade ModuleTag_ToggleRegularCommandSet
        TriggeredBy        = Upgrade_RevertUpgrade
        CommandSet        = RohanWarriorCommandSet
    End  

  
    
    ; On Upgraded Locomotor 
    Behavior = LocomotorSetUpgrade ModuleTag_ActivateUpgradedLocomotor
        TriggeredBy = Upgrade_DoUpgrade
        RemovesUpgrades = Upgrade_RevertUpgrade
    End

    ; This works just fine as well.
    Behavior = CommandSetUpgrade ModuleTag_ToggleUpgradedCommandSet
        TriggeredBy        = Upgrade_DoUpgrade
        CommandSet        = RohanWarriorUpgradedCommandSet
    End

Everything works just fine, only the locomotor behavior (turn rate, slow down rate) does not blend in because the first time the ability is clicked, it won't upgrade correctly, therefore dooming the entire locomotor switch.

Just in case, this is the LUA, but it should be straightforward:
 

function OnActivateUpgradeState(self)
    ObjectGrantUpgrade( self, "Upgrade_DoUpgrade" )
end

function OnRevertUpgradeState(self)
    ObjectGrantUpgrade( self, "Upgrade_RevertUpgrade" )
end

^ Please note that "ObjectRemoveUpgrade" is not a valid LUA call in BFME 1.

 

If anyone has any helpful tips/hints, I would appreciate it. I've been trying for quite some time now. I will update once I find a solution. It might be something just as simple as having them in wrong order. At least changing the order changes the locomotor behavior. As I said, all works as intended, all upgrades. But the Locomotor fails to upgrade the first time it is triggered.


Edited by Echo, 06 September 2019 - 03:26 AM.

26285.png





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users