Hi, can anyone guide me along on how to change the Integer on mob HP to biginteger/long? I tried changing errors keep popping up, also the "Spawner" for monster doesn't allow more than INT values, any way to change that?
Thanks!
Hi, can anyone guide me along on how to change the Integer on mob HP to biginteger/long? I tried changing errors keep popping up, also the "Spawner" for monster doesn't allow more than INT values, any way to change that?
Thanks!
Well this is what I know
open with Notepad++ any mobID.img.xml (XML file) from YourSource\wz\Mob.wz
for example green snail 100100.img.xml
Spoiler:
now where you see thisSpoiler:
you can edit the HP , and save the file, then restart the SERVER and spawn the mob. (this modification will make that change for every one in the server.)
and about the "Spanwer" :
Spoiler:
code was taken from ThePack's mob spawner
Code:cm.spawnMonster(8500001, 20000000, 2000000, 125, 700000, 1, 0, 1, 655, -146);
Info about Spawner I took fromSpoiler:
@ByCreator, what I'm trying to do is allow the HP of any monster to exceed 2.147b which is the limit for Integer.
Just modify "private int hp" in MapleMonster to a long and then check everywhere in your source and modify it all to a long. Most sources do checks if hp >= Int.MaxValue, just write Int.MaxValue, else write the current hp. This is because for things like packets you can't write along, so you have to cast it to an integer. You can follow this method or calculate the actual real percentage of health and display that. You'll have a lot of areas to edit, and you'll also have to realize that by the XML format's "int" usage, you cannot just edit it to a very high number that exceeds the max value of an int. You can use longs for !spawns and !pmob stuff which is what I usually use it for.
What about these kinds of error? Do I make it 'mob.setHp((int) (long) remainingHp);' or mob.setHp((int) remainingHp);
If you're gonna change hp to a long or BigInteger, you'll have to do the same for every function dealing with mob HP
I'm not sure what version you're using, but considering you have a writeInt and a writeLong, I'll assume you simply modified "writeInt" to "writeLong". This is what I said you were unable to do. For functions like mob.setHp(int hp), you'll modify it to mob.setHp(long hp), so that when you pass in mob.setHp(remainingHp), it will work.
...However, when it reaches things that are required to be of integer type, like your packets for example, this is where you can either make a formula to calculate overall percentage and display that, or just write Integer.MAX_VALUE if the HP > Integer.MAX_VALUE. If it's a valid int otherwise, just cast the long to an int. You can't just modify your packet's sizes from writeInt to writeLong, you'll just crash with error 38's or have many other things go wrong if you do that. It has to match the same data type in bytes as the client is expecting to receive (in this case, 4 bytes, not 8). Something like so would be how you can do it:
Code:mplew.writeInt(remainingHp > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) remainingHp);
Thanks everyone!