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

[JASS] Is there a way to SetUnitGold?

Status
Not open for further replies.
Level 7
Joined
May 9, 2005
Messages
133
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?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
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.
 
Level 13
Joined
Aug 31, 2005
Messages
823
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.
 
Level 7
Joined
May 9, 2005
Messages
133
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.

Thanks for your help.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
LOL fomulars too much work LOL.

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)

price = 40
difficulty = 3
cost = price*(0.5*difficulty)
cost = 40*(0.5*3)
cost = 40*1.5
cost = 60

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.

JASS:
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.

I hope this infomation can help you.
 
Status
Not open for further replies.
Top