Wiki
Clone wikiNuclearThroneTogether / Scripting / Mods / weapon.gml
Nuclear Throne Together allows you to define additional custom weapons.
This is done by creating a yourweaponname.weapon.gml
file in game's main or appdata directory and loading it via /loadwep yourweaponname
.
The file can #define
the following scripts to be called by the game:
init
Executed when mod is loaded. Load resources here.
step
Executed by the player object when they are carrying the mod-weapon. argument0 will indicate whether the weapon is in primary slot.
weapon_name
Should return the weapon' name.
weapon_type
Should return the weapon' type (0..5).
weapon_auto
If defined, should return whether the weapon is automatic (true/false).
weapon_load
Should return the weapon' cooldown between shots, in frames.
weapon_cost
Should return the weapon' ammo cost per shot.
weapon_sprt
Should return the weapon' sprite.
Use sprite_add_weapon(base64, xorig, yorig)
to auto-generate the "shine" from a single-frame sprite.
weapon_loadout
Can return the large weapon' sprite for use in loadout.
weapon_area
Should return the difficulty level at which the weapon should drop (-1 if it should not occur automatically).
You can add logic here to make weapons only drop on specific conditions
weapon_swap
Should return the weapon' swap sound.
weapon_melee
If defined, should return whether the weapon is melee (does "swings")
weapon_gold
If defined, should return whether the weapon is golden and should occur in Mansion.
weapon_laser_sight
If defined, should return whether the weapon has a laser sight or not. Enabled by default for bolt weapons and disabled for other types.
weapon_fire
Is called when the weapon is fired.
Should create projectile(s), do sounds, and call weapon_post(wkick, cameraShift, cameraShake)
to shake/offset camera and weapon graphic accordingly.
Updated