• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Lose Lumber over time ?

Status
Not open for further replies.
Level 3
Joined
Aug 10, 2011
Messages
41
hey !

i am making a map ofcause. it is a Fantasy life map where you work etc. etc. and i need to make a trigger which should do so you lose like 1 lumber each second. because i have replaced the lumber with "hunger" and you have to buy things in order to keep you hunger up, if you dont and the hunger hits 0 then you die of starvation.

I have changed the icon and text etc. the only thing i need is this "countdown" thingy to make people lose lumber(hunger) every sec.

Can anyone help ?

Regards :ogre_hurrhurr:
 
Level 3
Joined
Aug 10, 2011
Messages
41
Trigger editor: Periodic Event --> Player - Add Property

And you should not try to keep your hunger up, more like your satiety.

hmm good point there m8 ^^ but then i have to make items which withdraws lumber instead of giving them ? hmmmmmm any suggestions ?
 
Last edited:
Level 3
Joined
Aug 10, 2011
Messages
41
An other question to this would now be, how do i make an condition which say that when his "lumber" count hit like 500 then his unit dies ?
 
Level 3
Joined
Aug 10, 2011
Messages
41
Just exchange the word "hunger"?

Year but then if i do, eksample "starvation" or something. but then every 2 sec then they are added 2 to starvation(lumber) then it is no use to buy item which gives more starvation(lumber)? so i have to change the items i made which gave like 50 lumber etc. to take 50 lumber instead.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
like this?

Player_lumber = interiger array
  • less lumber
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Set player_lumber[1] = (Player 1 (Red) Current lumber)
      • Set player_lumber[2] = (Player 2 (Blue) Current lumber)
      • Set player_lumber[3] = (Player 3 (Teal) Current lumber)
      • Set player_lumber[4] = (Player 4 (Purple) Current lumber)
      • Set player_lumber[5] = (Player 5 (Yellow) Current lumber)
      • Set player_lumber[6] = (Player 6 (Orange) Current lumber)
      • Set player_lumber[7] = (Player 7 (Green) Current lumber)
      • Set player_lumber[8] = (Player 8 (Pink) Current lumber)
      • Set player_lumber[9] = (Player 9 (Gray) Current lumber)
      • Set player_lumber[10] = (Player 10 (Light Blue) Current lumber)
      • Set player_lumber[11] = (Player 11 (Dark Green) Current lumber)
      • Set player_lumber[12] = (Player 12 (Brown) Current lumber)
      • Player - Set Player 1 (Red) Current gold to (player_lumber[1] - 1)
      • Player - Set Player 2 (Blue) Current gold to (player_lumber[2] - 1)
      • Player - Set Player 3 (Teal) Current gold to (player_lumber[3] - 1)
      • Player - Set Player 4 (Purple) Current gold to (player_lumber[4] - 1)
      • Player - Set Player 5 (Yellow) Current gold to (player_lumber[5] - 1)
      • Player - Set Player 6 (Orange) Current gold to (player_lumber[6] - 1)
      • Player - Set Player 7 (Green) Current gold to (player_lumber[7] - 1)
      • Player - Set Player 8 (Pink) Current gold to (player_lumber[8] - 1)
      • Player - Set Player 9 (Gray) Current gold to (player_lumber[9] - 1)
      • Player - Set Player 10 (Light Blue) Current gold to (player_lumber[10] - 1)
      • Player - Set Player 11 (Dark Green) Current gold to (player_lumber[11] - 1)
      • Player - Set Player 12 (Brown) Current gold to (player_lumber[12] - 1)
 
Level 3
Joined
Aug 10, 2011
Messages
41
Hmmmmm How did u make those ones m8 ? i have tried but cant get the same action like u have there : /

Maybe i can pastebin the map, can beg you to do it for me :D ? haha ^^
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
@Darkgrom, what not make use of loop? You don't need to set player's current lumber value into variable either.
Trigger can be cut to this:

  • less lumber
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current lumber to (((Picked player) Current lumber) - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) Current lumber) Equal to 0
            • Then - Actions
              • // Death everywhere!?
            • Else - Actions
 
Level 3
Joined
Aug 10, 2011
Messages
41
Hmmm yea i see, but somehow i cant get my triggers to match yours ? example the - 1 behind the first action and the condition after?

maybe it is just me who cant find it ? :p
 

Attachments

  • Fantasy Life Holmenlund.w3x
    5.2 MB · Views: 97
Level 3
Joined
Aug 10, 2011
Messages
41
Ahhh got it ^^ now how do i do the condition ? and last make the the trigger kill the picked player hero ?

by the way thx for the help ^^
 
Level 5
Joined
Feb 6, 2011
Messages
177
a trigger to kill the hero is easy

  • Events
    • Time - every 1.0 second of the game
  • Conditions
  • Actions
    • Player Group - Pick every player in (All Players) and do (Actions)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • ((Picked player).Current lumber) Equal to 0
      • Then - Actions
        • Unit Group - Pick every unit in playable map Area and do Actions
          • if (owner of (picked unit)) is equal to (picked player) and (picked unit) is a hero is equal to true then kill (picked unit) else do nothing
      • Else - Actions
Else - Actions
 
Last edited:
Level 3
Joined
Aug 10, 2011
Messages
41
Could you guide me through how to make that last trigger m8 ? i can´t seem to figure out how to do it, im quite new at this so :D

or you could create a map and insert the trigger there, then after attach the the map to your post then i can copy paste the trigger :D

i would prefer learning it so :D
 
Level 3
Joined
Aug 10, 2011
Messages
41
  • less lumber
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current lumber to (((Picked player) Current lumber) - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) Current lumber) Equal to 0
            • Then - Actions
              • // Death everywhere!?
            • Else - Actions
this, i only need to make the execute/kill trigger that unholydarkness made, but im not good at making triggers xD

+ that you need to make the function so that everyplayer loses lumber. do that by make an time event, and player -- add propety and set it to -2.
 
Level 9
Joined
Apr 23, 2010
Messages
312
Ok, well when your looking for the actions scroll near the bottom until you see "Unit Group" and it should be the first one for the loop and should read "Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)". Once you have that picked out go ahead and add "Unit - Kill (Picked unit)" to the unit group loop action.

The trigger you have above already makes all players lose 1 lumber every second so no need to add it again ;)

EDIT: Sorry I forgot to say that the unit group loop goes under the "Then" actions of the ITE (if/then/else).
 
Level 3
Joined
Aug 10, 2011
Messages
41
Ok, well when your looking for the actions scroll near the bottom until you see "Unit Group" and it should be the first one for the loop and should read "Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)". Once you have that picked out go ahead and add "Unit - Kill (Picked unit)" to the unit group loop action.

The trigger you have above already makes all players lose 1 lumber every second so no need to add it again ;)

EDIT: Sorry I forgot to say that the unit group loop goes under the "Then" actions of the ITE (if/then/else).


""Unit - Kill (Picked unit)"" yea that far i did came, but i need it to look like he did and i can´t make the rest like he did here:
  • if (owner of (picked unit)) is equal to (picked player) and (picked unit) is a hero is equal to true then kill (picked unit) else do nothing
 
Level 3
Joined
Aug 10, 2011
Messages
41
ye i know the conditions :p but how do you attach them to the unit kill trigger ?

i mean i go add action -- unit kill -- now what :D ?




okay i tried making something and it ended up like this :
 

Attachments

  • Capture.PNG
    Capture.PNG
    18 KB · Views: 80
Last edited:
Level 5
Joined
Feb 6, 2011
Messages
177
ye i know the conditions :p but how do you attach them to the unit kill trigger ?

i mean i go add action -- unit kill -- now what :D ?




okay i tried making something and it ended up like this :

this is an another way ;) and to add the conditions in 1 line just use the simple if .. not the multi functional if ;)
but what u did should work perfectly .. is it ?
regards
 
Level 3
Joined
Aug 10, 2011
Messages
41
If you can make the trigger and attach the testmap to me then i would apriciate that m8 :D

but what unit do we pick ? we just need to select all heroes own by the player who triggers the trigger ?. said in an other way the person who hit 0 in lumber/food gets his heroes killed.
 
Level 6
Joined
Jan 29, 2010
Messages
213
It's so easy, but Im not going to do it for u! Do it your self it will be like a lesson to you...

  • decreasing lumber
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) Current lumber) Not equal to 0
            • Then - Actions
              • Player - Set (Player((Integer A))) Current lumber to (((Player((Integer A))) Current lumber) - 1)
            • Else - Actions
              • Unit Group - Pick every unit in (Units owned by (Player((Integer A)))) and do (Unit - Kill (Picked unit))
Of course u can add condition to improve your system. like this one:
  • (((Player((Integer A))) slot status) Equal to Is playing) and (((Player((Integer A))) controller) Equal to User)
 
Level 9
Joined
Apr 23, 2010
Messages
312
Here you go, I tested this out until I got it to work properly, which I think I can say no one else will do. By the way, you shouldn't "set" lumber if there is a "add" action instead, it's simpler and easier. If you don't use "set bj_wantDestroyGroup = true" before you create a unit group, it will leak and eventually lag the game since this is being done every second or two.

  • Decrease Lumber
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) Current lumber) Equal to 0
            • Then - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units owned by (Player((Integer A)))) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Unit - Kill (Picked unit)
                    • Else - Actions
            • Else - Actions
              • Player - Add -1 to (Player((Integer A))) Current lumber
Also, when you want to show your trigger, you don;t have to use screenshots. All you have to do is right-click on the trigger name and "Copy As Text" then before you past the trigger type in [trigger ] and after you paste it then you type [/trigger ], but without spaces.
 
Last edited:
Level 3
Joined
Aug 10, 2011
Messages
41
Okay i made this:
  • Untitled Trigger 024
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) Current lumber) Not equal to 0
            • Then - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units owned by (Player((Integer A)))) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Unit - Kill (Picked unit)
                    • Else - Actions
            • Else - Actions
              • Player - Add -1 to (Player((Integer A))) Current lumber
But then when i tried to launch the map this thing came up:

capturedwd.png
 
Level 3
Joined
Aug 10, 2011
Messages
41
Hmmmm yea now the hero dies alright. but he dies no matter what :p ? and as soon as he revives then he dies again, even if i have 500 lumber :/ ?

it is like it doesn´t check the amount of the player lumber before doing the trigger ?
 
Level 9
Joined
Apr 23, 2010
Messages
312
You have the condition checking if lumber = 0 not true then it will kill the unit, set it to true.

Change
  • ((Player((Integer A))) Current lumber) Not equal to 0
to
  • ((Player((Integer A))) Current lumber) Equal to 0
Don't change anything else, this will work. If this isn't straight forward enough just look back at my post and make your trigger look EXACTLY like the one I gave you.
 
Level 3
Joined
Aug 10, 2011
Messages
41
Wooohoooo :D ! now it works haha :D !

Thx for all the help guys, i know it must have been annoying helping a noob like me with this shit haha ^^

i´ve added this last trigger to it:

  • Events
    • Time - Every 15.00 seconds of game time
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Player((Integer A))) Current lumber) Equal to 0
          • Then - Actions
            • Custom script: set bj_wantDestroyGroup = true
            • Unit Group - Pick every unit in (Units owned by (Player((Integer A)))) and do (Actions)
              • Loop - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • ((Picked unit) is A Hero) Equal to True
                  • Then - Actions
                    • Unit - Kill (Picked unit)
                    • Wait 10.00 seconds
                    • Player - Add 100 to (Player((Integer A))) Current lumber
                  • Else - Actions
          • Else - Actions
            • Player - Add -1 to (Player((Integer A))) Current lumber
so that you dont die as soon as you ress. ^^
 
Level 3
Joined
Aug 10, 2011
Messages
41
hehe well thx anyway to you all ^^

i learned much through the experience if u can call it that :D

Hmmmm it seems that my last added trigger doesn´t work ?

haha i need to ask you again to help me out creating this last trigger and then it will be the end of this Function lol ;D
 
Last edited by a moderator:
Level 9
Joined
Apr 23, 2010
Messages
312
What exactly isn't working, and why is there a wait? I suggest you remove the wait and instead of adding 100 lumber to "Player (Integer A)" try adding it to "Owner of (Picked unit)".

Like UnHolyDarKness says, Hiveworkshop is the place to ask questions no matter how small or noobish one might seem :)
 
Status
Not open for further replies.
Top