2 posts Maps can also be downloaded from my webpage. joined
#1
Is there a way to SetUnitGold?
Is there a way to set and modify the unit gold costs and other unit-variables by jass? The other mapmakers i know in Bnet also don't know a way to do this. I aready spend many days in googling and reading JASS tutorials. I am editing Battleships Crossfire with the maker of it and would like to let the pricing set by and ingame voteable formular so you can choose between the old pricings, the pricings of battleships advanced and BS pro... Can anyone help?
It is imposiable to directly change the gold price so that the gold icon value changes when you vote a certain difficulty.
It is possiable to change the cost by simulating the duduction of gold by the ship using triggers.
The guideline is you have to run the formular to culculate the cost of the ship when the person purchases the dummy item / unit then if the person has enough gold it removes the gold amount and generates the ship or if the person does not have the gold it does nothing.
There is no way to change the unit price. I myself had a problem with this in a Hero line war map of mine. However, there is a way to work around it. The method i found most effective is to create a seperate unit with the exact same model/stats/icon (basically a copy and paste) but increase the price. Then create a trigger so that (in your case) if the dialog button is clicked, replace the cheaper version of the unit in the shop with the more expensive unit.
2 posts Maps can also be downloaded from my webpage. joined
#4
Thanks for your replies
Well then I could have been searching endless long without making it.
I think I won't make a unit/item for evey pricing. The map (BS-Crossfire) is already overloaded with masses of stuff and there are about 100 weapons which shall be priced...
I will think about the way with the formular, but i think its too mutch trouble to make it work with item combining, doubling and selling.
NEVER MAKE MORE MULTIPLE VERSIONS OF THE SAME UNIT AT DIFFERENT PRICES! Doing so will realy add loading time to maps especialy battleships. Formulars in the other hand add vitualy no loading time increase and are easy.
You have to make an array or chache system capable of retreving a int value from an item/unit type. Using that you can store the basic price and simply add a multiplyer to it appon purchase.
Heres an example of a formular you can use (note that you can not just copy / paste this since this is maths not jass)
Using a formular of price*(0.5*difficulty) you can get a decent scaling price depending on what difficulty is set to.
If difficulty was 2 it would return 40 If difficulty was 1 it would return 20 If difficulty was 1.5 it would return 30
Using this formular you can easily make item costs scale provided that you have stored a base price of all items in some method of easy retrevial.
function Formular takes price returens integer
return R2I(price*udg_difficulty)
endfunction
NOTE - This formular is different from the ones mentioned eariler for easier use and balence.
This function will do the formular for you all you need to do is give it a price of the base item / unit and set a global called difficulty to what ever multiplyer you want and then in your function run all the actions of remove money and chack money and add/remove items.