• 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.

Making sell system ;o

Status
Not open for further replies.
Level 7
Joined
Aug 31, 2011
Messages
125
Im trying to make a sell system, i can make one very easily using the point values in object editor, then giving the player the gold, but i want to make it so it only gives you 75% of the gold given. I do not want to calculate the price to 75% (ex: 1 building cost 100g, i do not want to do 100gold-25% of a hundred, (this can be done through calculator program) just to find 75% of what the unit is worth.), i just want to do it simply in GUI, so i dont have to change 100 units point values, and calculating them x_x. It just takes too long, but if this is the only way, i don't mind i guess, i just want to know if it can be done in GUI.
+rep will be given ofc. (unless i just gave you rep :p)
 
Nestharus has a GetUnitCost system in the Jass section. :p

If that doesn't help, you could just write:
native GetUnitGoldCost takes integer unitid returns integer
native GetUnitWoodCost takes integer unitid returns integer

In the map header.

Then, in a custom script:

set udg_buildingCost = GetUnitGoldCost(GetUnitTypeId(udg_YOUR_UNIT))

Then you would use the GUI variable buildingCost.

Enjoy.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set MyUnit = (Triggering unit)
      • Custom script: set udg_buildingCost = GetUnitGoldCost(GetUnitTypeId(udg_MyUnit))
Integer variable name buildingCost
Unit Variable is YOUR_UNIT
 
Why, yes.
I think it does.

The only other ways that don't require JNGP:
- A system that sets the gold of Player 13 to 1000000, creates a builder, orders him to build in a certain position on the map, and finds the cost by subtracting the the current gold of player 13 from the 1000000.
- Caching all unit prices in a hashtable (which is terrible)
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
Why, yes.
I think it does.

The only other ways that don't require JNGP:
- A system that sets the gold of Player 13 to 1000000, creates a builder, orders him to build in a certain position on the map, and finds the cost by subtracting the the current gold of player 13 from the 1000000.
- Caching all unit prices in a hashtable (which is terrible)

Is there a way to get item cost?
 
Status
Not open for further replies.
Top