Alive weapons. Unearth new allies! Customizable shooting NPCs.

Moderators: Semi-moderatos, Moderators, SMBX2

hacheipe399 M
Topic author, Honourable citizen
Honourable citizen
hacheipe399 M
Topic author, Honourable citizen
Honourable citizen
Age: 22
Reputation: 14
Posts: 45
Joined: 24 Feb 2014

Post #1by hacheipe399 » 27 Aug 2018, 1:07

Hi Everyone! This is my API and I want to share it with you, guys!

First of all a little story: Do you remember your first time playing "The Suck" in The Invasion 2? Did you get amazed by the fact that you can use Hammer Bros as weapons? "Why aren't other enemies usable?" you asked to yourself. Well, I came here to solve that matter.

The API aliveweapons.lua aims to make most projectile-thrower NPCs into real guns for fighting into levels! They do in the same way as hammer bros do! Just bury an enemy, unearth it and voila! The version 2 of the API is released with these improvements:

New! You can customize the shooting behavior of the NPCs covered by this API! with the brand new function overhaulWeapon(). With this you can change projectile, firing rate and bullet speed! Look at the documentarion for a detailed explanation.
New! You can make your own weapon! That's right! makeCustomWeapon() lets you make any NPC throw any object, at the frequency, speed and position you want! If you get tired of it, then use resetCustomWeapon() to revert changes. With this tool you can make something like a SMB2-styled Veggie thrower!
New! 2-player mode support! Now you can be a menace 2 society with your friend! Be careful, don't kill your partner!
New! Complete overwrite of the API from scratch. Now it's more optimized and less glitchy.

Here is a video!

phpBB [youtube]

Original link:

This time I did a complete rewrite of the API. The video uses the version 2! Now NPCs have animations when throw projectiles! In the video isn't shown, but the biggest enemies as Wart, SMB1 and SMB3 Bowser make the player do a heavy stomp in the ground when the player carries them. Be careful when jumping! If you don't like it, you can turn it off in your code.

GIF Demos
Even statues can be used as guns!
SMB1 Bowser is OP as f$kk
Ludwig von Koopa does a funny jumping animation when player jumps.

To make this API usable, paste my two files into your level's folder, make a lunadll.lua and write this line:

Code: Select all

local aliveweapons = API.load("aliveweapons")

Also I included functions to activate/deactivate certain/all NPCs shooting behavior. These are:

Code: Select all

aliveweapons.enableWeapon("npcname") --DON'T FORGET THE QUOTATION MARKS

Just copy these functions into your onStart() event and write the name of the NPC into the brackets. Simple as that. They can be used within onLoadSection#() event too, so you can activate/deactivate behaviors as your player progresses in the level.
Important: enableWeapon() isn't needed if you didn't use any disableWeapon() before. Every NPC behavior is enabled by default. You can see the legal strings and the brand new customizing functions such as overhaulWeapon(), stompEffectActivated() and makeCustomWeapon() in the Documentation text included in the compressed file.


  • Mouser added! Be careful as the bombs don't explode instantly!
  • Weapon customization added!
  • Custom weapon creation!
  • 2 player support!
  • Player stomp effect when carrying big NPCs like Wart!
  • Fixed player hurting with its own weapon.
  • Fixed projectiles killing coins and powerups.

If you have any suggestion or issue to report, tell me in this thread.

-Requires pnpc, colliders and expandedDefines.


Initial release (outdated - kept just to compare)
I listen to energic music:
All kinds of metal.
Electronic music: Hard House, Hardstyle, Hardcore, Frenchcore, Terrorcore and anything that with ends in -core.
Best track of 2018: Cryogenic - Mot3rf$ck3r (wear earprotection when listenting to this).

I hope to be a major contributor of PGE when I'm more advanced in my engineering.

Return to “LunaLua scripting”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest