Complicated trigger spell help

Smitty

Member
Reaction score
20
Ok, so here's what I'm trying to do;

Create a spell (castable on enemy heroes) which, when cast, gives the target hero a buff lasting 3 seconds. When this hero goes near another hero to which it is allied, the new hero is zapped, and given the buff also. Essentially what this should result in is the buff spreading by heroes being within X range of each other, until none of them is within that range of each other for 3 seconds. Then no unit will have the buff and the spell ends. Damage will be dealt bla bla bla bla so on.

The problem I have here is this, when I cast the spell on a hero, it duly zaps a hero near it, and then another. All told up to 3 heroes may be zapped at once, though I can't tell if this is going both ways between two units which both have the buff. However, what it ISN'T doing, which is what I'm trying to achieve, is to have all the heroes near each other being constantly zapped every X seconds. Here are the triggers;

Trigger:
  • Soul Shackles Cast
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Soul Shackles
    • Actions
      • Set Shackler = (Triggering unit)
      • Set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 Dummy 3 for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to DummyGroup
      • Set ShackleDummy = (Last created unit)
      • Set Shackleable = (Units in (Playable map area) matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False) and (((Matching unit) is A Hero) Equal to True)))
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Trigger - Turn on Soul Shackles Effect <gen>


Trigger:
  • Soul Shackles Buff
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Ability being cast) Equal to Soul Shackles ) or ((Ability being cast) Equal to Soul Shackles Effect )
    • Actions
      • Unit Group - Add (Target unit of ability being cast) to Shackled
      • Unit - Order ShackleDummy to Orc Shaman - Bloodlust (Target unit of ability being cast)


Trigger:
  • Soul Shackles Effect
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Remove all units of AlreadyShackled from AlreadyShackled
      • Unit Group - Pick every unit in Shackled and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnit has buff Shackled Soul ) Equal to True
            • Then - Actions
              • Set TempPoint = (Position of TempUnit)
              • Set TempGroup = (Units within 500.00 of TempPoint matching ((((Matching unit) is in Shackleable) Equal to True) and ((((Matching unit) is in AlreadyShackled) Equal to False) and ((Matching unit) Not equal to TempUnit))))
              • Unit - Create 1 Dummy 3 for (Owner of Shackler) at TempPoint facing Default building facing degrees
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Unit Group - Add (Last created unit) to DummyGroup
              • Unit Group - Remove all units of AlreadyShackled from AlreadyShackled
              • Unit Group - Pick every unit in TempGroup and do (Actions)
                • Loop - Actions
                  • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Picked unit)
                  • Unit Group - Add (Picked unit) to AlreadyShackled
                  • Unit - Cause Shackler to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Unit Group - Remove all units of TempGroup from TempGroup
            • Else - Actions
              • Unit Group - Remove TempUnit from Shackled
          • Set TempUnit = No unit


Bloodlust is the spell which applies the buff, Chain Lightning is the lightning effect for it (called Soul Shackles effect).

Any thoughts please anyone? Thanks in advance :)

EDIT: It seems that while units are having the buff applied by the dummy casting bloodlust, the damage isn't actually being implemented... Wonder what this implies :s

2nd EDIT: Changed the 3rd trigger, now it seems to work a lot closer to what I wanted, but still not perfect, since it doesn't hit every unit every time, works more like a chain lightning, which is not what I want. Edited the trigger. Fixed damage being given, and it seems to be given to all the units it should be, but the spell isn't being cast on all of them. Not cool :( Really stuck at this point. Help me please TH! I need your wisdom!
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
The phoenix fire ability might be what you are looking for.
You cast a dummy ability on an enemy hero, then you add your custom phoenix fire inside a disabled spellbook to the target hero.
You create a custom buff for the ability and make it target only allied heroes. You can set the duration of the buff, missle speed, range and even damage which might be dealt periodically, but isnt neccessary.
Checking when the buff expires is a lot harder. The problem lies within the fact that you cannot know which player has caused the buff opon which enemy.
One possibility to make this ability at least MPI would be to create separate abilitie levels with seperate buffs for each player. This would give the possibility to make it MPI rather easy.
You would need a damage detection system as well to check when a unit is hit by the phoenix fire dummy ability in order to spread it around. Once hit save the units inside a unit group and check periodically through the unit group looking for a unit without the buff.
 

Smitty

Member
Reaction score
20
I have a DD system, but the thing is I want heroes to take more damage when more heroes are near them, so taking X damage per nearby hero, but I don't think this would work for that method, since you can't detect how many different units are applying a buff :/

I just don't understand why my trigger doesn't work :(

Thanks for the input though :)
 

Wratox1

Member
Reaction score
22
may i ask why you have "Trigger - Turn on Soul Shackles Effect <gen>" in your "Soul Shackles Cast"-trigger? this probably doesnt have anything to do with the problem, but if you have another trigger that turns "Soul Shackles Effect" off that would be related as well..
 

Smitty

Member
Reaction score
20
Because there'll be another trigger to turn the spell off when it's no longer applicable, but that's not there yet, because it's currently redundant, since I can't make the rest of the dam spell work how I want it to :/
 

Wratox1

Member
Reaction score
22
ok ok, just wondering :)

perhaps you should make a demo map with the involved spells, units and triggers and upload it here?

that would make it a bit easier to fix the problem since then i can play around with the triggers and see what does what :)
 

Wratox1

Member
Reaction score
22
why not just upload it on the this site? as an attachment..

also i couldnt download it..


Edit:i downloaded it

let me get this straight, should it really be castable on enemy heroes? shouldnt you cast it on an allied heroes?
 

Smitty

Member
Reaction score
20
What? Um, since it deals damage and keeps doing so until they spread apart, it's definitely an offensive spell. Did you find any issues in the triggering? still can't make the dam thing work quite right :/
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Sorry if im kinda necroing, this is my quick attempt at it, its in jass, idk if you use JNGP but if you do it should be pretty easy and self explanatory to set up:

JASS:
scope StaticShock /* &gt;<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />
    requires
        Timer32
        SpellEffectEvent
        AIDS*/
    
    globals
        private constant real RANGE =               500 //change to your spells range
        private constant real DURATION =              5 //time in seconds for your spell&#039;s debuff
        private constant integer ABIL_ID =       &#039;A000&#039; //change to your spells id
        private constant integer DUMMY_ID =      &#039;hfoo&#039; //change to a dummy unit&#039;s id (should have the same spell as your hero and unlimited mana)
        private constant string ORDER_STRING = &quot;defend&quot; //change to your order string of the spell
    endglobals
    
    private struct Data extends array
        static unit current
        player caster
        timer remove
        integer lagstopper
        
        private static method Static takes nothing returns boolean
            local unit u = GetFilterUnit()
            if IsUnitEnemy(u, GetOwner(current)) and IsUnitType(u, UNIT_TYPE_HERO) then
                call CreateUnit(GetUnitUserData(current).caster, DUMMY_ID, GetUnitX(current), GetUnitY(current), 0)
                call IssueInstantTargetOrder(bj_lastCreatedUnit, ORDER_STRING, u)
                call UnitApplyTimedLife(bj_lastCreatedUnit, 0, 3)
            endif
            return false
        endmethod
        
        private method periodic takes nothing returns nothing
            set current = GetIndexUnit(this)
            local real x = GetUnitX(current)
            local real y = GetUnitY(current)
            if this.lagstopper == 16 then
                set this.lagstopper = 0
                call GroupEnumUnitsInRange(bj_lastCreatedGroup, x, y, RANGE, Filter(function thistype.Static)
            else
                set this.lagstopper = this.lagstopper + 1
            endif
        endmethod
        
        implement T32x
        
        private static method removal takes nothing return nothing
            local thistype this = thistype(0).next
            local timer t = GetExpiredTimer()
            loop
                exitwhen this.remove == t
                set this = this.next
            endloop
            call this.stopPeriodic()
            set t = null
        endmethod
        
        private static method onCast takes nothing returns nothing
            local thistype this = GetUnitId(GetSpellTargetUnit())
            set this.caster = GetOwningPlayer(GetTriggerUnit())
            if not (this.remove == null) then
                call this.startPeriodic()
            endif
            call DestroyTimer(this.remove)
            set this.remove = CreateTimer()
            call TimerStart(this.remove, DURATION, false, function thistype.removal)
        endmethod
        
        private static method onInit takes nothing returns nothing
            call RegisterSpellEffectEvent(ABIL_ID, function onCast)
        endmethod
    endstruct
endscope


DISCLAIMER: I havent compiled this yet, ill do it when i get home.
 

Smitty

Member
Reaction score
20
JNGP? If that's newgen, I tried to get it working before, and couldn't. If this works... I'll actually send you a cake :D
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
yes JNGP is Jass NewGen Package...
i forgot to test it last night
when you install JNGP make sure you update JassHelper or it wont work, its easy to update if you follow the instructions
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
I edited it, the way it was at first it would deal the damage 32x/sec that an enemy hero was in range, i changed it to 2x/sec
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top