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

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 33
Joined
Mar 27, 2008
Messages
8,035
Yes, you're going to need JNGP for that native function.
As to why, I don't know the answer to it.

I've been told that native function doesn't catch on upgrades (units, etc), you should use Nestharus', he has this feature.
 
Level 17
Joined
Jul 17, 2011
Messages
1,864
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,864
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