1. Triumph has risen from these uncharted shores. The 34th Modeling Contest Results are out!
    Dismiss Notice
  2. Awaken what lies in the heart of your swarm. The 17th Techtree Contest has arrived!
    Dismiss Notice
  3. The Hive Workshop is launching its first HD modelling contest. How HD should it be?
    Dismiss Notice
  4. Check out the Staff Job Openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Gaias Retaliation II - A small Preview

Discussion in 'Gaias Retaliation ORPG' started by Zwiebelchen, Feb 9, 2020.

  1. Planetary

    Planetary

    Joined:
    Feb 7, 2020
    Messages:
    291
    Resources:
    2
    Maps:
    1
    Spells:
    1
    Resources:
    2
    I'm curious: how did you tackle multiple hotkeys outside of the A-Z range for abilities? Did you replace the default WC3 ability mechanics with a completely-custom spell system?

    I feel like there's a trick I missed as I ended up with a convoluted package that maps dummy abilities and real abilities with ForceUIKey. And that was a lot of over-engineering to get 1-4 to work, kek.
     
  2. FeelsGoodMan

    FeelsGoodMan

    Joined:
    Dec 13, 2018
    Messages:
    1,723
    Resources:
    6
    Maps:
    3
    Template:
    1
    Ported Models:
    2
    Resources:
    6
    I think Oskey is the commonly used thing for that; Oskey - Player Key Event
     
  3. Planetary

    Planetary

    Joined:
    Feb 7, 2020
    Messages:
    291
    Resources:
    2
    Maps:
    1
    Spells:
    1
    Resources:
    2
    I have that included, but I was hoping there'd be a better way to get ability functionality without having to trigger default abilities (e.g. ForceUIKey activates a hidden dummy ability on the unit). The problem with ForceUIKey is there is a few frames of delay that is actually quite noticeable, especially with targeted spells.

    This would have all been easily solved for my use case if BlzFrameClick friggen worked on command buttons.
     
  4. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,603
    Resources:
    0
    Resources:
    0
    What I've been doing is using different Channel abilities, each one with it's own Hotkey. Then I adjust the properties of the Channel ability using BlzSetAbilityInteger/Real/Boolean to modify cast range, cooldown, costs, targets allowed, targeting type, etc...

    For example, when the player assigns a skill to the "Q" slot in their hotbar, I figure out what skill it is, and modify the properties of that unit's "Q" ability to match the properties of the new skill. Then I assign a function to be called when you cast that ability.

    Here's some example code.
    Modifying the Channel abilities:
    Code (Lua):

    --Target Types: 0 = Instant, 1 = Target Unit, 2 = Target Point, 3 = Target Both
    --Options: 1 = Visible, 7 = Visible + Targeting Image
    local u = YourHero
    local a = ChannelAbility
    BlzSetAbilityIntegerLevelField(BlzGetUnitAbility(u, a), ABILITY_ILF_OPTIONS, Level, SomeValue)
    BlzSetAbilityIntegerLevelField(BlzGetUnitAbility(u, a), ABILITY_ILF_TARGET_TYPE, Level, SomeValue)
    BlzSetAbilityRealLevelField(BlzGetUnitAbility(u, a), ABILITY_RLF_CAST_RANGE, Level, SomeValue)
    BlzSetAbilityRealLevelField(BlzGetUnitAbility(u, a), ABILITY_RLF_AREA_OF_EFFECT, Level, SomeValue)
     
    Assigning functions to the Channel abilities:
    Code (Lua):

    Abilities = newAutotable(2) --This calls a function I use that creates an X dimensional Array

    --Let's assign Storm Bolt to your Hero's "Q" ability
    local u = YourHero
    local id = FourCC("A000") --This would be the "Q" Channel ability id
    Abilities[u][id] = Cast_StormBolt --So now when your Hero casts "Q" it runs the Cast_StormBolt function

    function Cast_StormBolt(u)
        --Do the spell effects
        local t = GetSpellTargetUnit()
        print(GetUnitName(u).." cast Storm Bolt targeting "..GetUnitName(t))
    end

    --This creates the trigger that will run your Ability functions
    local trig = CreateTrigger()
    TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    TriggerAddAction(trig, function()
        local u = GetTriggerUnit()
        local id = GetSpellAbilityId()
        Abilities[u][id](u) --I pass the casting unit as an argument into the parameters
    end)
     
     
    Last edited: Oct 21, 2020
  5. GhostHunter123

    GhostHunter123

    Joined:
    Oct 17, 2012
    Messages:
    540
    Resources:
    1
    Spells:
    1
    Resources:
    1
    I wonder if Zwiebe is still working on Gaias 2.0 in his time off from the Hive. I wonder if he has realized that TESH has been updated to be compatible with Reforged. Perhaps, his hands could be relieved from the carpal tunnel syndrome by now.