• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Simple GUI Math question (Arithmetic)

Status
Not open for further replies.
Level 3
Joined
Jan 3, 2019
Messages
15
Hi,

I can't seem to get the "Arithmetic" to work as I want in GUI and I know no JASS.

I want this to happen in 1 call, not 3... :( Anyone knows how to do it in GUI? Or does it need to be in JASS for multiple calculations to be possible? Or do I just suck at math? xD

EDIT4: Figured it out! :)

EDIT3: Changed my mind, I would instead like to have this into one call:

  • Custom script: call SetUnitUserData( Dying_Unit, ( R2I(BlzGetUnitArmor(Dying_Unit)) * udg_DifficultyPointValue ) )
  • Custom script: call SetUnitUserData( Dying_Unit, ( GetUnitUserData(Dying_Unit) + ( udg_PGold[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] / 50 ) ) )
  • Custom script: call SetUnitUserData( Dying_Unit, ( GetUnitUserData(Dying_Unit) + udg_PlayerChances[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] ) )
  • Custom script: call SetUnitUserData( Dying_Unit, ( GetUnitUserData(Dying_Unit) / 4 ) )
EDIT2: Oh... That did not fit in the "Custom script" thingy...

EDIT: Would maybe this work?

Code:
call SetUnitUserData( Dying_Unit, ( R2I(BlzGetUnitArmor(Dying_Unit)) * ( udg_DifficultyPointValue ) + ( udg_PGold[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] / 100 ) + ( udg_PlayerChances[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] ) )

Also accepting tips and suggestions to my formula for calculating player points.

It currently depends on:

DifficultyPointValue = 2 for easy, 3 for normal and 4 for hard
Amount of Armor a unit has depends on difficulty chosen
1 point for every current 50 gold
Player chances starts on 25 and players lose 1 chance if they leak a creep
Then just divide it by 4 to make the number smaller, so it doesn't get out of hand in the multiboard :D

Thankful for any help I can get! :)

This is the thing:

  • Unit dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Player 12 (Brown)
    • Actions
      • Custom script: local unit Dying_Unit
      • Custom script: set Dying_Unit = GetTriggerUnit()
      • Set PKills[(Player number of (Owner of (Killing unit)))] = (PKills[(Player number of (Owner of (Killing unit)))] + 1)
      • Multiboard - Set the text for (Last created multiboard) item in column 5, row ((Player number of (Owner of (Killing unit))) + 1) to ((|c00e92222 + (String(PKills[(Player number of (Owner of (Killing unit)))]))) + |r)
      • -------- These are the three formulas that I mean needs to be combined into one --------
      • Unit - Set the custom value of (Dying unit) to ((Integer((Armor of (Dying unit)))) x DifficultyPointValue)
      • Unit - Set the custom value of (Dying unit) to ((Custom value of (Dying unit)) + (PGold[(Player number of (Owner of (Killing unit)))] / 100))
      • Unit - Set the custom value of (Dying unit) to ((Custom value of (Dying unit)) + PlayerChances[(Player number of (Owner of (Killing unit)))])
      • Set PPTS[(Player number of (Owner of (Killing unit)))] = (Custom value of (Dying unit))
      • Game - Display to (All players) the text: (String(PPTS[(Player number of (Owner of (Killing unit)))]))
      • Custom script: set udg_PPTSV[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] = ( udg_PPTSV[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] + udg_PPTS[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] )
      • Multiboard - Set the text for (Last created multiboard) item in column 7, row ((Player number of (Owner of (Killing unit))) + 1) to ((|c0000ff24 + (String(PPTSV[(Player number of (Owner of (Killing unit)))]))) + |r)
      • Custom script: call AddSpecialEffectLocBJ( GetUnitLoc(Dying_Unit), "Objects\\Spawnmodels\\Demon\\DemonLargeDeathExplode\\DemonLargeDeathExplode.mdl" )
      • Custom script: call CreateTextTagLocBJ( ( "|c00ffd700+" + ( I2S(GetUnitPointValue(Dying_Unit)) + "|rg" ) ), GetUnitLoc(Dying_Unit), 0, 8.50, 100, 100, 100, 0 )
      • Custom script: call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
      • Custom script: call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
      • Custom script: call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
      • Custom script: call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
      • Custom script: call AdjustPlayerStateBJ( GetUnitPointValue(Dying_Unit), GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_GOLD )
      • Custom script: call TriggerSleepAction( 0.44 )
      • Custom script: call CreateTextTagLocBJ( ( "|c0000ff24" + ( I2S(udg_PPTS[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))]) + "|rp" ) ), GetUnitLoc(Dying_Unit), 0, 7.50, 100, 100, 100, 0 )
      • Custom script: call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
      • Custom script: call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
      • Custom script: call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
      • Custom script: call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
      • Custom script: call TriggerSleepAction( 0.30 )
      • Custom script: call DestroyEffectBJ( GetLastCreatedEffectBJ() )
      • Custom script: call RemoveUnit( Dying_Unit )
      • Custom script: set Dying_Unit = null
 
Last edited:
Status
Not open for further replies.
Top