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

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