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

Income

Status
Not open for further replies.
Level 5
Joined
Jan 15, 2018
Messages
128
For some reason this script is giving me 315 gold instead of the wanted 25 gold

What am i doing wrong

  • DolG25
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Dol Goldur 25g (CP)) and ((Owner of (Matching unit)) Equal to (Picked player)))) and do (Actions)
            • Loop - Actions
              • Player - Add 25 to (Picked player).Current gold
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
There's no need for the Pick every player function, simply add 25 gold to the Owner of the Picked Unit.

  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Dol Goldur 25g (CP)) and do (Actions)
    • Loop - Actions
      • Player - Add 25 to (Owner of (Picked unit)).Current gold
Edit: Unless you want it so that players only get 25 gold regardless of how many they own. Then you can do something like this:
  • Actions
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • Set VariableSet TempGroup = (Units owned by (Picked player) of type Dol Goldur 25g (CP))
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in TempGroup) Greater than 0
          • Then - Actions
            • Player - Add 25 to (Picked player).Current gold
          • Else - Actions
        • Custom script: call DestroyGroup (udg_TempGroup)
Keep in mind that you aren't filtering out dead units so they will get grouped as well.
 
Last edited:
Level 5
Joined
Jan 15, 2018
Messages
128
ok so i removed the player group section and it is still giving me an absurd amount of gold. (over 200)

I cant seem to figure it out

Any ideas?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
It will give the Player 25 gold for each Dol Goldur 25g that belongs to them. Unless you use my second trigger which will only give 25 gold as long as they control at least 1.

Also, make sure to filter out DEAD units since they can be put in the Unit Group as well.
 
Level 5
Joined
Jan 15, 2018
Messages
128
There is only one Dol Guldur control point, and it is giving me 315 gold which is not divisible by 25. Kinda frustrating

There is another trigger which allows the Control Point to change owners, but i dont think this is doing anything.

here is the guide i followed: Control Point Income?
 
Level 5
Joined
Jan 15, 2018
Messages
128
  • BaradDur25
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Barad-dûr (CP))) and do (Actions)
        • Loop - Actions
          • Player - Add 25 to (Owner of (Picked unit)).Current gold
  • BaradurCP
    • Events
      • Unit - Barad-dûr (CP) 1109 <gen> Is attacked
    • Conditions
      • (Life of Barad-dûr (CP) 1109 <gen>) Less than 350.00
    • Actions
      • Unit - Change ownership of Barad-dûr (CP) 1109 <gen> to (Owner of (Attacking unit)) and Change color
      • Unit - Set life of Barad-dûr (CP) 1109 <gen> to 100.00%
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Is this: Barad-dûr (CP)

The same as this: Dol Goldur 25g (CP)

Also, try it without "set bj_wantDestroyGroup = true" and see what happens.

Additionally, create a text message that displays the name of the picked unit and maybe create a special effect at the position of the picked unit. This will help figure out what's going on.
 
Level 5
Joined
Jan 15, 2018
Messages
128
yeah they are the same, there are a bunch of Control Points with the same trigger.

Ill test it out real quick

Edit: ok didnt work. i guess ill have to mess with the gold amount and see if that does anything because i am clueless. Its a big map, idk if i can send it to you
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Yeah, I just tested it with a Footman using this:
  • Untitled Trigger 001
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Footman)) and do (Actions)
        • Loop - Actions
          • Player - Add 25 to (Owner of (Picked unit)).Current gold
And it worked fine.

Maybe you have some other trigger interfering?
 
Level 5
Joined
Jan 15, 2018
Messages
128
yes something is definitely messed up, i set the CP to 3 gold and it still gave me 293 gold.

How would you recommend checking for things that change this?

Ive looked through all my triggers nothing is affecting these triggers in particular and everyone of my control points giving an absurd amount of gold. (Ive tested the whole northeast side of the map)

Could it be something in the specs for the game?
 
Level 5
Joined
Jan 15, 2018
Messages
128
Hmm no, i havent really messed with gold, this is the only thing remotely pertinent

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Set starting resources (for all players)
      • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
      • Game - Set time of day speed to 75.00% of the default speed
EDIT: Ok i set the add property amount to -265 and that gave me 25 gold. So i guess that works. But im going to be doing this like 40 times. would a negative value be bad for this trigger?
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Hmm no, i havent really messed with gold, this is the only thing remotely pertinent

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Set starting resources (for all players)
      • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
      • Game - Set time of day speed to 75.00% of the default speed
EDIT: Ok i set the add property amount to -265 and that gave me 25 gold. So i guess that works. But im going to be doing this like 40 times. would a negative value be bad for this trigger?
That's fine, but it's still odd that this is happening. It has to be a trigger or weird Gameplay Constants or something.
 
Level 5
Joined
Jan 15, 2018
Messages
128
Thanks for all you time man. Really appreciate it, this has been hampering progress for a long while
 
Level 5
Joined
Jan 15, 2018
Messages
128
Hey again,
I finished the rest of the control points in Mordor and its seems to have bugged out the whole system.
This same trigger is now resetting the picked players gold to 0. (the same trigger you showed me)

This is messed up man, could the map be corrupted or something?

Would you be willing to take a quick look at it?
 
Status
Not open for further replies.
Top