• 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] Odd string issue

Status
Not open for further replies.
Level 7
Joined
Aug 11, 2010
Messages
270
For some reason; even though it doesn't happen every single time -- It seems as though when incredibly big numbers are recorded for use on floating text; they break. Only displaying a measly 9 or 10 damage (as opposed to 1,000 damage, or 900 damage)

  • HDS Calculated Shot Effect
    • Events
      • Game - damageEventTrigger becomes Equal to 0.00
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (target has buff [Dummy] Calculated Shot (Non-stacking)) Equal to True
          • (target has buff [Dummy] Calculated Shot (Stacking)) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Set HDS_CalculatedShotPoint[1] = (Position of source)
      • Set HDS_CalculatedShotPoint[2] = (Position of target)
      • Set TempReal = ((Distance between HDS_CalculatedShotPoint[1] and HDS_CalculatedShotPoint[2]) x (0.15 x (Real((Level of Calculated Shot (Dwarven Sharpshooter, Level 0) for source)))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Headshot (Dwarven Sharpshooter) for source) Greater than 0
          • (Random integer number between 1 and 100) Less than or equal to 5
        • Then - Actions
          • Set TempReal = (TempReal x (5.00 x (Real((Level of Headshot (Dwarven Sharpshooter) for source)))))
        • Else - Actions
      • Set TempInteger = (Integer(TempReal))
      • Unit - Cause source to damage target, dealing TempReal damage of attack type Pierce and damage type Normal
      • Floating Text - Create floating text that reads ((String(TempInteger)) + !) above target with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
      • Unit - Remove [Dummy] Calculated Shot (Non-stacking) buff from target
      • Unit - Remove [Dummy] Calculated Shot (Stacking) buff from target
      • Trigger - Turn on (This trigger)
The if/and/else part is to mimic critical strike on an effect that wouldn't normally duplicate critical strike (If you're familiar with DotA; Stifling Dagger from Phantom Assassin and Coup De Grace)

Regardless; the important part is the strange issue I keep getting when the spell actually crits. It seems to ONLY happen when the spell crits. I'm beginning to think that I'm using convert integer to real incorrectly or something of the sort.
 
Did you try moving the damage function below the floating text lines? E.g.:
  • Floating Text - Create floating text that reads ((String(TempInteger)) + !) above target with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
  • Floating Text - Change (Last created floating text): Disable permanence
  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
  • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
  • Unit - Cause source to damage target, dealing TempReal damage of attack type Pierce and damage type Normal
See if it works. If it does, then here is the reason:
magic+meme.gif


But on a serious note, I assume "TempInteger" is being overwritten. Keep in mind that Unit - Damage Target will fire other damage events. If TempInteger is changed in the other triggers that use that event, then it'll end up with a different value when you use it in the floating text. If that is the case, you can either use TempInteger before issuing the damage, or you can create a variable just for the trigger.

If that isn't the problem, then display a message with the distance, the level, and the value of TempReal before the if-then-else and see if it returns the correct values. I noticed that the TempReal calculation has "Dwarven Sharpshooter, Level 0" in it. I'm not sure if that was intentional or not.

If it happens only when the spell crits, then add a message before the if-then-else and immediately after the if-then-else to display TempReal. It'll let you know if there is an issue with the calculation, and then the problem will be clear from there.

Let me know if any of this works, or report back with the results from displaying the messages.
 
Level 7
Joined
Aug 11, 2010
Messages
270
Did you try moving the damage function below the floating text lines? E.g.:
  • Floating Text - Create floating text that reads ((String(TempInteger)) + !) above target with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
  • Floating Text - Change (Last created floating text): Disable permanence
  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
  • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
  • Unit - Cause source to damage target, dealing TempReal damage of attack type Pierce and damage type Normal
See if it works. If it does, then here is the reason:
magic+meme.gif


But on a serious note, I assume "TempInteger" is being overwritten. Keep in mind that Unit - Damage Target will fire other damage events. If TempInteger is changed in the other triggers that use that event, then it'll end up with a different value when you use it in the floating text. If that is the case, you can either use TempInteger before issuing the damage, or you can create a variable just for the trigger.

If that isn't the problem, then display a message with the distance, the level, and the value of TempReal before the if-then-else and see if it returns the correct values. I noticed that the TempReal calculation has "Dwarven Sharpshooter, Level 0" in it. I'm not sure if that was intentional or not.

If it happens only when the spell crits, then add a message before the if-then-else and immediately after the if-then-else to display TempReal. It'll let you know if there is an issue with the calculation, and then the problem will be clear from there.

Let me know if any of this works, or report back with the results from displaying the messages.

Well... I'm a bit ashamed to admit; the first suggestion actually worked! Seems odd that the engine would be so finicky about that, heh. Thanks alot, though! +Rep for your time

A bit of insight about (Level 0): Yeah it's intentional. It's a bit of a convention I use to make abilities with Engineering Upgrade more easily distinguished in the editor. Makes it a lot easier to browse through your spells that way. Typically -- Level 0 is the -first- form (before any engineering upgrades) of a spell.
 
Status
Not open for further replies.
Top