Triggered Spells Help

Discussion in 'Starcraft 2 (SC2) Editor Help' started by N(O.O)B, Jul 28, 2010.

  1. N(O.O)B

    N(O.O)B New Member

    Ratings:
    +27 / 0 / -0
    So, I used to play around in the Warcraft 3 Editor quite a bit, so I'm used to basing spells off of a dummy spell (channel) and triggering the entire spell as this was much more fluent and allowed for a lot more unique spells. After I tried doing this in the Galaxy Editor, I ran into a few problems, though.

    In Warcraft 3, the editor had two very useful actions that made this easier:
    Unit - Damage Unit
    Allowed for one unit to damage another unit instantly
    Special Effect - Create Special Effect
    Creates a model at a target location.

    Now I've looked everywhere and I really can't figure out how to do these.

    Edit: Figured them out myself, nevermind.
     
  2. touchpad

    touchpad New Member

    Ratings:
    +0 / 0 / -0
    Wait, you figured this out? I've been working on this all day. How did you get instant damage to work?
     
  3. themean

    themean Active Member

    Ratings:
    +7 / 0 / -0
    :) give your solution :)
     
  4. touchpad

    touchpad New Member

    Ratings:
    +0 / 0 / -0
    I found a method for doing this, but I hope there is a better one. I defined a function with the arguments damager, damagee, and amount that handles the damage dealing and scoring if the damage causes a kill. Now, whenever I want to deal damage I create an if/then/else action in the appropriate trigger and call this function in the condition, and leave the then and else blank.


    If:
    Conditions:
    Deal damage to target(damager,damagee,amount) == True
    Then:
    Else:


    I'm guessing that there is an action that handles damage buried somewhere in the trigger editor, but I have not found it. This should work for most purposes though.

    Edit: The 'damage' aspect of the function is just setting the health of damagee to its current value minus the damage amount.
     
  5. themean

    themean Active Member

    Ratings:
    +7 / 0 / -0
    10x
     
  6. touchpad

    touchpad New Member

    Ratings:
    +0 / 0 / -0
    I have found something that I can't do using this method. If the damage function kills the unit it damages, the unit that would be dealing the damage does not have a kill added to its kill count in the UI. If I were making a hero map, a hero using a triggered ability would presumably not get experience from getting a kill through an ability that calls the damage function.

    If anyone knows of a function to give a unit credit for a kill, that would be awesome. If anyone knows how to access a built in function that makes a unit deal damage to a unit, that would be more awesome still.
     
  7. N(O.O)B

    N(O.O)B New Member

    Ratings:
    +27 / 0 / -0
    I created a function called "Damage Unit" that uses a simple repeated function to deal damage to the unit.

    First, you will need 4 (or more) effects, called:
    Damage - 1 (deals 1 damage)
    Damage - 10 (deals 10 damage)
    Damage - 100 (deals 100 damage)
    Damage - 1000 (deals 1000 damage)

    Then you will need to make 3 global variables:
    - Damaging Unit (Unit Variable)
    - Damage Group (Unit Group Variable)
    - Damage Amount (Real Variable)

    Then, in the trigger (I named it Function: Damage Unit), make it look like this:
    [​IMG]

    Then, whenever you want to deal damage, enter the following values:
    [​IMG]

    Basically, whenever you run the trigger, it will deal Damage Amount damage to every unit inside Damage Group from source unit Damaging Unit.
     
  8. Frozenwind

    Frozenwind System maker

    Ratings:
    +99 / 0 / -0
    I gotta admit, that's rather smartly done. I'd have done it a little bit different, but using multiple powers of damage is nice to reduce the lag of a repeating loop.
    I don't quite understand why you use a unitgroup though, as there should only be one unit in your group anyway.


    So basically, we are stuck to effects to deal damage, special effects etc.? So we have to use the data editor far more for triggered skills as in wc3?
     
  9. N(O.O)B

    N(O.O)B New Member

    Ratings:
    +27 / 0 / -0
    It's so you only have to run the trigger once if you want to damage multiple units (for instance, for an area of effect ability).
     
  10. Frozenwind

    Frozenwind System maker

    Ratings:
    +99 / 0 / -0
    As it happens instantly, you can use a global unit variable to pass the unit instead of a global unitgroup variable?
    The looping is caused by the integer and while loop anyway.
     
  11. N(O.O)B

    N(O.O)B New Member

    Ratings:
    +27 / 0 / -0
    I don't know, but edit it how you wish, this is simply a lot more convenient for me.
     
  12. Frozenwind

    Frozenwind System maker

    Ratings:
    +99 / 0 / -0
    I was only trying to understand why you was using a unitgroup rather then a unit var, but I guess it doesn't matter.
    I won't edit it btw, the only thing I'll ever ask is functions, not systems. It's more fun creating them by myself. In this case it'd be the fact you have to use data editor's effects to deal damage through triggers.
     
  13. Sgqvur

    Sgqvur FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi

    Ratings:
    +62 / 0 / -0
    I am not sure if this works(not tested) but I'll post it anyway : P
    JASS:
    void UnitDamageTarget(unit attacker, fixed damage_amount, unit target)
    {
        UnitSetPropertyFixed(targer, c_unitPropLife, UnitGetPropertyFixed(target, c_unitPropLife, true) - damage_amount)
    
        // did we kill it?
        if (UnitTestState(target, c_unitStateIsDead))
        {
            UnitSetPropertyInt(attacker, c_unitPropKills, UnitGetPropertyInit(attacker, c_unitPropKills, true) + 1)
        }
        // what about xp? -> idk : )
    }
     
  14. touchpad

    touchpad New Member

    Ratings:
    +0 / 0 / -0
    There is a potential issue with using global variables rather than function arguments. If you had two abilities cast at around the same time and both set global variables, you might have a global variable changed while it is being used by another function. This might be avoided if you chose "wait" rather than "don't wait" when you call the trigger, but I'm not sure.

    I of course have not tested Noob's implementation, and is entirely possible that it works just fine. I'm just pointing this out for other people in the forum, as it holds true for other uses in addition to dealing damage.

    I will post the function method, just so it is understood.

    [​IMG]

    To call the function, you create an if/then/else action:

    If:
    Damagetarget(<desired damage dealer>,<desired damage target>,<desired damage amount>) == True
    Then:
    <leave blank>
    Else:
    <leave blank>
     
  15. Arkless

    Arkless New Member

    Ratings:
    +31 / 0 / -0
    The methods abouve kinda lack, don't they? How about armor? In case your unit has 2 armor and you want to deal 8 dmg, the result would be 6 dmg.
    First method with 1 dmg, 10 dmg etc. effects:
    1 dmg = 0
    1 dmg = 0
    1 dmg = 0
    ...
    result = 0 dmg

    Set hp method:
    hp = hp - 8
    => 8 dmg delt



    Using a dmg effect and changing the value via catalog action would be the solution, but i do not know how fast that method is (might cause the game to slow down/lag).
     

Share This Page