[General] Double-sided resources.

Level 7
Joined
Feb 11, 2016
Messages
190
Greetings! I need a bit of help, I need to make (for now just for gold) double-sided resources, let me introduce you what I mean.
In incoming map I'm making (I will post it on Hive Workshop), player play with chosen hero, one of heroes available is "Shadow Demon", it is one hero with two bodies, Shadow and Demon, each is independent hero, and a "force" (which is basically a player) can change from one to another in any time (with ability cd of course) and body without that force don't have anything to do with a player that controlling another body therefore can't change items. I need to make that that the each body has own money but both collect it together, for example one collect 30 gold, both bodies has 30 gold to spend. Another example... I chose Shadow and collect 40 gold and buy some items (including tomes) when I swap body and get control over Demon I want still have 40 gold, not just what is left, so I can buy items for same amount of gold with a Demon too, then Demon earn some money, again, both of bodies can spend it. This can be easily done by tracking 4 different money flows, for both of the bodies are tracking money it has until it's changed into another and money it has when another changed into it, what is counted like previous money + money other body earn, this can be done with variables. If anything is not clear, feel free to ask, I want "finish" map for posting in a few next days. Thank you.
 
Level 25
Joined
May 11, 2007
Messages
4,656
Create a computer player that you share control with. Whenever you change to the demon unit, change ownership of the unit to that player.
Whenever you give gold to the original player, give it to the shared control player as well. Then change back ownership to the original player when you change back to the original form.
 
Level 2
Joined
Jul 21, 2013
Messages
12
Maybe just make two global integer variables like Gold1 and Gold2 ussing triggers, so when you make the change, just make it so Gold1 stores current gold, then set current gold to Gold2. Then the inverse change, store current gold in the Gold2 variable and then set current gold to Gold1. Then (i think this is the hard part) make any gold earning to be assigned to both variables aswell as the current gold. If you need the details just respond and i'll post something more specific
 
Level 2
Joined
Jul 21, 2013
Messages
12
Yeah, you get the point, that's how I want make it, but don't know how to set variables to that. If you know, I will be glad if you help me about that, step by step. Tnx.

I use WorldEditor in Spanish lmao, but i hope you understand
You (of course) would have to create the variables first in the variable section, as Integers
Code:
 Morph
    Events
    Actions
        -------- Transform1 (Use player = Owner of such unit) --------
        Set Gold1 = (Jugador 1 (rojo) Oro actual)
        Jugador - Set Jugador 1 (rojo) Oro actual to Gold2

Code:
 MorphBack
    Events
    Actions
        -------- Transform2 (Use player = Owner of such unit) --------
        Set Gold2 = (Jugador 1 (rojo) Oro actual)
        Jugador - Set Jugador 1 (rojo) Oro actual to Gold1

Code:
 EarnGold
    Events
    Actions
        -------- Earn Gold --------
        Set Gold1 = (Gold1 + 20)
        Set Gold2 = (Gold2 + 20)
        Jugador - Add 20 to Jugador 1 (rojo) Oro actual
 
Level 7
Joined
Feb 11, 2016
Messages
190
I know Spanish, at least enough to understand everything, don't worry. I will try it. Thank you.

Edit: I don't now how to create variables, that's almost the whole point of my problem lol. Please... Did anyone read this?
 

Wrda

Spell Reviewer
Level 22
Joined
Nov 18, 2012
Messages
1,727
Edit: I don't now how to create variables, that's almost the whole point of my problem lol. Please... Did anyone read this?
This can be easily done by tracking 4 different money flows, for both of the bodies are tracking money it has until it's changed into another and money it has when another changed into it, what is counted like previous money + money other body earn, this can be done with variables.
> Knows there exist variables and this can be done with them. :thumbs_up:
> Doesn't know how to create variables. :goblin_jawdrop:
Shaking my head. How can you know there exist variables and your problem can be done with them and still don't know how to create them? Have you even tried to check around all things in the trigger editor before jumping into action?
Whatever, not worth ranting about this.
I can buy items for same amount of gold with a Demon too, then Demon earn some money, again, both of bodies can spend it.
Summing up, this is what you exactly mean? Almost everything else before looks confusing.
What kind of ways can you gain gold from? Bounty, gold items, triggers setting player gold amount?
 
Top