• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Requirements for Variables

Status
Not open for further replies.
Level 4
Joined
May 2, 2013
Messages
107
Hi everyone,

I want to make a requirement (in the data module) linked to a global variable of the trigger module. I'm using a bankingsystem with eventually converts to variable integers. Is it possible to create a requirement for an upgrade which requires a specific integer value of an variable of the trigger module?


Other question. Is it possible to save upgrades being made with banks? So when an player purchades a certain upgrade, the bank will save that.. So the next time he playes again, the upgrade is already being made..


Hope to get my answers soon, Thanks in advance!!


Cheers :goblin_yeah:
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
I want to make a requirement (in the data module) linked to a global variable of the trigger module. I'm using a bankingsystem with eventually converts to variable integers. Is it possible to create a requirement for an upgrade which requires a specific integer value of an variable of the trigger module?
I do not think it is possible directly. However it is possible indirectly.

Make the requirement need an upgrade. This upgrade is then given to the player by triggers in response to your variable entering a certain value range. What is great is it works both ways as you can unlearn upgrades in SC2 (something WC3 mappers can only dream of). As such you have two parts.
1. When value exceeds X give player dummy upgrade.
2. When value drops below X remove dummy upgrade from player.

Other question. Is it possible to save upgrades being made with banks? So when an player purchades a certain upgrade, the bank will save that.. So the next time he playes again, the upgrade is already being made..
It most certainly is. You cannot do it directly (there is no "save player upgrades to bank" action) but you can do it indirectly by querying the levels of various updates and then storing these as integers or strings in the bank. When the game is loaded you then retrieve these values and then apply them as upgrades to the player.

It even works for upgrades that you are still researching. You just need to store what upgrades you have as well as the progress of any upgrades you are in the process of researching (being researched). I would recommend using a separate list to store upgrades in the process of research as this should be a small section and not worth increasing the size of every upgrade stored just to support the nescescary logic.

Upgrades can be encoded to strings using the same principles as WC3 save/load systems. Unlike WC3 these strings can be saved directly to the bank and loaded automatically so the player is completely unaware of them. This is the recommended approach as it minimizes XML overhead in the resulting bank file.
 
Level 4
Joined
May 2, 2013
Messages
107
It most certainly is. You cannot do it directly (there is no "save player upgrades to bank" action) but you can do it indirectly by querying the levels of various updates and then storing these as integers or strings in the bank. When the game is loaded you then retrieve these values and then apply them as upgrades to the player.

It even works for upgrades that you are still researching. You just need to store what upgrades you have as well as the progress of any upgrades you are in the process of researching (being researched). I would recommend using a separate list to store upgrades in the process of research as this should be a small section and not worth increasing the size of every upgrade stored just to support the nescescary logic.

Upgrades can be encoded to strings using the same principles as WC3 save/load systems. Unlike WC3 these strings can be saved directly to the bank and loaded automatically so the player is completely unaware of them. This is the recommended approach as it minimizes XML overhead in the resulting bank file.

Aaahhh, i c.. sweet.. Should be doable..



I do not think it is possible directly. However it is possible indirectly.

Make the requirement need an upgrade. This upgrade is then given to the player by triggers in response to your variable entering a certain value range. What is great is it works both ways as you can unlearn upgrades in SC2 (something WC3 mappers can only dream of). As such you have two parts.
1. When value exceeds X give player dummy upgrade.
2. When value drops below X remove dummy upgrade from player.

Hmmm.. I see a bit where ya going at..

If I am correct:

I make an upgrade dummy.. The upgrade dummy is a requirement for the upgrade that needs to have the (global var requirement).. If the the global vars reach a certain amount, trggers will give the dummy to a player.. so the requirement is met of the upgrade I want to be,,

What action should do that, give the dummy? Cant think of one, except:..

- Allow/Disallow Upgrade for Player
- Set Upgrade level for player

But these doent work (at least for what I have right now)

??
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
What action should do that, give the dummy? Cant think of one..
If requirement is player wide (once player meets requirement all units can do the action) -> Tech Tree - Set Upgrade upgrade level to X for player Y
If requirement is unit wide (only a specific unit can do the action if the requirement is met) -> Unit - Add X Behavior to Unit from Caster

You use a dummy upgrade for player wide requirement. Use a dummy buff behaviour for unit wide requirement.
 
Level 4
Joined
May 2, 2013
Messages
107
If requirement is player wide (once player meets requirement all units can do the action) -> Tech Tree - Set Upgrade upgrade level to X for player Y
If requirement is unit wide (only a specific unit can do the action if the requirement is met) -> Unit - Add X Behavior to Unit from Caster

You use a dummy upgrade for player wide requirement. Use a dummy buff behaviour for unit wide requirement.

I dont need specific unit wide, I only care for the player. So the behaviour isn't needed. I made something to check this out (doesnt seem very hard), but still it doesn't work. I've made screenshot of what I've done, can you check into it and tell me what I am missing?
 

Attachments

  • Screenshot Req.png
    Screenshot Req.png
    50.3 KB · Views: 151

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
I am not too sure your requirement logic is correct. I mean why are you using those constants? If you want to test for an upgrade level you need to place the value and a constant inside a greater than / less than / equals etc block otherwise it evaluates the constant as part of the logic.
 
Level 4
Joined
May 2, 2013
Messages
107
I am not too sure your requirement logic is correct. I mean why are you using those constants? If you want to test for an upgrade level you need to place the value and a constant inside a greater than / less than / equals etc block otherwise it evaluates the constant as part of the logic.

The constants are only there to say if its true or false right? 0 means false, and 1 is true i thought.

But you are saying that I need to change the 'and' to a camparison like 'less than' or 'equal to' ?

Im a bit confused, sorry ^^
 
Level 4
Joined
May 2, 2013
Messages
107
Aahhh, its clear now. It works, thank you very much for you help :) Kind Regards :D

Thread can be closed now. Can always count on this site, really appreciated all this :)
 
Status
Not open for further replies.
Top