Tower Ranking System?

69STEP

New Member
Reaction score
0
Okay i am making a TD, and have had an idea to make some kind of ranking system, for each tower.

I have made several different buffs/abilities for ranks. What i want is when a tower reaches a certain amount of kills, it then drops the previous ability(rank) and gets another one, an upgraded one.

I have gone through the possibilities, and i really am stuck. Is it possible to use an integer array for this purpose ?

I'll probably get flamed for even asking this, but it's my last hope.

Any help will be greatly appreciated.

-Step
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Seriously the easiest way is to just store the number of kills in the custom value of the towers, and everytime you increase it just check if its equal to some kill checkmark then give it a skill.
 

LearningCode

New Member
Reaction score
24
loops are your friend

Create a unit array.
Everytime a tower is built, loop till the unit array is "null"
set the tower to the array

then, every time a tower attacks
Loop till it finds a match between the unit array and attacking tower
set the attack amount to an integer array with that same number

Then, when the integer hits a certain amount, UPGRADE!!!


hmm..
Something like this:

Create a trigger named BuildTower
JASS:
globals
   unit array Towers
   integer array Attacks
endglobals


function Act takes nothing returns nothing
   local integer i = 1
   local unit u = GetConstructedStructure() //I think this will work
   loop
   exitwhen i == 8190 //I cannot remember the limit for arrays...
      if Towers<i> == null then
         set Towers<i> = u
      endif
   exitwhen Towers<i> == u
   set i = 1
   endloop
endfunction

//===========================================================================
function InitTrig_BuildTower takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    local integer i = 0
    loop
    exitwhen i == 12 //The value of this is the MAX number of players minus One
       call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_CONSTRUCT_FINISH, null)
    set i = i+1
    endloop
    call TriggerAddAction( t, function Act )
endfunction


</i></i></i>



Below that trigger, create a trigger AttackCount:

JASS:
function AtkAct takes nothing returns nothing
   local integer i = 1
   local unit u = GetAttacker()
   local integer done = 0
   
   loop
   exitwhen i == 8190
      if Towers<i> == u then
         set Attacks<i> = Attacks<i> + 1
            if Attacks<i> = 500 then //I am assuming 500 is the amount of attacks to the next upgrade
               UnitRemoveAbility(u, &#039;rawcode&#039;) //The rawcode of the passive ability buff the tower has now
               UnitAddAbility(u, &#039;rawcode&#039;) //The rawcode of the passive ability buff you want to give the tower
            endif
         set done = 1
      endif
   exitwhen done == 1
   set i = i+1
   endloop
   

endfunction

//===========================================================================
function InitTrig_AttackCount takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEvent(t, Player(12), EVENT_PLAYER_UNIT_ATTACKED, null)
    //Change &#039;12&#039; into the player number of the computer minus one
    call TriggerAddAction( t, function AtkAct )
endfunction


</i></i></i></i>


That should work..
Assuming the upgrades we're talking about are passive abilities that you just remove and add.



[EDIT]
Could someone convert that into GUI?
I seriously wouldn't know how to do this in GUI =x
 

69STEP

New Member
Reaction score
0
Thank you for taking the time to help me. :)

I'll try it out.

EDIT: Yes, they are passive abilities. And i like your idea of attacks, rather than kills.
 

69STEP

New Member
Reaction score
0
Okay, thanks again for the help.

I got a few errors, probably due to my complete lack of experience with jass.

71509229.png


43455942.png
 

69STEP

New Member
Reaction score
0
That does not work for me, i get errors when trying to launch it.

Is there anyway of accomplishing my goal without using jass, just using the world editor controls?
 

jomik

New Member
Reaction score
17
There is really no reason for the loop man :p You can just store it in the custom value of the unit instead of an integer array. As someone already said.
I'll put up a trigger in a sec.
EDIT - Made it 2 triggers for easier customizeability :D
Trigger:
  • Set Up
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TowerLevels = 2
      • Set TowerKills[1] = 50
      • Set TowerAbility[1] = Attribute Bonus
      • Set TowerKills[2] = 100
      • Set TowerAbility[2] = Bash


Trigger:
  • Tower Kills
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Set KillingUnit = (Killing unit)
      • Unit - Set the custom value of KillingUnit to ((Custom value of (Killing unit)) + 1)
      • For each (Integer A) from 1 to TowerLevels, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of KillingUnit) Equal to TowerKills[(Integer A)]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of TowerAbility[(Integer A)] for KillingUnit) Equal to 0
                • Then - Actions
                  • Unit - Add TowerAbility[(Integer A)] to KillingUnit
                • Else - Actions
            • Else - Actions
      • Set KillingUnit = No unit


KillingUnit is set to No unit, which I think is null. Otherwise use:
Trigger:
  • Custom script: set udg_KillingUnit = null


--
KillingUnit is an unit variable.
TowerAbility is an ability variable array.
TowerKills is an integer variable array.
TowerLevels is an integer variable.

This is by Killing though.

For attacking, this should work - just changed the KillingUnit variable to attacking unit :D
Trigger:
  • Tower Kills
    • Events
      • Unit - A unit owned by Player 12 (Brown) Is attacked
    • Conditions
    • Actions
      • Set KillingUnit = (Attacking unit)
      • Unit - Set the custom value of KillingUnit to ((Custom value of (Killing unit)) + 1)
      • For each (Integer A) from 1 to TowerLevels, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of KillingUnit) Equal to TowerKills[(Integer A)]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of TowerAbility[(Integer A)] for KillingUnit) Equal to 0
                • Then - Actions
                  • Unit - Add TowerAbility[(Integer A)] to KillingUnit
                • Else - Actions
            • Else - Actions
      • Set KillingUnit = No unit
 

jomik

New Member
Reaction score
17
Well it's in a GUI forum, so made it GUI, the same can easily be done in vJASS or JASS. There's just no need to save ALL towers in a unit array.
Updating to set KillingUnit to null
 

69STEP

New Member
Reaction score
0
Thank you both for your help:) i really do appreciate it. It's something i've always wanted to see in a tower defense map, but i myself have never had the knowledge to put it in.
 

69STEP

New Member
Reaction score
0
I managed to find some code, from a tower defense game. It does exactly what i want mine to do.

Could anybody please have a read through it, and teach me how it works ? I don't really understand it.

Code:
function Trig_Gem_Awards_Conditions takes nothing returns boolean
	if(not(GetOwningPlayer(GetDyingUnit())==Player(11)))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func002C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==10))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func003C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==20))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func004C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==30))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func005C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==40))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func006C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==50))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func007C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==60))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func008C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==70))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func009C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==80))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func010C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==90))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func011C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==100))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func012C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==110))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func013C takes nothing returns boolean
	if(not(GetUnitUserData(GetKillingUnitBJ())==120))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Func015001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='h02M')
endfunction

function Trig_Gem_Awards_Func016001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='h02M')
endfunction

function Trig_Gem_Awards_Func017001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='h016')
endfunction

function Trig_Gem_Awards_Func018001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='h016')
endfunction

function Trig_Gem_Awards_Func019001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func020001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func021001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00A')
endfunction

function Trig_Gem_Awards_Func022001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00A')
endfunction

function Trig_Gem_Awards_Func023001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='h02U')
endfunction

function Trig_Gem_Awards_Func024001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='h02U')
endfunction

function Trig_Gem_Awards_Func026001001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func026001002 takes nothing returns boolean
	return(GetUnitUserData(GetKillingUnitBJ())==10)
endfunction

function Trig_Gem_Awards_Func026001 takes nothing returns boolean
	return GetBooleanAnd(Trig_Gem_Awards_Func026001001(),Trig_Gem_Awards_Func026001002())
endfunction

function Trig_Gem_Awards_Func027001001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func027001002 takes nothing returns boolean
	return(GetUnitUserData(GetKillingUnitBJ())==20)
endfunction

function Trig_Gem_Awards_Func027001 takes nothing returns boolean
	return GetBooleanAnd(Trig_Gem_Awards_Func027001001(),Trig_Gem_Awards_Func027001002())
endfunction

function Trig_Gem_Awards_Func028001001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func028001002 takes nothing returns boolean
	return(GetUnitUserData(GetKillingUnitBJ())==30)
endfunction

function Trig_Gem_Awards_Func028001 takes nothing returns boolean
	return GetBooleanAnd(Trig_Gem_Awards_Func028001001(),Trig_Gem_Awards_Func028001002())
endfunction

function Trig_Gem_Awards_Func029001001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func029001002 takes nothing returns boolean
	return(GetUnitUserData(GetKillingUnitBJ())==40)
endfunction

function Trig_Gem_Awards_Func029001 takes nothing returns boolean
	return GetBooleanAnd(Trig_Gem_Awards_Func029001001(),Trig_Gem_Awards_Func029001002())
endfunction

function Trig_Gem_Awards_Func030001001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func030001002 takes nothing returns boolean
	return(GetUnitUserData(GetKillingUnitBJ())==50)
endfunction

function Trig_Gem_Awards_Func030001 takes nothing returns boolean
	return GetBooleanAnd(Trig_Gem_Awards_Func030001001(),Trig_Gem_Awards_Func030001002())
endfunction

function Trig_Gem_Awards_Func031001001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func031001002 takes nothing returns boolean
	return(GetUnitUserData(GetKillingUnitBJ())==60)
endfunction

function Trig_Gem_Awards_Func031001 takes nothing returns boolean
	return GetBooleanAnd(Trig_Gem_Awards_Func031001001(),Trig_Gem_Awards_Func031001002())
endfunction

function Trig_Gem_Awards_Func032001001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func032001002 takes nothing returns boolean
	return(GetUnitUserData(GetKillingUnitBJ())==70)
endfunction

function Trig_Gem_Awards_Func032001 takes nothing returns boolean
	return GetBooleanAnd(Trig_Gem_Awards_Func032001001(),Trig_Gem_Awards_Func032001002())
endfunction

function Trig_Gem_Awards_Func033001001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func033001002 takes nothing returns boolean
	return(GetUnitUserData(GetKillingUnitBJ())==80)
endfunction

function Trig_Gem_Awards_Func033001 takes nothing returns boolean
	return GetBooleanAnd(Trig_Gem_Awards_Func033001001(),Trig_Gem_Awards_Func033001002())
endfunction

function Trig_Gem_Awards_Func034001001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func034001002 takes nothing returns boolean
	return(GetUnitUserData(GetKillingUnitBJ())==90)
endfunction

function Trig_Gem_Awards_Func034001 takes nothing returns boolean
	return GetBooleanAnd(Trig_Gem_Awards_Func034001001(),Trig_Gem_Awards_Func034001002())
endfunction

function Trig_Gem_Awards_Func035001001 takes nothing returns boolean
	return(GetUnitTypeId(GetKillingUnitBJ())=='n00F')
endfunction

function Trig_Gem_Awards_Func035001002 takes nothing returns boolean
	return(GetUnitUserData(GetKillingUnitBJ())==100)
endfunction

function Trig_Gem_Awards_Func035001 takes nothing returns boolean
	return GetBooleanAnd(Trig_Gem_Awards_Func035001001(),Trig_Gem_Awards_Func035001002())
endfunction

function Trig_Gem_Awards_Actions takes nothing returns nothing
	call SetUnitUserData(GetKillingUnitBJ(),(GetUnitUserData(GetKillingUnitBJ())+1))
	if(Trig_Gem_Awards_Func002C())then
		call UnitAddAbilityBJ('A01L',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func003C())then
		call UnitRemoveAbilityBJ('A01L',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01N',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func004C())then
		call UnitRemoveAbilityBJ('A01N',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01M',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func005C())then
		call UnitRemoveAbilityBJ('A01M',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01O',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A01Z',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func006C())then
		call UnitRemoveAbilityBJ('A01O',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A01Z',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01V',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A01P',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func007C())then
		call UnitRemoveAbilityBJ('A01V',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A01P',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01R',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A022',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func008C())then
		call UnitRemoveAbilityBJ('A01R',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A022',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01S',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A023',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A026',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func009C())then
		call UnitRemoveAbilityBJ('A01S',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A023',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A026',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01T',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A024',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A027',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func010C())then
		call UnitRemoveAbilityBJ('A01T',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A024',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A027',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01U',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A021',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A028',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func011C())then
		call UnitRemoveAbilityBJ('A01U',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A021',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A028',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01W',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A020',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A029',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A02C',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func012C())then
		call UnitRemoveAbilityBJ('A01W',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A020',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A029',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A02C',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01X',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A01Y',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A02A',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A02D',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func013C())then
		call UnitRemoveAbilityBJ('A01X',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A01Y',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A02A',GetKillingUnitBJ())
		call UnitRemoveAbilityBJ('A02D',GetKillingUnitBJ())
		call TriggerSleepAction(0.10)
		call UnitAddAbilityBJ('A01Q',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A025',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A02B',GetKillingUnitBJ())
		call UnitAddAbilityBJ('A02E',GetKillingUnitBJ())
		call AddSpecialEffectLocBJ(GetUnitLoc(GetKillingUnitBJ()),"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
	else
	endif
	if(Trig_Gem_Awards_Func015001())then
		set udg_unit02=GetKillingUnitBJ()
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func016001())then
		call ConditionalTriggerExecute(udg_trigger54)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func017001())then
		set udg_unit02=GetKillingUnitBJ()
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func018001())then
		call ConditionalTriggerExecute(udg_trigger54)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func019001())then
		set udg_unit02=GetKillingUnitBJ()
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func020001())then
		call ConditionalTriggerExecute(udg_trigger54)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func021001())then
		set udg_unit02=GetKillingUnitBJ()
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func022001())then
		call ConditionalTriggerExecute(udg_trigger54)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func023001())then
		set udg_unit02=GetKillingUnitBJ()
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func024001())then
		call ConditionalTriggerExecute(udg_trigger54)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func026001())then
		call SetUnitAbilityLevelSwapped('A075',GetKillingUnitBJ(),2)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func027001())then
		call SetUnitAbilityLevelSwapped('A075',GetKillingUnitBJ(),3)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func028001())then
		call SetUnitAbilityLevelSwapped('A075',GetKillingUnitBJ(),4)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func029001())then
		call SetUnitAbilityLevelSwapped('A075',GetKillingUnitBJ(),5)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func030001())then
		call SetUnitAbilityLevelSwapped('A075',GetKillingUnitBJ(),6)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func031001())then
		call SetUnitAbilityLevelSwapped('A075',GetKillingUnitBJ(),7)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func032001())then
		call SetUnitAbilityLevelSwapped('A075',GetKillingUnitBJ(),8)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func033001())then
		call SetUnitAbilityLevelSwapped('A075',GetKillingUnitBJ(),9)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func034001())then
		call SetUnitAbilityLevelSwapped('A075',GetKillingUnitBJ(),10)
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Func035001())then
		call SetUnitAbilityLevelSwapped('A075',GetKillingUnitBJ(),11)
	else
		call DoNothing()
	endif
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func002C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=10))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<20))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func003C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=20))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<30))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func004C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=30))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<40))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func005C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=40))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<50))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func006C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=50))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<60))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func007C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=60))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<70))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func008C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=70))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<80))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func009C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=80))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<90))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func010C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=90))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<100))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func011C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=100))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<110))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func012C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=110))then
		return false
	endif
	if(not(GetUnitUserData(GetTriggerUnit())<120))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func013C takes nothing returns boolean
	if(not(GetUnitUserData(GetTriggerUnit())>=120))then
		return false
	endif
	return true
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func016001001 takes nothing returns boolean
	return(GetUnitTypeId(GetTriggerUnit())=='h02U')
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func016001002 takes nothing returns boolean
	return(GetUnitTypeId(GetTriggerUnit())=='h02M')
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func016001 takes nothing returns boolean
	return GetBooleanOr(Trig_Gem_Awards_Upgrade_debug_Func016001001(),Trig_Gem_Awards_Upgrade_debug_Func016001002())
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func017001001 takes nothing returns boolean
	return(GetUnitTypeId(GetTriggerUnit())=='h02U')
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func017001002 takes nothing returns boolean
	return(GetUnitTypeId(GetTriggerUnit())=='h02M')
endfunction

function Trig_Gem_Awards_Upgrade_debug_Func017001 takes nothing returns boolean
	return GetBooleanOr(Trig_Gem_Awards_Upgrade_debug_Func017001001(),Trig_Gem_Awards_Upgrade_debug_Func017001002())
endfunction

function Trig_Gem_Awards_Upgrade_debug_Actions takes nothing returns nothing
	call TriggerSleepAction(0.25)
	if(Trig_Gem_Awards_Upgrade_debug_Func002C())then
		call UnitAddAbilityBJ('A01L',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func003C())then
		call UnitAddAbilityBJ('A01N',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func004C())then
		call UnitAddAbilityBJ('A01M',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func005C())then
		call UnitAddAbilityBJ('A01O',GetTriggerUnit())
		call UnitAddAbilityBJ('A01Z',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func006C())then
		call UnitAddAbilityBJ('A01V',GetTriggerUnit())
		call UnitAddAbilityBJ('A01P',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func007C())then
		call UnitAddAbilityBJ('A01R',GetTriggerUnit())
		call UnitAddAbilityBJ('A022',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func008C())then
		call UnitAddAbilityBJ('A01S',GetTriggerUnit())
		call UnitAddAbilityBJ('A023',GetTriggerUnit())
		call UnitAddAbilityBJ('A026',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func009C())then
		call UnitAddAbilityBJ('A01T',GetTriggerUnit())
		call UnitAddAbilityBJ('A024',GetTriggerUnit())
		call UnitAddAbilityBJ('A027',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func010C())then
		call UnitAddAbilityBJ('A01U',GetTriggerUnit())
		call UnitAddAbilityBJ('A021',GetTriggerUnit())
		call UnitAddAbilityBJ('A028',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func011C())then
		call UnitAddAbilityBJ('A01W',GetTriggerUnit())
		call UnitAddAbilityBJ('A020',GetTriggerUnit())
		call UnitAddAbilityBJ('A029',GetTriggerUnit())
		call UnitAddAbilityBJ('A02C',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func012C())then
		call UnitAddAbilityBJ('A01X',GetTriggerUnit())
		call UnitAddAbilityBJ('A01Y',GetTriggerUnit())
		call UnitAddAbilityBJ('A02A',GetTriggerUnit())
		call UnitAddAbilityBJ('A02D',GetTriggerUnit())
	else
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func013C())then
		call UnitAddAbilityBJ('A01Q',GetTriggerUnit())
		call UnitAddAbilityBJ('A025',GetTriggerUnit())
		call UnitAddAbilityBJ('A02B',GetTriggerUnit())
		call UnitAddAbilityBJ('A02E',GetTriggerUnit())
	else
	endif
	call TriggerSleepAction(0.25)
	if(Trig_Gem_Awards_Upgrade_debug_Func016001())then
		set udg_unit02=GetTriggerUnit()
	else
		call DoNothing()
	endif
	if(Trig_Gem_Awards_Upgrade_debug_Func017001())then
		call ConditionalTriggerExecute(udg_trigger54)
	else
		call DoNothing()
	endif
endfunction
 

jomik

New Member
Reaction score
17
That is a very bad JASS trigger :D Basically it's just GUI converted to JASS lol

EDIT: I updated the code as you requested:
Trigger:
  • Set Up
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TowerLevels = 2
      • Set TowerKills[1] = 50
      • Set TowerAbility[1] = Attribute Bonus
      • Set TowerKills[2] = 100
      • Set TowerAbility[2] = Bash


Trigger:
  • Tower Killing
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Set Unit2Modify = (Killing unit)
      • Unit - Set the custom value of Unit2Modify to ((Custom value of Unit2Modify) + 1)
      • For each (Integer A) from 0 to (TowerLevels - 1), do (Actions)
        • Loop - Actions
          • Set check = (TowerLevels - (Integer A))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of Unit2Modify) Greater than or equal to TowerKills[check]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of TowerAbility[(check - 1)] for Unit2Modify) Greater than or equal to 1
                • Then - Actions
                  • Unit - Remove TowerAbility[(check - 1)] from Unit2Modify
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of TowerAbility[check] for Unit2Modify) Less than or equal to 0
                • Then - Actions
                  • Unit - Add TowerAbility[check] to Unit2Modify
                • Else - Actions
              • Custom script: exitwhen true
            • Else - Actions
      • Set Unit2Modify = No unit


Unit2Modify is a unit variable.
check is an integer.
Others are the same as before.

EDIT: Changed triggering unit to Unit2Modify
 

Attachments

  • tower ranking.w3x
    20.6 KB · Views: 177

69STEP

New Member
Reaction score
0
That is a very bad JASS trigger :D Basically it's just GUI converted to JASS lol

EDIT: I updated the code as you requested:
Trigger:
  • Set Up
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TowerLevels = 2
      • Set TowerKills[1] = 50
      • Set TowerAbility[1] = Attribute Bonus
      • Set TowerKills[2] = 100
      • Set TowerAbility[1] = Bash


Trigger:
  • Tower Killing
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Set Unit2Modify = (Killing unit)
      • Unit - Set the custom value of Unit2Modify to ((Custom value of Unit2Modify) + 1)
      • For each (Integer A) from 0 to (TowerLevels - 1), do (Actions)
        • Loop - Actions
          • Set check = (TowerLevels - (Integer A))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of Unit2Modify) Greater than or equal to TowerKills[check]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of TowerAbility[(check - 1)] for Unit2Modify) Greater than or equal to 1
                • Then - Actions
                  • Unit - Remove TowerAbility[(check - 1)] from (Triggering unit)
                • Else - Actions
              • Unit - Add TowerAbility[check] to (Triggering unit)
              • Custom script: exitwhen true
            • Else - Actions
      • Set Unit2Modify = No unit


Unit2Modify is a unit variable.
check is an integer.
Others are the same as before.

Thank you Jomik, but this time it just doesn't give the tower any ability. Argh, it's so frustrating!:eek: Thanks for all your effort anyway.

Oh and, in the first trigger, is Set - TowerAbility[1] = bash supposed to be [2] ?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      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