• 🏆 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!

[Trigger] Lives and Levels

Status
Not open for further replies.
Level 2
Joined
Feb 24, 2008
Messages
12
Was wondering if anyone could help me out with setting lives on a TD. I want 30 lives and i would like it displayed in leaderboard with the number of lives the player currently has. Also, another hive workshop member is helping me with levels but he is doing it in Jass scripting. Was wondering if anyone could show me a the first few level triggers GUI style. Thanks i greatly appreciate all help
 
Level 5
Joined
Jul 11, 2007
Messages
152
Here's the basics for you:
You'll need to create a Real variable in this case I called it RedLives

  • Unit - A unit enters (RedRegion)
  • (Unit-type of (Entering unit)) Not Equal to (HumanBuilder)
  • Set RedLives = (Redlives - 1)
Then another one for when the person loses

  • Game - RedLives becomes Equal to 0.00
  • Game - Defeat Player 1 (Red) with the message: Defeat!
For the generic TD this is how you'd want to set up the levels

  • Time - Elapsed game time is X seconds
  • Unit - Create X AttackerLevel1 for Player 12 (Brown) at (AttackersSpawn1) facing Default building facing degrees
  • Unit Group - Order (Last Created Unit Group) to Attack-Move To (RedRegion)
That's the basis for all TDs, from there you can change the attacking units / regions in between / pathing etc.
Note that this will also cause leaks, if you'd like I can write another trigger for you that stops the leaks.
 
Level 2
Joined
Feb 24, 2008
Messages
12
could someone explain how you do the trigger tag? i knew once but forgot sorry, and if someone shows me how to trigger tag then i can show you what i have because another hive workshop member diod the levels and units that spawn with the levels in JASS triggering, the problem is level2+ wont spawn and i guess wont move, any help is appreciated
 
Level 5
Joined
Jul 11, 2007
Messages
152
SetVariable = Value

Then after you select RedLives for the variable, click on value and it should say ((RedLives) + 1), then click on the + and select -.
Hope that helps!

Edit: For the triggers you need to go advanced and then tag the text you copied with TRIGGER] pasted trigger here [/TRIGGER
with brackets [] surrounding both TRIGGER and /TRIGGER
 
Level 2
Joined
Feb 24, 2008
Messages
12
  • //TESH.scrollpos=0
  • //TESH.alwaysfold=0
  • function Trig_Units_Dead2_Actions takes nothing returns nothing
    • local group TempUnitGroup
    • //if (( GetUnitTypeId(GetTriggerUnit()) == 'h001' ) ) or (( GetUnitTypeId(GetTriggerUnit()) == 'h009' ) ) or (( GetUnitTypeId(GetTriggerUnit()) == 'n008' ) ) then
    • set udg_pkill[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] = ( udg_pkill[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] + 1 )
    • call LeaderboardSetPlayerItemValueBJ( GetOwningPlayer(GetKillingUnitBJ()), udg_leaderboard, ( udg_pkill[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] + 0 ) )
    • set TempUnitGroup = GetUnitsInRectOfPlayer(GetPlayableMapRect(), Player(11))
    • if (( CountUnitsInGroup(TempUnitGroup) <= 1 ) ) then
    • call GroupClear(TempUnitGroup)
      • if udg_level == 1 then
      • call Level1()
      • set udg_level = 2
      • elseif udg_level == 2 then
      • call Level2()
      • set udg_level = 3
      • elseif udg_level == 3 then
      • call Level3()
      • elseif udg_level == 4 then
      • call Level4()
      • elseif udg_level == 5 then
      • call Level5()
      • elseif udg_level == 6 then
      • call Level6()
      • elseif udg_level == 7 then
      • call Level7()
      • elseif udg_level == 8 then
      • call Level8()
      • elseif udg_level == 9 then
      • call Level9()
      • elseif udg_level == 10 then
      • call Level10()
      • elseif udg_level == 11 then
      • call Level11()
      • elseif udg_level == 12 then
      • call Level12()
      • elseif udg_level == 13 then
      • call Level13()
      • elseif udg_level == 14 then
      • call Level14()
      • elseif udg_level == 15 then
      • call Level15()
      • elseif udg_level == 16 then
      • call Level16()
      • elseif udg_level == 17 then
      • call Level17()
      • elseif udg_level == 18 then
      • call Level18()
      • elseif udg_level == 19 then
      • call Level19()
      • elseif udg_level == 20 then
      • call Level20()
      • elseif udg_level == 21 then
      • call Level21()
      • elseif udg_level == 22 then
      • call Level22()
      • elseif udg_level == 23 then
      • call Level23()
      • elseif udg_level == 24 then
      • call Level24()
      • elseif udg_level == 25 then
      • call Level25()
      • elseif udg_level == 26 then
      • call Level26()
      • elseif udg_level == 27 then
      • call Level27()
      • elseif udg_level == 28 then
      • call Level28()
      • elseif udg_level == 29 then
      • call Level29()
      • elseif udg_level == 30 then
      • call Level30()
      • elseif udg_level == 31 then
      • call Level31()
      • elseif udg_level == 32 then
      • call Level32()
      • elseif udg_level == 33 then
      • call Level33()
      • elseif udg_level == 34 then
      • call Level34()
      • elseif udg_level == 35 then
      • call Level35()
      • endif
      • endif
    • //endif
  • endfunction
  • //===========================================================================
  • function InitTrig_Units_Dead2 takes nothing returns nothing
    • set gg_trg_Units_Dead2 = CreateTrigger( )
    • call TriggerRegisterAnyUnitEventBJ( gg_trg_Units_Dead2, EVENT_PLAYER_UNIT_DEATH )
    • call TriggerAddAction( gg_trg_Units_Dead2, function Trig_Units_Dead2_Actions )
  • endfunction
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
First of all, if you have a Jass code post it in Jass tags using this syntax - [jass][/code].

Now I wonder if you even understand whats written there, don't just post converted triggers for no reason >.<

And since we started with this, why the hell don't you use a loop ?
JASS:
local integer i = 1
loop
      exitwhen i == 36
      if udg_level == i then
               call level[i]()
               return
      endif
endloop
 
Level 2
Joined
Feb 24, 2008
Messages
12
my friend jass scriped it for me, idk what it all means but i appreciate all help as i am new to triggers and trying to get expierenced so i can help other forum members out and make great maps, i am honored to have you post in here ghostwolf, you are expierenced yourself and i appreciate your help...thanks =^)
 
Status
Not open for further replies.
Top