common.j custom natives?

Laiev

Hey Listen!!
Reaction score
188
nothing to do, so I just open my newgen folder and start to play with the files and read what is in...

I find a thing and got a question....

these natives works? :confused:

JASS:
//custom natives
//
native xGetUnitDefenseType	takes unit u returns integer
native xGetDefenseType		takes integer i returns integer
native xGetUnitAttackType1	takes unit u returns integer
native xGetAttackType1		takes integer i returns integer
native xGetUnitAttackType2	takes unit u returns integer
native xGetAttackType2		takes integer i returns integer
native xGetUnitWeaponType1	takes unit u returns integer
native xGetWeaponType1		takes integer i returns integer
native xGetUnitWeaponType2	takes unit u returns integer
native xGetWeaponType2		takes integer i returns integer
native DumpUnitInfo		takes unit u returns nothing

native ArrayAlloc	takes integer size returns integer
native ArraySetI	takes integer obj, integer i, integer v returns integer
native ArrayGetI	takes integer obj, integer i returns integer
native ArrayFree	takes integer obj returns nothing

//STL deque
native DequeNew		takes nothing returns integer
native DequePushFrontI	takes integer obj, integer v returns integer
native DequePushBackI	takes integer obj, integer v returns integer
native DequeFrontI	takes integer obj returns integer
native DequeBackI	takes integer obj returns integer
native DequePopFrontI	takes integer obj returns integer
native DequePopBackI	takes integer obj returns integer
native DequeFree	takes integer obj returns nothing

////STL map
native MapNew		takes nothing returns integer
native MapSetII		takes integer obj, integer key, integer value returns integer
native MapGetII		takes integer obj, integer key returns integer
native MapSetSI		takes integer obj, string key, integer value returns integer
native MapGetSI		takes integer obj, string key returns integer
native MapFree		takes integer obj returns nothing

//lisp style lists
native consII		takes integer car, integer cdr returns integer
native carI		takes integer pair returns integer
native cdrI		takes integer pair returns integer
native destroypair	takes integer pair returns nothing

//Measure wall clock elapsed time
native StopWatchCreate	takes nothing returns integer
native StopWatchMark	takes integer obj returns real
native StopWatchDestroy	takes integer obj returns nothing

//fast "return bug" functions that aren't bugged
native ItoR		takes integer i returns real
native RtoI		takes real r returns integer

//Look at source to see what these compute
native Encrypt		takes integer x, integer y, integer z returns nothing
native Decrypt		takes integer x, integer y, integer z returns nothing

native DebugPrint	takes string msg returns nothing


EDIT: a better quest is.. what is japi? lol

EDITEDIT: about the natives, i get the answer but about japi, still don't know
 

Komaqtion

You can change this now in User CP.
Reaction score
469
I would believe they work, with Newgen at least, as these ones are used to make benchmarks ;)

JASS:
native StopWatchCreate	takes nothing returns integer
native StopWatchMark	takes integer obj returns real
native StopWatchDestroy	takes integer obj returns nothing


Try them out :D
 

Laiev

Hey Listen!!
Reaction score
188
i try the test map but don't compile and get lotsssss and lots of error (of hashtable)
:(
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Hmm... :S
You know you need to "declare" them right ? :S

Just put all of them somewhere inside your code like this:
JASS:
//custom natives
//
native xGetUnitDefenseType	takes unit u returns integer
native xGetDefenseType		takes integer i returns integer
native xGetUnitAttackType1	takes unit u returns integer
native xGetAttackType1		takes integer i returns integer
native xGetUnitAttackType2	takes unit u returns integer
native xGetAttackType2		takes integer i returns integer
native xGetUnitWeaponType1	takes unit u returns integer
native xGetWeaponType1		takes integer i returns integer
native xGetUnitWeaponType2	takes unit u returns integer
native xGetWeaponType2		takes integer i returns integer
native DumpUnitInfo		takes unit u returns nothing

native ArrayAlloc	takes integer size returns integer
native ArraySetI	takes integer obj, integer i, integer v returns integer
native ArrayGetI	takes integer obj, integer i returns integer
native ArrayFree	takes integer obj returns nothing

//STL deque
native DequeNew		takes nothing returns integer
native DequePushFrontI	takes integer obj, integer v returns integer
native DequePushBackI	takes integer obj, integer v returns integer
native DequeFrontI	takes integer obj returns integer
native DequeBackI	takes integer obj returns integer
native DequePopFrontI	takes integer obj returns integer
native DequePopBackI	takes integer obj returns integer
native DequeFree	takes integer obj returns nothing

////STL map
native MapNew		takes nothing returns integer
native MapSetII		takes integer obj, integer key, integer value returns integer
native MapGetII		takes integer obj, integer key returns integer
native MapSetSI		takes integer obj, string key, integer value returns integer
native MapGetSI		takes integer obj, string key returns integer
native MapFree		takes integer obj returns nothing

//lisp style lists
native consII		takes integer car, integer cdr returns integer
native carI		takes integer pair returns integer
native cdrI		takes integer pair returns integer
native destroypair	takes integer pair returns nothing

//Measure wall clock elapsed time
native StopWatchCreate	takes nothing returns integer
native StopWatchMark	takes integer obj returns real
native StopWatchDestroy	takes integer obj returns nothing

//fast "return bug" functions that aren't bugged
native ItoR		takes integer i returns real
native RtoI		takes real r returns integer

//Look at source to see what these compute
native Encrypt		takes integer x, integer y, integer z returns nothing
native Decrypt		takes integer x, integer y, integer z returns nothing

native DebugPrint	takes string msg returns nothing

        native DebugS               takes string str                            returns nothing
        native DebugFI              takes string str, integer val               returns nothing
        native DebugUnitID          takes string str, integer val               returns nothing
        native DisplayText          takes integer p, string str                 returns nothing
        native DisplayTextI         takes integer p, string str, integer val    returns nothing
        native DisplayTextII        takes integer p, string str, integer v1, integer v2 returns nothing
        native DisplayTextIII       takes integer p, string str, integer v1, integer v2, integer v3 returns nothing
        native DoAiScriptDebug      takes nothing                               returns boolean

        native GetAiPlayer          takes nothing                               returns integer
        native GetHeroId            takes nothing                               returns integer
        native GetHeroLevelAI       takes nothing                               returns integer

        native GetUnitCount         takes integer unitid                        returns integer
        native GetPlayerUnitTypeCount takes player p, integer unitid            returns integer
        native GetUnitCountDone     takes integer unitid                        returns integer
        native GetTownUnitCount     takes integer id, integer tn, boolean dn    returns integer
        native GetUnitGoldCost      takes integer unitid                        returns integer
        native GetUnitWoodCost      takes integer unitid                        returns integer
        native GetUnitBuildTime     takes integer unitid                        returns integer

        native GetMinesOwned        takes nothing                               returns integer
        native GetGoldOwned         takes nothing                               returns integer
        native TownWithMine         takes nothing                               returns integer
        native TownHasMine          takes integer townid                        returns boolean
        native TownHasHall          takes integer townid                        returns boolean

        native GetUpgradeLevel      takes integer id                            returns integer
        native GetUpgradeGoldCost   takes integer id                            returns integer
        native GetUpgradeWoodCost   takes integer id                            returns integer
        native GetNextExpansion     takes nothing                               returns integer
        native GetMegaTarget        takes nothing                               returns unit
        native GetBuilding          takes player p                              returns unit
        native GetEnemyPower        takes nothing                               returns integer
        native SetAllianceTarget    takes unit id                               returns nothing
        native GetAllianceTarget    takes nothing                               returns unit

        native SetProduce           takes integer qty, integer id, integer town returns boolean
        native Unsummon             takes unit unitid                           returns nothing
        native SetExpansion         takes unit peon, integer id                 returns boolean
        native SetUpgrade           takes integer id                            returns boolean
        native SetHeroLevels        takes code func                             returns nothing
        native SetNewHeroes         takes boolean state                         returns nothing
        native PurchaseZeppelin     takes nothing                               returns nothing

        native MergeUnits           takes integer qty, integer a, integer b, integer make returns boolean
        native ConvertUnits         takes integer qty, integer id               returns boolean

        native SetCampaignAI        takes nothing                               returns nothing
        native SetMeleeAI           takes nothing                               returns nothing
        native SetTargetHeroes      takes boolean state                         returns nothing
        native SetPeonsRepair       takes boolean state                         returns nothing
        native SetRandomPaths       takes boolean state                         returns nothing
        native SetDefendPlayer      takes boolean state                         returns nothing
        native SetHeroesFlee        takes boolean state                         returns nothing
        native SetHeroesBuyItems    takes boolean state                         returns nothing
        native SetWatchMegaTargets  takes boolean state                         returns nothing
        native SetIgnoreInjured     takes boolean state                         returns nothing
        native SetHeroesTakeItems   takes boolean state                         returns nothing
        native SetUnitsFlee         takes boolean state                         returns nothing
        native SetGroupsFlee        takes boolean state                         returns nothing
        native SetSlowChopping      takes boolean state                         returns nothing
        native SetCaptainChanges    takes boolean allow                         returns nothing
        native SetSmartArtillery    takes boolean state                         returns nothing
        native SetReplacementCount  takes integer qty                           returns nothing
        native GroupTimedLife       takes boolean allow                         returns nothing
        native RemoveInjuries       takes nothing                               returns nothing
        native RemoveSiege          takes nothing                               returns nothing

        native InitAssault          takes nothing                               returns nothing
        native AddAssault           takes integer qty, integer id               returns boolean
        native AddDefenders         takes integer qty, integer id               returns boolean

        native GetCreepCamp         takes integer min, integer max, boolean flyers_ok returns unit

        native StartGetEnemyBase    takes nothing                               returns nothing
        native WaitGetEnemyBase     takes nothing                               returns boolean
        native GetEnemyBase         takes nothing                               returns unit
        native GetExpansionFoe      takes nothing                               returns unit
        native GetEnemyExpansion    takes nothing                               returns unit
        native GetExpansionX        takes nothing                               returns integer
        native GetExpansionY        takes nothing                               returns integer
        native SetStagePoint        takes real x, real y                        returns nothing
        native AttackMoveKill       takes unit target                           returns nothing
        native AttackMoveXY         takes integer x, integer y                  returns nothing
        native LoadZepWave          takes integer x, integer y                  returns nothing
        native SuicidePlayer        takes player id, boolean check_full         returns boolean
        native SuicidePlayerUnits   takes player id, boolean check_full         returns boolean
        native CaptainInCombat      takes boolean attack_captain                returns boolean
        native IsTowered            takes unit target                           returns boolean

        native ClearHarvestAI       takes nothing                               returns nothing
        native HarvestGold          takes integer town, integer peons           returns nothing
        native HarvestWood          takes integer town, integer peons           returns nothing
        native GetExpansionPeon     takes nothing                               returns unit

        native StopGathering        takes nothing                               returns nothing
        native AddGuardPost         takes integer id, real x, real y            returns nothing
        native FillGuardPosts       takes nothing                               returns nothing
        native ReturnGuardPosts     takes nothing                               returns nothing
        native CreateCaptains       takes nothing                               returns nothing
        native SetCaptainHome       takes integer which, real x, real y         returns nothing
        native ResetCaptainLocs     takes nothing                               returns nothing
        native ShiftTownSpot        takes real x, real y                        returns nothing
        native TeleportCaptain      takes real x, real y                        returns nothing
        native ClearCaptainTargets  takes nothing                               returns nothing
        native CaptainAttack        takes real x, real y                        returns nothing
        native CaptainVsUnits       takes player id                             returns nothing
        native CaptainVsPlayer      takes player id                             returns nothing
        native CaptainGoHome        takes nothing                               returns nothing
        native CaptainIsHome        takes nothing                               returns boolean
        native CaptainIsFull        takes nothing                               returns boolean
        native CaptainIsEmpty       takes nothing                               returns boolean
        native CaptainGroupSize     takes nothing                               returns integer
        native CaptainReadiness     takes nothing                               returns integer
        native CaptainRetreating    takes nothing                               returns boolean
        native CaptainReadinessHP   takes nothing                               returns integer
        native CaptainReadinessMa   takes nothing                               returns integer
        native CaptainAtGoal        takes nothing                               returns boolean
        native CreepsOnMap          takes nothing                               returns boolean
        native SuicideUnit          takes integer count, integer unitid         returns nothing
        native SuicideUnitEx        takes integer ct, integer uid, integer pid  returns nothing
        native StartThread          takes code func                             returns nothing
        native Sleep                takes real seconds                          returns nothing
        native UnitAlive            takes unit id                               returns boolean
        native UnitInvis            takes unit id                               returns boolean
        native IgnoredUnits         takes integer unitid                        returns integer
        native TownThreatened       takes nothing                               returns boolean
        native DisablePathing       takes nothing                               returns nothing
        native SetAmphibious        takes nothing                               returns nothing

        native CommandsWaiting      takes nothing                               returns integer
        native GetLastCommand       takes nothing                               returns integer
        native GetLastData          takes nothing                               returns integer
        native PopLastCommand       takes nothing                               returns nothing
        native MeleeDifficulty      takes nothing                               returns integer


That's all inside a single trigger ;)
You also need to start Newgen WC3 to be able to use them...

Here's a small thing I just made to test it :D
JASS:
scope NativesTest initializer Init

    globals
        private group ENUM = CreateGroup()
    endglobals
    
    private function EnumActions takes nothing returns boolean
        local unit u = GetFilterUnit()
        
        call DebugPrint( &quot;Hellu ! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />&quot; )
        
        call BJDebugMsg( &quot;Name: &quot; + GetUnitName( u ) )
        call BJDebugMsg( &quot;Defense type: &quot; + I2S( xGetUnitDefenseType( u ) ) )
        call BJDebugMsg( &quot;Attack type: &quot; + I2S( xGetUnitAttackType1( u ) ) )
    
        return false
    endfunction

    private function Actions takes nothing returns boolean
        local player p = Player( 0 )
        
        call GroupEnumUnitsOfPlayer( ENUM, p, Filter( function EnumActions ) )
        
        set p = null
        
        return false
    endfunction
    
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        
        call TriggerRegisterTimerEvent( t, 1., false )
        
        call TriggerAddCondition( t, Condition( function Actions ) )
    endfunction
    
endscope


Just add two different units to a map, put that in and test using Newgen WC# (I can't get it to run :( But maybe you can :S XD
 

Laiev

Hey Listen!!
Reaction score
188
this use a custom common.j imported to the map ;x

this is the reason for the uncompiled things ><
 

Komaqtion

You can change this now in User CP.
Reaction score
469
I haven't imported a custom common.j file...

And I used to be able to use stuff like these :D
 

the Immortal

I know, I know...
Reaction score
51
They require modded war3.exe and am pretty sure they are part of some RTC plugin. Still, you can't use them for normal (multiplayer) maps before everyone playing mods their game.
Which is... fail :/
 

Komaqtion

You can change this now in User CP.
Reaction score
469
No it's not RtC in this case, though there are custom made natives which require it...

This only requires Newgen WE, and Newgen Warcraft to use :D
 

cleeezzz

The Undead Ranger.
Reaction score
268
AFAIK, only some work, such as UnitAlive

and i think you know that too :D

and this is common.ai
 

tooltiperror

Super Moderator
Reaction score
231
The only real benefit to these natives is debugging and keybenchmarking. (I know it's benchmarking, but I typed that in, and it's so sick I think I'll coin it.)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top