Unit Gives Uniy Gold Gives Player Gold

S

Sunny_D

Guest
hm... maybe its a little easier to understand if i show you a quickly done sample map. you can then also test it to see if it fits your needs.

you can copy and paste the triggers if you want, and change the unit-types to what you need them to be (i used footman and siege-tanks, check the train-trigger to specify)

also must of course not be on training-event, just thought that would be a good method. the ping-location action, is only for testing. you would replace them with your needed functions ofc...

and it is - as i hope - leak free already ;)
 
W

WoW01

Guest
Just throwin another suggestion out there. You cold try checking the range every so often. Like
every (however many seconds you want) of the game

pick every unit within 200 of (unit type 1)
if-unit type of (picked unit) is equal to (unit type 2) then do
then- your actions
else do- nothing

yes the trigger is had typed, im working from a computer w/o wc3 right now, sry if thats inconvienant.
 
I

IKilledKEnny

Guest
hm... maybe its a little easier to understand if i show you a quickly done sample map. you can then also test it to see if it fits your needs.

you can copy and paste the triggers if you want, and change the unit-types to what you need them to be (i used footman and siege-tanks, check the train-trigger to specify)

also must of course not be on training-event, just thought that would be a good method. the ping-location action, is only for testing. you would replace them with your needed functions ofc...

and it is - as i hope - leak free already ;)

Once again you helped me :) Thanks so much. Could you explain me how to generally increase a unit's maximum health?
 
S

Sunny_D

Guest
for example:

1) make a custom ability based off the Item-Abilty "Item Life Bonus"
2) uncheck "item ability" and check "hero ability" (or not - depends on what unit you are going to use it)
3) change the stats as necessary
4) trigger it with unit-add ability:
Code:
Unit - Add Custom_Item_Life_Bonus_Ability to MyUnit
 
I

IKilledKEnny

Guest
Oh wait one problem (related to the first question). I changed a little the Triggers:

Code:
Untitled Trigger 001
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Mine (Stone & Gold) 
        ((Target unit of ability being cast) is in (Units of type Gold Mine)) Equal to True
    Actions
        Unit Group - Add (Triggering unit) to GathererGroup

Code:
Untitled Trigger 002
    Events
        Unit - A unit Finishes training a unit
    Conditions
        (Unit-type of (Trained unit)) Equal to Resources Wagon
    Actions
        Unit Group - Add (Trained unit) to ResourcesWagonGroup

Now in the third Trigger I did this:

Code:
Untitled Trigger 003
    Events
        Time - Every 0.50 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in ResourcesWagonGroup and do (Actions)
            Loop - Actions
                Set ResourcesWagonPoint = (Position of (Picked unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between GathererPoint and ResourcesWagonPoint) Less than or equal to 100.00
            Then - Actions
                Player - Add -10 to Player 1 (Red) Current gold
            Else - Actions

But there are 2 problems with this Trigger. 1. I want to add another condition. Only if a player owns both units (the ResourcesWagon and the Gatherer) then he would lose -10 gold. 2. Instead of player 1 (red) I want to make it the player that owns those 2 units.

Thanks for any help.
 
I

IKilledKEnny

Guest
Sorry I posted only part of the third Trigger;

Code:
Untitled Trigger 003
    Events
        Time - Every 0.50 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in GathererGroup and do (Actions)
            Loop - Actions
                Set GathererPoint = (Position of (Picked unit))
        Unit Group - Pick every unit in ResourcesWagonGroup and do (Actions)
            Loop - Actions
                Set ResourcesWagonPoint = (Position of (Picked unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between GathererPoint and ResourcesWagonPoint) Less than or equal to 100.00
            Then - Actions
                Player - Add -10 to Player 1 (Red) Current gold
            Else - Actions
 
I

IKilledKEnny

Guest
Wait, I think I figured it out!!

Would this work? :

Code:
Untitled Trigger 004
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Unit Group - Pick every unit in GathererGroup and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Owner of (Picked unit)) Equal to (Picked player)
                            Then - Actions
                                Set GathererPoint = (Position of (Picked unit))
                                Unit Group - Pick every unit in ResourcesWagonGroup and do (Actions)
                                    Loop - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Owner of (Picked unit)) Equal to (Picked player)
                                            Then - Actions
                                                Set ResourcesWagonPoint = (Position of (Picked unit))
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        (Distance between GathererPoint and ResourcesWagonPoint) Less than or equal to 100.00
                                                    Then - Actions
                                                        Player - Add -10 to (Picked player) Current gold
                                                    Else - Actions
                                            Else - Actions
                            Else - Actions

P.S. Tested it, doesn't work, why?
 
M

Mythic Fr0st

Guest
lol

Well....

Code:
Event - A unit comes within range of "4" of gold mine 0001 Gen
Conditions
Actions <your actions>
 
I

IKilledKEnny

Guest
Trigger Not Working

Code:
Untitled Trigger 004
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Unit Group - Pick every unit in GathererGroup and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Owner of (Picked unit)) Equal to (Picked player)
                            Then - Actions
                                Set GathererPoint = (Position of (Picked unit))
                                Unit Group - Pick every unit in ResourcesWagonGroup and do (Actions)
                                    Loop - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Owner of (Picked unit)) Equal to (Picked player)
                                            Then - Actions
                                                Set ResourcesWagonPoint = (Position of (Picked unit))
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        (Distance between GathererPoint and ResourcesWagonPoint) Less than or equal to 100.00
                                                    Then - Actions
                                                        Player - Add -10 to (Picked player) Current gold
                                                    Else - Actions
                                            Else - Actions
                            Else - Actions

I know why it doesn't work, it can't do unit loop twice, so how could I do the Trigger?
 
K

Kevin

Guest
I don't think you need to loop those actions at all. If the trigger event is set to every 1 seconds of game time, the trigger itself will loop automatically. That loop is redundant and probably causing a conflict.

Also, every 1 seconds of gametime is a bit processor heavy, I really do suggest a 2 or 3 seconds time frame to kill possible processor lag.
 
M

Mythic Fr0st

Guest
hmm

Well...

Firstly, I think the reason its not working is because
your picking units out of an empty group

your doing

Pick every unit in GathererGroup and do actions
BUT unless you do
set GathererGroup = units of type Gatherer first...

E.G

set GathererGroup = units of type Gatherer
Pick every unit in GathererGroup and do actions



Gatherer Group has NO units
Unless preset?


same for wagon group

Code:
Event - Every 1.000000000000 seconds (:D lol)
Conditions
Actions - 
  - set GatherGroup = Units of type Gatherer
   - pick every unit in GatherGroup and do multiple actions
      loop
       set GatherUnit[i] = picked unit
       set i = i + 1
- For each Integer A from 0 to i
   loop
    set GatherPoint = position of GatherUnit[Integer A]
    set WagonGroup = units of type wagon
     - pick every unit in WagonGroup and do multiple actions
     - set WagonPoint = position of picked unit
     - if distance between GatherPoint and WagonGroup less than or equal to 100,
     add 10 gold to owner of picked unit

ANYWAY

once you get it working...

use

call RemoveLocation(udg_WagonPoint)
call RemoveLocation(udg_GathererPoint)

otherwise your trigger will LEAK and make MASSIVE lag like crazy

- Fixed your code, should work now

Code:
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Set GathererGroup = units of type Gatherers
                Unit Group - Pick every unit in GathererGroup and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Owner of (Picked unit)) Equal to (Picked player)
                            Then - Actions
                                Set GathererPoint = (Position of (Picked unit))
                                set ResourcesWagonGroup = units of type ResourcesWagonGroup
                                Unit Group - Pick every unit in ResourcesWagonGroup and do (Actions)
                                    Loop - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Owner of (Picked unit)) Equal to (Picked player)
                                            Then - Actions
                                                Set ResourcesWagonPoint = (Position of (Picked unit))
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        (Distance between GathererPoint and ResourcesWagonPoint) Less than or equal to 100.00
                                                    Then - Actions
                                                        Player - Add -10 to (Picked player) Current gold
                                                    Else - Actions
                                                 call RemoveLocation(udg_ResourcesWagonPoint)
                                       call RemoveLocation(udg_GathererPoint)
                                       call DestroyGroup(udg_ResourcesWagonGroup)
                                            Else - Actions
                       call DestroyGroup(udg_GathererGroup)
                            Else - Actions

try that, its a bit messy
 

Exide

I am amazingly focused right now!
Reaction score
448
I believe you are trying to set one point at several places..

Code:
                  Unit Group - Pick every unit in GathererGroup and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Owner of (Picked unit)) Equal to (Picked player)
                            Then - Actions
                                [B]Set GathererPoint = (Position of (Picked unit))[/B]

Pretend that you have 5 units in GathererGroup. This would make your trigger set GathererPoint at 5 Points. I don't know what will happen when one does this. But my guesses are that either:
A. The Point is set to the last picked unit of those 5. (Whoever that is?) Or.
B. The trigger simply doesn't work.

Also I don't understand what

If - Conditions
(Owner of (Picked unit)) Equal to (Picked player)


has to do with anything. :p

Maybe I'm just missing the point, somewhere. :eek:
 
I

IKilledKEnny

Guest
Hmmmm, what did you change in the Trigger, Mythic Fr0st, beside adding: call RemoveLocation(udg_WagonPoint)
call RemoveLocation(udg_GathererPoint) ?
I saw you added unit to each group, but I did that already in other Triggers.

I will also explain now quickly what I want to do in this Trigger;
Every 1 second the game will pick all players and then each unit that is Resources Wagon and each Mining Gatherer they got (I did that in other Triggers...). Now if a mining gatherer and Resources Wagon, are far a way from each other as 100 or less and controlled by the same player, the player will lose 10 gold.

I hope you understoof my horrible English.

Thanks for helping.
 

Exide

I am amazingly focused right now!
Reaction score
448
I'm not sure if I understand what you want the trigger to do, to be honest. :p
But if I got it right, you want to count units that are in a certain region? ("Gatherers")

I believe you can do this in an easy way with a trigger.. But I don't have WE with me, so I'm not sure what the name of the trigger is. :(
It's something similar to 'Evaluation - Count Number of Units (Matching Conditions)'
If that's the case, you could just make a region around these.. Whatever-it-is-that-you're-gathering, (Rocks?) and use this trigger to count how many units of each player is in there. And add the number to a Variable.
Then have a simple trigger that adds X * 10 gold to *Player* every *seconds*.
Where X is the Variable that you set before (number of units owned by *Player* in *Region*.)

Hope you understand what I mean, even though it's messy. :p
If you happen to find this trigger I was talking about, we MIGHT be able to solve this! ^^ (Or someone else will find another, easier way to do it. :p)
 
I

IKilledKEnny

Guest
No, Exide, ok I'll just post the 2 Trigger that Define the UnitGroups.

Code:
Untitled Trigger 001
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Mine (Stone & Gold) 
    Actions
        Unit Group - Add (Triggering unit) to GathererGroup

Code:
Untitled Trigger 002
    Events
        Unit - A unit Finishes training a unit
    Conditions
        (Unit-type of (Trained unit)) Equal to Resources Wagon
    Actions
        Unit Group - Add (Trained unit) to ResourcesWagonGroup

Now in the third Trigger what I want to do is this; pick every unit in those 2 Unit Groups and then if a certain unit from GathererGroup is 100 or less far a way from a unit in ResourcesWagonGroup, and both units are controlled by the same player then add -10 gold to that player.
 
I

IKilledKEnny

Guest
Ok I thought about making somthing like this:

Code:
Untitled Trigger 003
    Events
        Time - Every 2.00 seconds of game time
    Conditions
        (Distance between (Position of (Random unit from GathererGroup)) and (Position of (Random unit from ResourcesWagonGroup))) Less than or equal 
to 100.00
[B]Here I'm making up thing cause no idea how to do it; Both Units Owned By The Same Player[/B]
    Actions
Player - Add -10 to <The Player> Current gold

2 Problems though. 1 No idea how to make second condition. 2. I don't want it to be a RANDOM unit but A unit.

I would appreciate any help +REP.
 

Exide

I am amazingly focused right now!
Reaction score
448
Maybe you could...
Instead of Unit Groups, use a Unit Variable with array?
One for each team.
But I'm guessing that this will only allow one unit per player..
Sorry I don't know.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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