Load transperancy value

X.Terror.X

New Member
Reaction score
10
is it posible to load/get the value of a unit currents transerpancy?

so if transperancy = 10% i want to do this
change unit vertix colouring ---> [transperancy] = artemic == [get transperancy + 10%
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, you could simply use the JASS native for it... It doesn't use %, but actuall values so it's easier to maintain ;)

It looks like this:
[ljass]native SetUnitVertexColor takes unit whichUnit, integer red, integer green, integer blue, integer alpha returns nothing[/ljass]

So, you could do this with a custom script:
Trigger:
  • Vertex Coloring
    • Events
      • Unit - A unit enters Region 1 <gen>
    • Conditions
    • Actions
      • Custom script: call SetUnitVertexColor(GetTriggerUnit(), 255,255,255,0)
      • Wait 5.00 seconds
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Wait 0.10 seconds
          • Custom script: call SetUnitVertexColor(GetTriggerUnit(), 255, 255, 255, 10 * bj_forLoopAIndex)
 

X.Terror.X

New Member
Reaction score
10
i know thats basicly the same like GUI but u use loop
but icanot use loop since that will glitch with other units

its just 1 trigger based that reduces 10% trans and then removes but if u use loop it gets removed to early and it doesnt look realistic
thats why i want to load the value and not use loop
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, don't know if this is either what you're looking for, or if it even works but...

Trigger:
  • Vertex Coloring
    • Events
      • Unit - A unit enters Region 1 <gen>
    • Conditions
    • Actions
      • Unit Group - Add (Triggering unit) to TempGroup
      • Unit - Set the custom value of (Triggering unit) to 100


Trigger:
  • Vertex Color Timer
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Greater than or equal to 95
            • Then - Actions
              • Custom script: call SetUnitVertexColor( GetEnumUnit(), 255, 255, 255, GetUnitUserData(GetEnumUnit()) -5)
              • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) - 5)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Less than 95
            • Then - Actions
              • Custom script: call SetUnitVertexColor( GetEnumUnit(), 255, 255, 255, GetUnitUserData(GetEnumUnit()) + 5)
              • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 5)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Greater than 100
            • Then - Actions
              • Custom script: call SetUnitVertexColor( GetEnumUnit(), 255, 255, 255, 100)
              • Unit - Set the custom value of (Picked unit) to 0
              • Unit Group - Remove (Picked unit) from TempGroup
            • Else - Actions
 

X.Terror.X

New Member
Reaction score
10
ok i in putted the custom value but didnt worked yet
i show you my trigger


Code:
NSD
    Events
        Unit - A unit enters Region 095 <gen>
    Conditions
        (Unit-type of (Triggering unit)) Equal to Necro
    Actions
        Unit - Order (Triggering unit) to Stop
        Wait 0.50 seconds
        Set NecroAngleShoot = 1
        Unit - Order (Triggering unit) to Neutral Pandaren Brewmaster - Breath Of Fire ((Position of (Triggering unit)) offset by 1000.00 towards (90.00 x (Real(NecroAngleShoot))) degrees)
        Wait 0.50 seconds
        Unit - Set the custom value of (Triggering unit) to 100
        Unit Group - Add (Triggering unit) to UnitFade

Code:
Remover
    Events
        Time - Every 0.20 seconds of game time
    Conditions
        (Number of units in UnitFade) Not equal to 0
    Actions
        Unit Group - Pick every unit in UnitFade and do (Actions)
            Loop - Actions
                Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) - 10)
                Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with (Real((Custom value of (Picked unit))))% transparency
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Custom value of (Picked unit)) Equal to 0
                    Then - Actions
                        Wait 1.00 seconds
                        Unit - Remove (Picked unit) from the game
                    Else - Actions
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Ok, wait... My trigger wasn't working :(

Here's the working one:
Trigger:
  • Vertex Color Timer
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: (String((Custom value of (Picked unit))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Greater than 50
              • (Custom value of (Picked unit)) Less than or equal to 100
            • Then - Actions
              • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) - 5)
              • Custom script: call SetUnitVertexColor( GetEnumUnit(), 255, 255, 255, R2I(GetUnitUserData(GetEnumUnit()) * 2.55))
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Equal to 50
            • Then - Actions
              • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 5)
              • Custom script: call SetUnitVertexColor( GetEnumUnit(), 255, 255, 255, R2I(GetUnitUserData(GetEnumUnit()) * 2.55))
              • Unit Group - Add (Picked unit) to TempGroup2
              • Unit Group - Remove (Picked unit) from TempGroup
            • Else - Actions
      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: (String((Custom value of (Picked unit))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Greater than or equal to 50
              • (Custom value of (Picked unit)) Less than or equal to 100
            • Then - Actions
              • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 5)
              • Custom script: call SetUnitVertexColor( GetEnumUnit(), 255, 255, 255, R2I(GetUnitUserData(GetEnumUnit()) * 2.55))
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Greater than 100
            • Then - Actions
              • Custom script: call SetUnitVertexColor( GetEnumUnit(), 255, 255, 255, 255)
              • Unit - Set the custom value of (Picked unit) to 0
              • Unit Group - Remove (Picked unit) from TempGroup2
            • Else - Actions


Btw, is nothing happening with your trigger there ? :S
 

X.Terror.X

New Member
Reaction score
10
alredy answered that its not working no

its because i made the custom value in a other trigger?
ive made the basic custom value in the first trigger mabye that whould be the problem


[nsd works but in the second trigger the custo mvalue proberly doesnt work]
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Yes, custom values can be used in other triggers...
They're attached to the units, not the triggers so can be used anywhere ;)

Or, do you mean you have another trigger which sets the custom value again ? :S
 

X.Terror.X

New Member
Reaction score
10
no only the trigger that i am showing

They're attached to the units, not the triggers so can be used anywhere
and they are attached to the units but i dont think it works with pick every unit in group because it only takes the info for only for 1 unit at least it reacts like that
i made a game text of the custom value
i see every 0.2 seconds seeing the numbers going -10 and it doesnt stop while it should show the value of each unit i hope u understand me


excample for 2 units
u see now 90 80 70
but if u got for excample 2 units it it is like this, every 0.2 second u will see
90 90 80 80 70 70


each color is for a unit excample what unit gives
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Yeah, but you mean that it only shows as if there were only 1 unit ? :S

So you mean that it's like, non-MUI ? :S

Well, my trigger isn't :p (non-MUI , I mean XD)
Why not use it ? :eek:
 

Komaqtion

You can change this now in User CP.
Reaction score
469
My trigger works as such that it'll decrease a units custom value (If they're in a specific unit-group) until it comes to a specific value (In my example, it's 50% transparency), then it starts to make it visible again, until it gets to 100%...

But what is it exactly you want to do with your trigger there ? :S
 

X.Terror.X

New Member
Reaction score
10
picking every unit in unit group and for every unit u change the custom value at least that whould be the point with ,pick every unit in unit group,

but instead it only does it for one[i think] while u got multiple units sprawning somethimes per half a second


Edit* the fade is just for changing transperancy from 100 to 0 when its 0 it removes the unit just a naturaly fade
[idea] if the trans realy doesnt work i make it windwalk perhaps for fading time
but i whould liek to know if this is posible learning things is often more importand then making a map on the hardest way if u understand what i mean
 

X.Terror.X

New Member
Reaction score
10
ok i fixed it the problems were i did transperancy from 100 to 0 while i should be from 0 to 100

and the get picked unit while waiting 1 second didnt worked out so the unit wasnt removed

thanks anyway i know hwo to use custom value it helped alot :)
 
General chit-chat
Help Users

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top