• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Spell] Damage Help with Spell (again)

Status
Not open for further replies.
Level 2
Joined
Apr 25, 2015
Messages
11
Hi again, I got a problem and I cant figur out what it is.

The trigger (visualization is a little buggy)

  • Sun Blast
    • Ereignisse
      • Einheit - A unit Beginnt, eine Fähigkeit zu kanalisieren
    • Bedingungen
      • (Ability being cast) Gleich Sun Blast
    • Aktionen
      • -------- Setting up Variables --------
      • Set SunBlast_CASTER = (Triggering unit)
      • Set SunBlast_LIFE_GAIN = 0.10
      • Set SunBlast_DMG = (Kraft of SunBlast_CASTER (Einschließen bonuses))
      • Set SunBlast_MAX_LIFE = (Max. Leben of SunBlast_CASTER)
      • Set SunBlast_CASTER_POS = (Position of SunBlast_CASTER)
      • Set SunBlast_TIME = 0.00
      • Set SunBlast_EXPLOS = 0.00
      • Spezialeffekt - Create a special effect at SunBlast_CASTER_POS using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
      • Set SunBlast_EFCT = (Last created special effect)
      • Einheit - Set life of SunBlast_CASTER to ((Leben of SunBlast_CASTER) + (SunBlast_MAX_LIFE x SunBlast_LIFE_GAIN))
      • Spezialeffekt - Destroy SunBlast_EFCT
      • Auslöser - Run Sun Blast DMG <gen> (checking conditions)

  • Sun Blast DMG
    • Ereignisse
      • Zeit - Every 0.20 seconds of game time
    • Bedingungen
    • Aktionen
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (SunBlast_CASTER is alive) Gleich True
        • 'THEN'-Aktionen
          • Set SunBlast_GROUP = (Units within 350.00 of SunBlast_CASTER_POS matching ((((Matching unit) is Ein Gebäude) Ungleich True) and ((((Matching unit) is Immun gegen Magie) Ungleich True) and (((Matching unit) belongs to an enemy of (Owner of SunBlast_CASTER)) Gleich True))))
          • Set SunBlast_CASTER_POS = (Position of SunBlast_CASTER)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
            • 'THEN'-Aktionen
              • Einheitengruppe - Pick every unit in SunBlast_GROUP and do (Actions)
                • Schleifen - Aktionen
                  • Spiel - Display to (All players) the text: 1
                  • Set SunBlast_EXPLOS = (SunBlast_TIME + 1.00)
                  • Set SunBlast_TIME = SunBlast_EXPLOS
                  • Set SunBlast_CASTER_POS = (Position of SunBlast_CASTER)
            • 'ELSE'-Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • SunBlast_EXPLOS Gleich 5.00
            • 'THEN'-Aktionen
              • Einheit - Cause SunBlast_CASTER to damage (Picked unit), dealing (50.00 + (Real(SunBlast_DMG))) damage of attack type Zaubersprüche and damage type Normal
              • Set SunBlast_TIME = 0.00
              • Custom script: call DestroyGroup(udg_SunBlast_GROUP)
              • Custom script: call RemoveLocation(udg_SunBlast_CASTER_POS)
              • Auslöser - Turn off (This trigger)
            • 'ELSE'-Aktionen
        • 'ELSE'-Aktionen
The text output is to check how many times it runs the loop. An it'll only show the message 2 times.
As you might see I'd like the variable TIME to count up (as replacement for the waits) until it reaches the value of 5 (5x0.2 = 1sec delay) to fulfill the requirements for the damage part.

I cant get the dmg properly to work. Either it is to fast (not matching the animation) or nothing at all. I tried a lot of different placements but so far I couldn't find the correct one.
 
Level 11
Joined
Jun 2, 2013
Messages
613
  • Set SunBlast_GROUP = (Units within 350.00 of SunBlast_CASTER_POS matching ((((Matching unit) is Ein Gebäude) Ungleich True) and (((Matching unit) is Immun gegen Magie) Ungleich True) and (((Matching unit) belongs to an enemy of (Owner of SunBlast_CASTER)) Gleich True))))
(((Matching unit) is Immun gegen Magie) Ungleich True)

Are you wanting this to ONLY effect magic immune units?
Cause right now it looks like units in your group only receive damage if they are immune to magic, if I am reading it correctly.


**edit nevermind I see it now, NOT Equal to true. Sorry I don't speak German, just kinda going on intuition here.

Maybe try this? -

229649-albums8126-picture97433.png
 
Last edited:
Level 2
Joined
Apr 25, 2015
Messages
11
No doesn't work, this will <!--prevent the virtual machine to count the variable up--> (im stupid nevermind).
I still tried it (also, different ways), didn't work.

Still appreciate your time.
 
Level 11
Joined
Jun 2, 2013
Messages
613
Sorry what I meant to say was try: if sunblast is less than or equal to 5.00, then set it +1 etc, else deal damage and stop trigger remove point etc.

You also may want to try changing "begins casting an ability" to "starts the effect of an ability"

Another thing I noticed is when you cast it in the first trigger, you technically just run it once even though it's a periodic eventq. Try turning the trigger off in editor and then trigger- turn on when your ability is cast. At the end of the second trigger where the actual spell happens, turn it back off.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
The ability is not MUI, you need an instancing system to make it MUI. If two units were to cast it at once it will break badly.

You leak 5 locations stored to SunBlast_CASTER_POS. You assign it a new location initially and at least once each iteration but only remove one at the last iteration. More locations are leaked if more units are inside the unit group with each iteration.

You are exposing yourself to floating point rounding error with your comparison. WC3 "Real" type is implemented as a single precision floating point (32 bits) so might be unable to accurately represent rational numbers. When you test SunBlast_EXPLOS if it is equal to "5.00" then it might fail that because it is not equal to 5.00 but instead 5.00XXXXX where X are insignificant fractional parts generated by floating point error. To solve either change it to an integer (which has no factional components, I recommend this approach) or change the test to "greater than or equal to" (passes for the set of single precision floats that are larger than "5.00" so allows for error).

You leak 4 unit groups as only the last iteration destroys one.

You deal damage to a null unit. "(Picked unit)" does not exist so returns null as you are not picking any units. The action has to be in a for group loop to return a valid unit.

The trigger gets turned off but is never turned on if it is currently off. Instead it will run only once per cast (something clearly unintended).

Some of the above could be a result of an indentation error with your trigger tags on the forum. In that case it might be a good idea to provide a map with the trigger in it so that people can see the actual structure of the GUI trigger.
 
Level 2
Joined
Apr 25, 2015
Messages
11
Oh jeez thats a lot to fix. Would you suggest to slowly learn to code in JASS than to do it in GUI? Is JASS always MUI (or significantly easier to achieve MUI)?

Anyway thank you guys, have a nice day.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
Oh jeez thats a lot to fix. Would you suggest to slowly learn to code in JASS than to do it in GUI? Is JASS always MUI (or significantly easier to achieve MUI)?
JASS is not magic, it does not make your code better by itself.

I suggest you learn it purely because it allows you to better understand how the WC3 trigger system works. GUI hides all the low level details from you often leading to people doing strange things that seem logical but knowing the underlying JASS cannot possibly work. It also allows you to optimize your scripts more efficiently since the GUI compile process produces very poorly optimized JASS code.
 
Status
Not open for further replies.
Top