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

Lumber mill > sawmill

Status
Not open for further replies.
Level 9
Joined
Jun 20, 2008
Messages
476
You got a lumber mill (it collects lumber) every 2 seconds you get 1 lumber item in that lumber mill if there is a sawmill nearby then every 20 seconds the lumber items should be taken out of the lumbermill and should transform to planks in the sawmill i could not figure out how to do that what i got now is this

  • wood1
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Lumber Mill) and do (Actions)
        • Loop - Actions
          • Hero - Create Wood and give it to (Picked unit)
  • wood1 Copy
    • Events
      • Time - Every 4.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set Temp_group3 = (Units owned by (Player((Integer A))) of type Sawmill)
          • Unit Group - Pick every unit in Temp_Group_1 and do (Actions)
            • Loop - Actions
              • Set Temp_Loc_2 = (Position of (Picked unit))
              • Set Temp_group4 = (Units within 512.00 of Temp_Loc_2 matching (((Owner of (Matching unit)) Equal to (Player((Integer A)))) and ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Sawmill))))
              • Item - Remove (Item carried by (Picked unit) in slot 1)
              • Custom script: call RemoveLocation(udg_Temp_Loc_2)
              • Custom script: call DestroyGroup(udg_Temp_Group_4)
          • Custom script: call DestroyGroup(udg_Temp_Group_3)
If u help me in any way i will give rep and credits
 
Level 9
Joined
May 22, 2009
Messages
276
Is this the complete trigger? You don't seem to use Set Temp_group4, there should be an IF the number of units in Temp_group4 more then or equal to 1 THEN remove 'item' and create 'plank' and give it to lumbermill

also if you always remove the item in slot 1 you'll probably also remove the planks, just do: set Item_Lumber=item carried by hero of type Lumber, then remove that item.

Also what do you use temp_group_3 for

also you named the ver temp_group4 but when you destroy it you wrote temp_group_4, but I guess this is just a typo
 
Level 9
Joined
May 22, 2009
Messages
276
  • Plank Trigger
    • Events
      • Time - Every 4.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set Group1 = (Units owned by (Player((Integer A))) of type Lumbermill)
          • Unit Group - Pick every unit in Group1 and do (Actions)
            • Loop - Actions
              • Set Sawmill_Point = (Position of (Picked unit))
              • Set Group2 = (Units within 500.00 of Sawmill_Point matching ((((Matching unit) is alive) Equal to True) and (((Unit-type of (Matching unit)) Equal to Sawmill) and ((Owner of (Matching unit)) Equal to (Player((Integer A)))))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in Group2) Greater than or equal to 1
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has an item of type Wood) Equal to True
                    • Then - Actions
                      • Set Wood_Item = (Item carried by (Picked unit) of type Wood)
                      • Item - Remove Wood_Item
                      • Hero - Create Plank and give it to (Picked unit)
                    • Else - Actions
                • Else - Actions
              • Custom script: call DestroyGroup(udg_Group2)
              • Custom script: call RemoveLocation(udg_Sawmill_Point)
          • Custom script: call DestroyGroup(udg_Group1)
I believe this should do it
 
Level 9
Joined
May 22, 2009
Messages
276
i mean the item in slot one has for example 5 charges will that give 5 planks ?

you did not tell me the wood has charges, but in that case do you want all the charges to turn into a plank, or just 1 charge?

Anyway, if you want all the charges, just make an integer variable=charges remaining in Wood_Item, and set charges for last created item to that variable


if you want to just change 1 charge, set charges remaining -1 if the charges are more then 1, else remove the item, when you create the plank, set charges=1
 
Level 9
Joined
Jun 20, 2008
Messages
476
I made the trigger the problem is the plank is given to Picked unit and it has to be given to sawmill i tried some item moving and stuff but could not manage to do it u have solution ?

(and what is the custom script for clearing a variable of types item type and integer ?)
 
Level 9
Joined
May 22, 2009
Messages
276
I made the trigger the problem is the plank is given to Picked unit and it has to be given to sawmill i tried some item moving and stuff but could not manage to do it u have solution ?

(and what is the custom script for clearing a variable of types item type and integer ?)

should there be made one plank for each sawmill, or just 1 plank?

Either way you already have UnitGroup2 that's = all the sawmills around lumbermill

Just pick every unit in UnitGroup2 and give the item to them, and if it's only one, just take random unit from UnitGroup2

And you don't need custom scripts for integer, item or unit variables, they don't leak
 
Level 9
Joined
May 22, 2009
Messages
276
you cant use a variable unit group when trying to change trigering unit so suggestions ?


I have no idea what you're talking about now, triggering unit? There's no such thing, or if you mean the 2 unit groups overlapsing, you can do For each integer 1 to number of unit in group 2
loop
set Sawmill_Unit=random unit from unitgroup2
give Sawmill_Unit Plank
Set charges remaining for last created item to 1
remove Sawmill_unit from unitgroup2
 
Status
Not open for further replies.
Top