• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Numbering system / base used for object ids

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

What base or numbering system does Warcraft 3 use for numbering/ordering object ids (in particular custom made object ids)?

For example I notice that 'B001' is considered less than 'B000' and likewise 'B005' is apparently less than 'B003.' So how are these ordered?
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
They order them by increasing the last value.

This 'B001' is not less than this 'B000'

But you have to watch when doing something with the order as JNGP can use any unused 4 digit ASCII value as the new Raw Data values.

Alright so if I set an object to 'B001', should not the id for a newly generated object immediately after that be 'B002' ? And I'm guessing it goes 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ?

So something like base-36?
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
the formula is veeery simple:

Take ascii value of all 4 chars, ascii1, ascii2, ascii3, ascii4

Result = (((((ascii1 * 256) + ascii2) * 256) + ascii3) * 256) + ascii4

and yes it uses base 256, so it goes through whole ascii list

note: if you use JNGP, never put /* or */ into rawcodes, because JNGP doesnt like 'a/*b'
 
Status
Not open for further replies.
Top