Research an Upgrade for an Ally.

DeeVee

New Member
Reaction score
4
I'm looking for a way to click on Player 9's workshop, research an upgrade, and have it consume the player's (the one who clicked the research) gold as if it was a shop and had a hero in range. The research will be researched for Player 9. So essentially, Player 9 will have other player's purchase research upgrades for him.

More Details:
Player 9 will have loose shared units with Players 1-4.
Each upgrade goes 5 levels deep and have different prices for each level.
I want the gold price to appear on the upgrade, so I can't make the research free then just take the gold.
I want Player 9 to have 0 gold at all times, so I can't just have him buy the upgrade and take the player's gold.

I tried to trigger this but I got incredibly lost and off focus through the way. Any help?

NEVERMIND SOLVED MY PROBLEM!
 

-._.-

New Member
Reaction score
2
Make a upgrade workshop owned by Neutral Passive. Make the upgrades you want, set the levels of them, and set them to work only for Player 9.
Another way: make a dummy upgrade, that doesn't do anything (with the tooltips of course :D), and make a trigger like this:
Trigger:
  • Player 9 Upgrade
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Researched tech-type) Equal to YourUpgrade
    • Actions
      • Unit Group - Pick every unit in (Units owned by Player 9 (Gray)) and do (Actions)
        • Loop - Actions
          • -------- (Your Action Here) --------


Hope I helped.
 

Inflicted

Currently inactive
Reaction score
63
Trigger it with dummy items/units?
An upgrade can be triggered, using the purchase of the dummy as the 'event' triggering it.
Items bought from an ally, or units trained from there (considering it isnt shared control etc) is considered taken from the triggering players gold.
 

DeeVee

New Member
Reaction score
4
Trigger it with dummy items/units?
An upgrade can be triggered, using the purchase of the dummy as the 'event' triggering it.
Items bought from an ally, or units trained from there (considering it isnt shared control etc) is considered taken from the triggering players gold.

This was my exact logic at first, the problem that I ran into was: After upgrading research #3 5 times, and research #2 3 times, research #1 disappeared from the shop, know anything about that?

All my triggers went as follows
Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Unit-type of (Sold unit)) Equal to Attack Level 1
    • Then - Actions
      • Player Group - Pick every player in southTeam and do (If ((Picked player) Equal to (Owner of (Sold unit))) then do (Player - Set the current research level of Attack to 1 for Player 10 (Light Blue)) else do (Do nothing))
      • Player Group - Pick every player in northTeam and do (If ((Picked player) Equal to (Owner of (Sold unit))) then do (Player - Set the current research level of Attack to 1 for Player 11 (Dark Green)) else do (Do nothing))
      • Neutral Building - Add Attack Level 2 to (Selling unit) with 2 in stock and a max stock of 2
      • Neutral Building - Remove Attack Level 1 from (Selling unit)
      • Unit - Hide (Sold unit)
      • Unit - Remove (Sold unit) from the game
    • Else - Actions
      • Do nothing


Each of the triggers went like then going up to level 5..
To be more detailed about my problem I'll provide a scenario:
Research 1 = Attack
Research 2 = Defense
Research 3 = Speed

If I upgraded Attack to Level 5, then Defense to Level 5, then Speed to Level 5 (in that order)- everything works as intended.
However, If I upgrade Defense to Level 5, then Speed to Level 3 (in that order) - Attack Level 1 research is removed from the shop.
I've read over the trigger several times and didn't find any input errors.

I need to somehow make this leak-proof?
 

Inflicted

Currently inactive
Reaction score
63
The only reason I can think of that, is perhaps some error in your triggers.
Is that your only trigger of the sort?
Only reason I could think that they would remove a different unit, is if perhaps they are somehow linked, and removing one is using another trigger to remove that. I cannot say for sure.

You are using Picked Player in the wrong context. You should be using (Matching Player).
Also, don't use the Function 'Do nothing' it is fairly pointless, merely leave the Else section blank.

edit
The only leaking thing I see is your unit groups. You need to set it to a variable and then clear it, as to prevent memory leaks.
(However I have been reminded many times in the past here that it's not essential to do it in GUI, but yeah I recommend you do anyway)

Eg.
Trigger:
  • Set Temp_UnitGroup = (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to (Owner of (Sold unit)))))
    • Unit Group - Pick every unit in Temp_UnitGroup and do (Actions)
      • Loop - Actions
        • Player - Set the current research level of Iron Forged Swords to 1 for (Owner of (Sold unit))
    • Custom script: call DestroyGroup (udg_Temp_UnitGroup)


tbh I have never done it the method you are doing, with adding and removing units from a shop like that. Due to other players not being able to access the upgrades if you remove it.
But if you find a way to make it work great.

Normally I just have a dummy unit saying, eg "Upgrades damage by 1". And then that unit is rebought, storing your amount of that upgrade in a Variable. That way you are able to manipulate it much easier. But that's up to you.
 

DeeVee

New Member
Reaction score
4
Yea I couldn't find any logical errors in my trigger about removing another unit instead. But I fixed my issue by having another trigger re-add the unit in the event that Current research level or higher wasn't true so it works perfect.

Thanks for helping me get my brain running! +1
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top