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

GetUnitGoldCost() and GetUnitWoodCost()

Status
Not open for further replies.
After copying these two native functions into my map header the Wold Editor simply won't save my map with the error 'Expected end of line' on the line above the line where I placed my first native function.

Why does this happen? I've been told you nee JNGP to do this, so my next question would be what does JNGP do that allows this native to be used in my map scripts?
 
Level 17
Joined
Jul 17, 2011
Messages
1,863
you have to declare the natives first like this
JASS:
 native GetUnitGoldCost takes integer id returns integer

then you can call it.
you need to do this in jnpg.
also if you try to get gold cost as well as lumber cost for heroes the game crashes.
 
Last edited:
Level 21
Joined
Mar 27, 2012
Messages
3,232
The reason why this requires JNGP is that the function doesn't actually exist in the normal editor.
Those are actually AI functions.
you have to declare the natives first like this
JASS:
 native GetUnitGoldCost takes integer id, returns integer

then you can call it.
you need to do this in jnpg.
also if you try to get gold cost as well as lumber cost for heroes the game crashes.
This has a tiny mistake. Need to remove the comma, as there is just 1 argument.
 
So, it comes down to the editor not saving because it thinks it is an error? If that is the case then so be it, i can modify my map externally without any issues. I refuse to use JNGP, thus disallowing the use of Nestharus' wrapper. What does it mean for an upgrade by the way? I've never seen an upgrade change the cost of a unit. I also know that it won't work for heroes, in my map i only intend to use it on buildings (saves several if statements and what not)

(Thanks for the comma catch)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
So, it comes down to the editor not saving because it thinks it is an error? If that is the case then so be it, i can modify my map externally without any issues. I refuse to use JNGP, thus disallowing the use of Nestharus' wrapper. What does it mean for an upgrade by the way? I've never seen an upgrade change the cost of a unit. I also know that it won't work for heroes, in my map i only intend to use it on buildings (saves several if statements and what not)

(Thanks for the comma catch)

You cant just refuse stuff. If you dont want to use JNGP, than you cant use that native. Simple?

(also, nestharus has nothing to do with JNGP)

what he meant by an upgrade changing cost of the unit is like the orc head hunter upgrade, if the new unit costs more than the old one

to answer your original question, JNGP edits the blizzard.j which is unaccessible to normal pplz
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Arhowk, if JNGP edits blizzard.j (which i can easily do), then that means maps that use this native won't run on my war3 client? If it works with the edited blizzard.j than i'll just edit it myself?

Nestharus' unit cost function wrapper (which is very nice) uses lua and vjass right? if not than i misread the code.

You have to edit your map's blizzard.j....
 
Level 17
Joined
Jul 17, 2011
Messages
1,863
You have to edit your map's blizzard.j....

no you have to edit the war3map.j in order to enable this native if you are using a normal editor
in jnpg you can write the native in any trigger and the processor will place it in the correct line of the war3map.j
maps do not have a file called blizzard.j this file is just a list of all the natives and bjs it is just a good reference it has no practical uses unless you want to make a list of the bjs and natives
 
Status
Not open for further replies.
Top