-
Notifications
You must be signed in to change notification settings - Fork 0
Creating a Weapon
This page is a WIP, it's not complete
For the model:
There is no model, that's right, you've been fooled all this time, it's just a bunch of sprites stacked on top of each other!
For example, if you open oChunksArm, you will see that there's only around 10 sprites inside it.

But if you stack and tilt them, you will see that it looks vaguely similar to how it looks ingame

The game loads the sprites and turn them into cubes, then stack them on top of each other, they're not loaded as an actual 3D model, but get turned into one in-game!
Thankfully, you won't need to know much about what I just told you, I just thought it would be cool to explain it, with MagicaVoxel, Vox2Png and my Script, it will do all of the model import job for you!
Save your MagicaVoxel model project on the same folder as Vox2Png

Once saved, you have to keep in mind these numbers up there, as we're gonna use them!

Then open a terminal/command prompt inside vox2png folder and run ./vox2png input.vox output.png
Assuming you installed my Scripts, open Scripts > Dead Estate Scripts > Weapon Scripts > PNGtoWeaponSprites.csx and select your output.png file.

On the first window opened, set it to the numbers I told you to keep in mind.
After that give you have to insert a Name for the Custom Weapon's Sprite and Game Object, consecutively, and voi-la!! Half-way done.

- (Optional) The
Parentbox is the base weapon for your custom weapon, by default it usesgun, which is a generic handgun with no special attributes. If for example, you want to use aswordas base, search forswordand drag & drop it into theParentbox of your custom weapon. - You will most likely want to create atleast
PreCreateandCreateCodes for your weapon:
After that implement the Codes to your Game Object by drag-and-dropping:
- Open code
gml_GlobalScript_scrWeaponsand add your weapon to the list, check this page to understand how to usecreateWeapon, and unless you want to replace an existing weapon, make your custom weapon use 150 or more on valuenumber(1st argument).
I highly suggest you to copy-and-paste code from other weapons and THEN edit it.
The easiest way I could find to test a Weapon so far, is to simply change Jules' default weapon with all curses disabled.
Open Code gml_Object_jules_PreCreate_0, and add defaultGun = <your weapon object name here>; at the end of the code.

This is how my model looks in-game by the way!

A: On your weapon's PreCreate code, add offsetFromPlayer = <number here>;, this will allow you to make the weapon stay closer/farther from your character.