WIP Defense of the Heart

Summoned

New Member
Reaction score
51
Well, I really don't want to spend an hour looking at what the variables/objects are for. And it seems far more complicated to import than most spells. Is there anything in particular you want a spell to do? It's not extremely hard to make something similar.

Made -spawn work, though. I had to put some limits on it, such as you can't use it until the first level starts and you can't use it while the timer's counting down. (You have only 1 global timer, so if I make Spawn Initialization run again, what it'll do is set the timer to 13 for both the current and the next level and will look weird).
 

kirinelf

New Member
Reaction score
10
Well, it's a passive ability. What happens is that every time my character attacks, there's a small chance of an illusion popping out and attacking as well. The illusions last for about 2 seconds before disappearing. The number of illusions and the chance of it happening increases as the level goes up, of which (levels) it has five.

It's a little different from what Mage_Goo has, but I thought I'd be able to fix it up. ^^" By the way, it's completely GUI. However, now that I have JASS, I might be able to play around with it. ^^"

Hmm... So your addition is this:

Trigger:
  • Skip Level
    • Events
      • Player - Player 1 (Red) types a chat message containing -spawn as An exact match
    • Conditions
      • LevelCount Greater than 0
      • LevelCount Less than 40 <I changed this to CreepCount_LastIndex>
      • (Remaining time for CreepTimer) Less than or equal to 0.00
    • Actions
      • Trigger - Run Spawn Initialization <gen> (ignoring conditions)


Right? That looks like what I need, thanks. ^^ Can I implement this along with your other one (That sets the timer to zero, effectively unleashing them straight away when the timer's still counting) along with this? Same command? Or do I have to make a different command for that? I THINK I might be able to use an If/Then/Else action, but I'm not sure. Something like this:

Trigger:
  • Spawn Command
    • Events
      • Player - Player 1 (Red) types a chat message containing -spawn as An exact match
    • Conditions
      • LevelCount Greater than 0
      • LevelCount Less than CreepCount_LastIndex
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Remaining time for CreepTimer) Less than or equal to 0.00
        • Then - Actions
          • Trigger - Run Spawn Initialization <gen> (ignoring conditions)
        • Else - Actions
          • Countdown Timer - Pause CreepTimer
          • Trigger - Run Spawn Creeps <gen> (ignoring conditions)


Or am I completely wrong?
 

Summoned

New Member
Reaction score
51
Most of my change was actually in the Spawn Creeps trigger to make the variables local instead of global. I think what you have won't work because Pausing the Timer doesn't really set the time on it to 0, so it'll just end up spawning more and more creep for the same level.

Check PM.
 

kirinelf

New Member
Reaction score
10
I paused it in that particular trigger there, but then it's destroyed in the Spawn Creeps trigger, or at least it was. Not sure if your changes changed anything. Anyways, I replied to your PM.

Currently working on the difficulty scaler. If it works right, I can lower the number of creeps per wave.
 

Summoned

New Member
Reaction score
51
Destroying a global timer is a very bad idea, because then the subsequent waves won't have a timer. :(

If you destroy it, make sure to add a Custom Script in the Spawn Initialization trigger with: set udg_CreepTimer = CreateTimer() before all the timer functions.
 

kirinelf

New Member
Reaction score
10
Whoops. I meant destroying the window. So this is my trigger for chat string detection:
Trigger:
  • Spawn Command
    • Events
      • Player - Player 1 (Red) types a chat message containing -spawn as An exact match
    • Conditions
      • LevelCount Greater than 0
      • LevelCount Less than CreepCount_LastIndex
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Remaining time for CreepTimer) Less than or equal to 0.00
        • Then - Actions
          • Trigger - Run Spawn Initialization <gen> (ignoring conditions)
        • Else - Actions
          • Countdown Timer - Pause CreepTimer
          • Trigger - Run Spawn Creeps <gen> (ignoring conditions)


Spawn Initialization:
Trigger:
  • Spawn Initialization
    • Events
      • Time - Elapsed game time is 5.00 seconds
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • (Number of living CreepArray[LevelCount] units owned by Player 12 (Brown)) Equal to 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LevelCount Equal to 0
        • Then - Actions
          • Set LevelCount = (LevelCount + 1)
          • Set BonusIncome = (BonusIncome + 200)
          • Countdown Timer - Create a timer window for CreepTimer with title (Wave + ((String(LevelCount)) + ( - + ( ( + (CreepName[LevelCount] + ))))))
          • Countdown Timer - Start CreepTimer as a One-shot timer that will expire in 15.00 seconds
          • Set CreepTimerWindow = (Last created timer window)
          • Countdown Timer - Show CreepTimerWindow
          • Player Group - Pick every player in inGamePlayers and do (Actions)
            • Loop - Actions
              • Player - Add BonusIncome to (Picked player) Current gold
          • Wait 2.00 game-time seconds
        • Else - Actions
          • Game - Display to inGamePlayers for 5.00 seconds the text: Wave complete. Well...
          • Set LevelCount = (LevelCount + 1)
          • Set BonusIncome = (BonusIncome + 200)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LevelCount Equal to (CreepCount_LastIndex + 1)
            • Then - Actions
              • Wait 2.00 seconds
              • Player Group - Pick every player in inGamePlayers and do (Actions)
                • Loop - Actions
                  • Game - Victory (Picked player) (Show dialogs, Show scores)
            • Else - Actions
              • Countdown Timer - Create a timer window for CreepTimer with title (Wave + ((String(LevelCount)) + ( - + ( ( + (CreepName[LevelCount] + ))))))
              • Countdown Timer - Start CreepTimer as a One-shot timer that will expire in 13.00 seconds
              • Set CreepTimerWindow = (Last created timer window)
              • Countdown Timer - Show CreepTimerWindow
              • Player Group - Pick every player in inGamePlayers and do (Actions)
                • Loop - Actions
                  • Player - Add BonusIncome to (Picked player) Current gold
              • Wait 2.00 game-time seconds


and my Spawn Creeps trigger:
Trigger:
  • Spawn Creeps
    • Events
      • Time - CreepTimer expires
    • Conditions
    • Actions
      • -------- Destroy the timer window, to make room for the next one, when the time comes. --------
      • Countdown Timer - Pause CreepTimer
      • Countdown Timer - Destroy CreepTimerWindow
      • For each (Integer A) from 1 to CreepAmount[LevelCount], do (Actions)
        • Loop - Actions
          • -------- Lets have a small wait between each spawn. --------
          • -------- Reduces lagg by reducing the amount of units created per second. --------
          • Wait 0.75 seconds
          • Set creepSpawn[1] = (Center of Creep Spawn Point 1 <gen>)
          • Set creepSpawn[2] = (Center of Creep Spawn Point 2 <gen>)
          • Set creepSpawn[3] = (Center of Creep Spawn Point 3 <gen>)
          • Set creepSpawn[4] = (Center of Creep Spawn Point 4 <gen>)
          • Unit - Create 1 CreepArray[LevelCount] for HostileCreeps at creepSpawn[1] facing 0.00 degrees
          • Unit - Create 1 CreepArray[LevelCount] for HostileCreeps at creepSpawn[2] facing 0.00 degrees
          • Unit - Create 1 CreepArray[LevelCount] for HostileCreeps at creepSpawn[3] facing 0.00 degrees
          • Unit - Create 1 CreepArray[LevelCount] for HostileCreeps at creepSpawn[4] facing 0.00 degrees
          • Custom script: call RemoveLocation (udg_creepSpawn[1])
          • Custom script: call RemoveLocation (udg_creepSpawn[2])
          • Custom script: call RemoveLocation (udg_creepSpawn[3])
          • Custom script: call RemoveLocation (udg_creepSpawn[4])


Would that work?
 

Summoned

New Member
Reaction score
51
If you want it to work, you actually will need to destroy the timer (call DestroyTimer(udg_CreepTimer) in your Spawn Creeps trigger after you're done with it, then make a new one (set udg_CreepTimer = CreateTimer()) in the Spawn Initialization trigger before all the timer-related stuff.

Anyway, tried to make illusions trigger via the Hero attacking. Should work well enough (spamming S doesn't proc it like crazy) unless you give him a passive, very high-frequency damage over time spell.

4 added objects (1 Unit, 1 Item, 1 Hero Ability, 1 Item Ability) and 1 trigger.

Editing the chance to proc/number of illusions is at the top of the trigger (with green comment text).

Editing the damage taken/damage dealt by the illusions is done in the item ability.

As for the other map, had to take out some custom models to fit the 1MB limit. (Probably should've subtitled it "less custom models" since I still have 3-4 retextured models, all the modelers' names are still listed in the Map Descriptions though.)
 

kirinelf

New Member
Reaction score
10
Nah, I'm alright with skipping the timer when needed. In any case, I assume those two commands you posted are JASS, in which case I'll have to convert them all to Custom Text, am I right?

I tried out the Illusion Strike (I plan on renaming it to God of Flash) ability, and one thing I noticed is that it activates very, very rarely. I went for about... 6 or more waves, and it only activated three times. Also, the tooltip states that the chances of it activating go down as the level of the skill goes up, is this true? I'll probably modify it to either have the same chance all the way through, or maybe increase it by 1% every level... It uses the IS variables left over from the Illusion Split skill, right?

Woah. I just looked at the other map, and DANG that's a lot of awesome right there. For me at least, who knows about this *Holds fingers about half an inch apart* about coding. I didn't play it or take too close a look at the skills though, but I'll do it soon. In the meantime, I'm planning out a list of custom spells/abilities for my Heroes.
 

Summoned

New Member
Reaction score
51
I only have 1 trigger in there. :p All you have to do is copy/paste the whole trigger, name and all.

I *think* you may need to manually order "attack", either on a unit or on an area, for it to work because it periodically checks to see if the current order for the unit is "attack" before the damage lands (I could take this out if you want, since it doesn't make that much of a difference whether it procs by a normal hit or a spell when the effects trigger only takes into consideration a single unit being attacked). All the variables it uses are in the trigger already.

As for the chance to proc, it gets a bit crazy when it procs 11 illusions 3-4 times in a row. (Note: Typo in the code :( Currently it adds 20% chance to proc per level, so at level 5 it'll be at 98% chance to proc... ouch. It also only summons 7 illusions at level 5 for the same reason.) Anyway, to fix it, you just have to change the formula for "chance = ???" and "numillusions = ???" under IS_Effects or switch the numbers for the global BASE's and LEVEL's.
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Damn me there are books with less reading involved than there is on this thread!!

I must say I like the format you posted you project in. You covered just about everything, and even though it took me a while to read it, I buy into it totally. It looks like a good game, and even inspires me to work harder with my own AoS. So, +rep for that :p

If you have need of JASS spells and some tips for balancing, and if I have some free time, just PM me and I'll be back to you ASAP..
 

kirinelf

New Member
Reaction score
10
I try to cover all bases. That way it looks neater, and it's easier for me to update. But I don't like my current changelog. I'll need to change it. xD And I'm really grateful to how patient Summoned is with me. I know I can get pretty annoying at times. >_<" If there's anything I might need your help for, I'll be sure to call. But in the meantime, I'm happy enough if you'd just playtest for me when I update the latest version, m'kay?

Summoned, I meant the commands for the spawning. ^^" In particular, the commands you said in the post that involves both the destruction and the declaring of the Timer/TimerWindow. That's in JASS and not GUI, right? (call DestroyTimer(udg_CreepTimer) and set udg_CreepTimer = CreateTimer() I mean.)

Oh, I don't want the illusions to have like a... 50% or so chance of activating. At level 5, it should have a 20% chance of activating, so at level 1 it'd be 12%. I've already modified it, now I just need to see if it works ingame. ^^ Number of illusions will likewise be maxed out at about 7.

All I need is for it to have a chance of it activating while he's attacking an enemy. It doesn't have to be manually ordered, just as long as he's attacking. If possible, spell/ability usage won't activate it. How hard will it be to code that?
 

Summoned

New Member
Reaction score
51
@Timer: You can add them in via the custom script function in GUI, there's no need to convert it to custom text.

@Illusion: Hope you fixed the typos. :)

The problem with the other method of activating it is that "A Unit is Attacked" is detected when the unit begins to take a swing. If you press S to stop it, then what'll happen is that it'll start another attack, which gets registered again. Basically, if you spam S or H to cancel attacks, it can be abused like crazy to proc the illusions far more than intended.

There are many ways of dealing with it:

1. Damage detection system. This will require you to fully trigger the damage from all spells.

2. Cooldown on procs. This will slightly mitigate the abuse, but doesn't really fix it.

3. Constantly check to see if someone's spamming S. Looks like it ends up requiring manual orders to begin attacks (it'll basically run until your unit runs out of enemies in combat range).

4. Orb effects and poison attacks. This prevents you from using other orb effects, such as the one on Mask of Death.
 

kirinelf

New Member
Reaction score
10
So this is what I should have for my three triggers?

Trigger:
  • Spawn Command
    • Events
      • Player - Player 1 (Red) types a chat message containing -spawn as An exact match
    • Conditions
      • LevelCount Greater than 0
      • LevelCount Less than CreepCount_LastIndex
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Remaining time for CreepTimer) Less than or equal to 0.00
        • Then - Actions
          • Trigger - Run Spawn Initialization &lt;gen&gt; (ignoring conditions)
        • Else - Actions
          • Countdown Timer - Pause CreepTimer
          • Trigger - Run Spawn Creeps &lt;gen&gt; (ignoring conditions)


Trigger:
  • Spawn Initialization
    • Events
      • Time - Elapsed game time is 5.00 seconds
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • (Number of living CreepArray[LevelCount] units owned by Player 12 (Brown)) Equal to 0
    • Actions
      • Custom Script: set udg_CreepTimer = CreateTimer()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • --------Blah--------


and my Spawn Creeps trigger:
Trigger:
  • Spawn Creeps
    • Events
      • Time - CreepTimer expires
    • Conditions
    • Actions
      • -------- Destroy the timer window, to make room for the next one, when the time comes. --------
      • Countdown Timer - Pause CreepTimer
      • Countdown Timer - Destroy CreepTimerWindow
      • Custom script: call DestroyTimer (udg_CreepTimer)
      • For each (Integer A) from 1 to CreepAmount[LevelCount], do (Actions)
        • Loop - Actions
          • -------- Blah--------


Yup, fixed 'em. xD Haven't given them a spin yet, my computer crashed up on me. Woke up this morning with 3GB suddenly lost from the drive, so I'm scared there's a virus on it. xD

The way it looks, a damage detection system might be best. Plus, if it's a separate system, I can possibly use it for other spells, right?
Edit: After looking around (specifically on HiveWorkshop), I'm thinking maybe a 2 second cooldown or something might be easier to implement. How/where should I do this?
Edit2: Further looking netted me a simple damage detection system here.
 

Summoned

New Member
Reaction score
51
EDIT: changed some things.

Also, I found out why your "Food Used for Player 12 becomes 0" didn't work. You can change back to it (you really should, it currently lags like crazy if multiple creeps die at the same time). All you have to do is set the Food Cost of the WISP you created at map initialization to 0, because that's messing it up.
So this is what I should have for my three triggers?
Trigger:
  • Spawn Command
    • Events
      • Player - Player 1 (Red) types a chat message containing -spawn as An exact match
    • Conditions
      • LevelCount Greater than 0
      • LevelCount Less than CreepCount_LastIndex
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Remaining time for CreepTimer) Less than or equal to 0.00
        • Then - Actions
          • Trigger - Run Spawn Initialization &lt;gen&gt; (ignoring conditions)
        • Else - Actions
          • Trigger - Run Spawn Creeps &lt;gen&gt; (ignoring conditions)


Spawn Points (new trigger, you don't have to constantly create points/destroy them since you're using those points with 0 changes)
Trigger:
  • Spawn Points
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set creepSpawn[1] = (Center of Creep Spawn Point 1 &lt;gen&gt;)
      • Set creepSpawn[2] = (Center of Creep Spawn Point 2 &lt;gen&gt;)
      • Set creepSpawn[3] = (Center of Creep Spawn Point 3 &lt;gen&gt;)
      • Set creepSpawn[4] = (Center of Creep Spawn Point 4 &lt;gen&gt;)

Spawn Creeps
JASS:
function Trig_Spawn_Creeps_Actions takes nothing returns nothing
    local integer i
    local integer unitspawn
    local integer unitamount

    // Destroy the timer window, to make room for the next one, when the time comes.
    set unitspawn = udg_CreepArray[udg_LevelCount]
    set unitamount = udg_CreepAmount[udg_LevelCount]
    call PauseTimer(udg_CreepTimer)
    call DestroyTimer(udg_CreepTimer)
    call DestroyTimerDialog(udg_CreepTimerWindow)
    set udg_CreepTimer = CreateTimer()
    // Lets have a small wait between each spawn.
    // Reduces lagg by reducing the amount of units created per second.
    set i = 1
    loop
        exitwhen i &gt; unitamount
        call TriggerSleepAction(1)
        call CreateUnitAtLoc(udg_HostileCreeps, unitspawn, udg_creepSpawn[1], 0.00 )
        call CreateUnitAtLoc(udg_HostileCreeps, unitspawn, udg_creepSpawn[2], 0.00 )
        call CreateUnitAtLoc(udg_HostileCreeps, unitspawn, udg_creepSpawn[3], 0.00 )
        call CreateUnitAtLoc(udg_HostileCreeps, unitspawn, udg_creepSpawn[4], 0.00 )
        set i = i + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Spawn_Creeps takes nothing returns nothing
    set gg_trg_Spawn_Creeps = CreateTrigger()
    call TriggerRegisterTimerExpireEventBJ(gg_trg_Spawn_Creeps, udg_CreepTimer)
    call TriggerAddAction(gg_trg_Spawn_Creeps, function Trig_Spawn_Creeps_Actions)
endfunction


Edit2: Further looking netted me a simple damage detection system here.
That's not a damage detection system. ;) I'm talking about something like this.
 

kirinelf

New Member
Reaction score
10
I just playtested it again, and after my settings, Illusion Strike still activates at a frustratingly low rate. As in 0 times in about 7 waves. According to the equation, I should have about 20% chance of skill activation at level 5, but either due to today just not being my day or the anti-spam that you set into the trigger, I couldn't get it to activate once. Which is rather sad. I was trying to get some skill screenshots this time, and got only a rather poor one of Line of Death (Custom Blink) and a screenful of eye candy when using Kurai's Anger of the Skies. ^^"

I found a few bugs in the creep spawning area too. The first and probably the most major bug is that waiting until the wave/creep timer hits 0 does nothing. The timer window stays in the corner, and nothing spawns. It simply stops. Typing -spawn causes a new timer window to pop up, and if I let it hit 0, it just stops there as well. My guess is that it probably isn't running the Spawn Creeps trigger, but I might be wrong.

The other two bugs are with the -spawn command. Used when there's a timer window in the corner that's still counting down, it works perfectly: Destroying the window and spawning the next wave immediately. However, if I type -spawn while the creeps are still alive, it summons another timer window and starts the countdown again. Which is correct, according to the trigger itself, but not what I want. I'm thinking I should move the "set LevelCount = LevelCount +1" action to the Spawn Creeps trigger, am I right? Then make the -spawn command run the Spawn Creeps trigger either way with the current conditions?

And that damage detection system... Would you recommend I use it in my map, or would a cooldown system be sufficient?
 

Summoned

New Member
Reaction score
51
Well, most of what I'm saying here is theoretical. Probably easier if you attach the map and I check to see what's wrong.

As for the damage detection system, I think it'd be a waste if you only use it for 1 spell.
 

kirinelf

New Member
Reaction score
10
In that case, I might as well update my first post. Nice little list of changes. xD

Possibly... in that case, I'll probably need to set a cooldown? Where would I set this cooldown?
 

Summoned

New Member
Reaction score
51
It'll basically just be a re-working of the trigger, deleting about half of it. Note that this will not be MUI, but since you will only have 1 of each hero at the same time, it shouldn't make a difference.

JASS:
function IS_Globals takes nothing returns nothing
    globals
        constant integer IS_SPELLID = &#039;Ails&#039; //Passive spell with all effects set to 0
        constant integer IS_DUMMYID = &#039;nils&#039; //Locust/Invulnerable/Inventory(Hero) unit
        constant integer IS_ITEMID = &#039;Isis&#039; //Item based on the Wand of Illusions, make sure &quot;perishable&quot; is false

        constant integer IS_BASECHANCE = 10
        constant integer IS_LEVELCHANCE = 2
    //Chance to proc is equal to IS_BASECHANCE + (skill level x IS_LEVELCHANCE)
            
        constant integer IS_BASEILLUSIONCOUNT = 2
        constant integer IS_LEVELILLUSIONCOUNT = 1
    //Number of illusions is equal to IS_BASEILLUSIONCOUNT + (skill level x IS_LEVELILLUSIONCOUNT)
    
        constant real IS_COOLDOWN = 2.0
    endglobals
endfunction

function IS_Condition takes nothing returns boolean
    return ((GetUnitAbilityLevel(GetAttacker(), IS_SPELLID) &gt; 0) and (not IsUnitIllusion(GetAttacker())))
endfunction

function Trig_Illusion_Strike_Actions takes nothing returns nothing
    local integer level
    local integer numillusions
    local integer chance
    local integer i
    local unit illusionowner
    local unit illusiondummy
    local item illusionwand
    
    //Illusion stuff
    set illusionowner = GetAttacker()
    set level = GetUnitAbilityLevel(illusionowner, IS_SPELLID)
    set numillusions = IS_BASEILLUSIONCOUNT + IS_LEVELILLUSIONCOUNT * level
    set chance = IS_BASECHANCE + IS_LEVELCHANCE * level
    
    if (GetRandomInt(0, 99) &lt; chance) then
        set illusiondummy = CreateUnit(GetOwningPlayer(illusionowner), IS_DUMMYID, GetUnitX(illusionowner), GetUnitY(illusionowner), 0)
        call UnitApplyTimedLife(illusiondummy, &#039;BTLF&#039;, 2)
        set illusionwand = UnitAddItemById(illusiondummy, IS_ITEMID)
        set i = 1
        loop
            exitwhen i &gt; numillusions
            call SetItemCharges(illusionwand, 1)
            call UnitUseItemTarget(illusiondummy, illusionwand, illusionowner)
            set i = i + 1
        endloop
        call UnitRemoveItem(illusiondummy, illusionwand)
        call RemoveItem(illusionwand)
    endif
    set illusiondummy = null
    set illusionowner = null
    //End Illusion stuff

    //Turns trigger off for the duration of the cooldown
    call DisableTrigger(GetTriggeringTrigger())
    call TriggerSleepAction(IS_COOLDOWN)
    call EnableTrigger(GetTriggeringTrigger())
    //Then turns it back on
endfunction

//===========================================================================
function InitTrig_Illusion_Strike takes nothing returns nothing
    set gg_trg_Illusion_Strike = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Illusion_Strike, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Illusion_Strike, Condition(function IS_Condition))
    call TriggerAddAction( gg_trg_Illusion_Strike, function Trig_Illusion_Strike_Actions )
endfunction

^^^ This cooldown means you get 1 chance every 2 seconds of proccing it.

VVV This cooldown means after you proc it, there's a 2 second cooldown before it can be procced again.
JASS:
function IS_Globals takes nothing returns nothing
    globals
        constant integer IS_SPELLID = &#039;Ails&#039; //Passive spell with all effects set to 0
        constant integer IS_DUMMYID = &#039;nils&#039; //Locust/Invulnerable/Inventory(Hero) unit
        constant integer IS_ITEMID = &#039;Isis&#039; //Item based on the Wand of Illusions, make sure &quot;perishable&quot; is false

        constant integer IS_BASECHANCE = 10
        constant integer IS_LEVELCHANCE = 2
    //Chance to proc is equal to IS_BASECHANCE + (skill level x IS_LEVELCHANCE)
            
        constant integer IS_BASEILLUSIONCOUNT = 2
        constant integer IS_LEVELILLUSIONCOUNT = 1
    //Number of illusions is equal to IS_BASEILLUSIONCOUNT + (skill level x IS_LEVELILLUSIONCOUNT)
    
        constant real IS_COOLDOWN = 2.0
    endglobals
endfunction

function IS_Condition takes nothing returns boolean
    return ((GetUnitAbilityLevel(GetAttacker(), IS_SPELLID) &gt; 0) and (not IsUnitIllusion(GetAttacker())))
endfunction

function Trig_Illusion_Strike_Actions takes nothing returns nothing
    local integer level
    local integer numillusions
    local integer chance
    local integer i
    local unit illusionowner
    local unit illusiondummy
    local item illusionwand
    
    //Illusion stuff
    set illusionowner = GetAttacker()
    set level = GetUnitAbilityLevel(illusionowner, IS_SPELLID)
    set numillusions = IS_BASEILLUSIONCOUNT + IS_LEVELILLUSIONCOUNT * level
    set chance = IS_BASECHANCE + IS_LEVELCHANCE * level
    
    if (GetRandomInt(0, 99) &lt; chance) then
        set illusiondummy = CreateUnit(GetOwningPlayer(illusionowner), IS_DUMMYID, GetUnitX(illusionowner), GetUnitY(illusionowner), 0)
        call UnitApplyTimedLife(illusiondummy, &#039;BTLF&#039;, 2)
        set illusionwand = UnitAddItemById(illusiondummy, IS_ITEMID)
        set i = 1
        loop
            exitwhen i &gt; numillusions
            call SetItemCharges(illusionwand, 1)
            call UnitUseItemTarget(illusiondummy, illusionwand, illusionowner)
            set i = i + 1
        endloop
        call UnitRemoveItem(illusiondummy, illusionwand)
        call RemoveItem(illusionwand)
        //Turns trigger off for the duration of the cooldown
        call DisableTrigger(GetTriggeringTrigger())
        call TriggerSleepAction(IS_COOLDOWN)
        call EnableTrigger(GetTriggeringTrigger())
        //Then turns it back on
    endif
    set illusiondummy = null
    set illusionowner = null
    //End Illusion stuff
endfunction

//===========================================================================
function InitTrig_Illusion_Strike takes nothing returns nothing
    set gg_trg_Illusion_Strike = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Illusion_Strike, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Illusion_Strike, Condition(function IS_Condition))
    call TriggerAddAction( gg_trg_Illusion_Strike, function Trig_Illusion_Strike_Actions )
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top