Modding Question: How to add optional self-targeting to the QoT Bramble Shield

Good Morning,

In the spirit of doing more modding as a community, I thought I'd share my recent problem to get feedback and provide some lua examples to those unfamiliar with the demigods lua code.

Task:

One of the things I've been working on is to find a way to allow the QoT to automatically self-target her shield when she needs to (i.e., when running away). The theory can then be extended for use on the Oak's shield, Sedna's heal, and QoT's Mulch Shambler. My idea was that if '3' is the hotkey for the ability, then shift + 3, control + 3, or alt +3, should be suitable alternatives.

Progress:

I've made it so I can autocast on the QoT. However, there are issues having both of the skills overlap.

Problems:

Icon overlap:

The self-shield and shield icons (in position 3) overlap on the skill bar. When the skill is recharging the icon has two layers of red applied instead of just the one. Additionally, this glitch is still present when unpacked with the unpacked skill set. Trying to 'hide' or place the icon in an unviewable place causes all of the unpacked skills to be represented by grey (null?) icons, and none of the skills are responsive, even with hotkeys.

Hotkey failure:

The # is not a valid hotkey (shift + 3), neither is $ or @. I'm assuming this is true for all of the shift + number combinations, although i haven't tested them. Forum users suggests a double tap method, press 3 twice to self-cast, but I don't think this would work out well in the heat of battle.

Code changes thus far:

Two changes are necessary. The first adds the ability to the QoT's. The second adds it to her level up tree so she can use it. Once this is fixed, duplicate entries for all levels of her Bramble Shield would be necessary.

 

First, the ability code itself. (note, the code isn't in c++, but the formatting seems to work out)

Code: c++
  1. #######################
  2. ##Add to HQueen_Abilities.lua
  3. #######################
  4. AbilityBlueprint {
  5.     Name = 'HQueenBrambleShield01S',
  6.     DisplayName = '<LOC ABILITY_Queen_0032>Bramble Shield I',
  7.     Description = '<LOC ABILITY_Queen_0037>Thorns form a shield around an allied unit, absorbing [GetAbsorbAmt] damage.\nOnly one absorption effect per unit may be active at a time.',
  8.     AbilityType = 'Instant', #This makes it self-cast
  9.     EnergyCost = 400,
  10.     Cooldown = 7,
  11.     RangeMax = 20,
  12.     UISlot = 3, #This specifies what clickable skill number it is. Putting this as null or out of range doesn't work out.
  13.     HotKey = '3', #I tried a couple of things, none of them worked.
  14.     CastAction = 'Shield',
  15.     FollowThroughTime = 1.5,
  16.     AbilityCategory = 'HQUEENPACKED',
  17.     SharedCooldown = 'HQueenBrambleShield01', #This makes the selfshield and shield use the same cool down timers.
  18.     Icon = '/dgqueenofthorns/NewQueenBrambleShield01',
  19.     CanCastWhileMoving = true, #Thrown in because it makes sense. If balance requires her to stop while casting, then this can be removed.
  20.     GetAbsorbAmt = function(self) return math.floor( Buffs['HQueenBrambleShield01'].Affects.Absorption.Add ) end,
  21.     Buffs = {
  22.         BuffBlueprint {
  23.             Name = 'HQueenBrambleShield01',
  24.             Debuff = false,
  25.             DisplayName = '<LOC ABILITY_Queen_0034>Bramble Shield',
  26.             Description = '<LOC ABILITY_Queen_0035>Protected from damage.',
  27.             BuffType = 'ABSORB',
  28.             Stacks = 'REPLACE',
  29.             Icon = '/dgqueenofthorns/NewQueenBrambleShield01',
  30.             Duration = 30,
  31.             Affects = {
  32.                 Absorption = { Add = 700 },
  33.             },
  34.             SoundLoop = 'Forge/DEMIGODS/QueenOfThorns/snd_dg_qothorns_brambleshield',
  35.             Effects = 'Bramble01',
  36.         }
  37.     },
  38. }

 

And secondly the one line change to add it to her level up choices. I made it so that when Bramble shield is taken, both abilities are gained.

Code: c++
  1. ########################
  2. ##Edit and add the one noted line to HQueen_unit.bp
  3. ########################
  4.             #################################################################################################################
  5.             # Bramble Shield I            #################################################################################################################
  6.             HQueenBrambleShield01 = {
  7.                 Gains = {
  8.                     'HQueenBrambleShield01',
  9.                     'HQueenBrambleShield01S',  ##This is the line to add the selfshield
  10.                 },
  11.                 Icon = '/dgqueenofthorns/NewQueenBrambleShield01',
  12.                 Level = 1,
  13.                 Loses = {
  14.                     'HQueenBrambleShieldGrey01',
  15.                 },
  16.             },

 

So, anyone have any ideas or suggestions how to fix the problems I've gotten?

5,889 views 14 replies
Reply #1 Top

As an addendum to this, is it just me or did the preview option disappear? Or am I confused, and there never was a preview option?

Also, do you think Stardock would add a code ="lua" formatting style?

Reply #2 Top

I think it would be better to mod the gui so something like ctrl-click on icon will cast the spell on yourself.

edit:

Bind shift-number key like this:

['Ctrl-1'] = 'ping_move'
['Shift-2'] = 'ping_attack'
['Alt-3'] = 'ping_alert'

Reply #3 Top

I don't much about coding, but is there any way to double-tap a key to get it to be used on oneself?

Perhpas only if an option to allow for said double-tapping is turned on?

Reply #4 Top

A way to do this would be to alter the place where AbilityType = 'Instant' is handeled, and intercept where the hotkey use calls the skill and reapplay an self selected click there if ctrl was used, basicly using the same skill, so there's no overlay problems.

Reply #5 Top

The game isn't made to use 2-button hotkeys, you would need to mod the core keymapping stuff.

Reply #6 Top

I don't know enough about modding to contribute anything but a "YAY"! :grin:

Reply #7 Top

Some updates if anyone is curious.

1. The above shield code is glitched some how, when I was adjusting things earlier I broke it and I'm not sure what went wrong.

2. I've looked into the keybinding files. There are a bunch of them. I'm not grokking them. Fun times.

Reply #8 Top

look at my bombing run code to see how i handled additional keys, i've also got a working copy of something like this but for all casts, whereby holding CTRL and casting results in it auto casting on yourself.

Reply #9 Top

Ah, I take it then your account on the trac site is gunblob? I who that was.

Reply #10 Top

gunblob is me.. I hope Malard is talking about the patch I submitted to trac, otherwise I spent time duplicating his work.

Reply #11 Top

Quoting gunblob, reply 10
gunblob is me.. I hope Malard is talking about the patch I submitted to trac, otherwise I spent time duplicating his work.

That's some awesome work. I looked at it for an hour, and still didnt understand it :)

Reply #12 Top

the patch on trac will get merged in soon :), i've been away (and still am away) on business.

 

I will be catching up this weekend hopefully.

 

 

Reply #13 Top

This still in the works cause I really liked the idea

Reply #14 Top

Its already working in old version of Demigod which allows modding.