Quantcast
Channel: Super Mario Bros. X Forums
Viewing all articles
Browse latest Browse all 2964

LunaLua • Re: [Library] Stats.lua - A basic RPG mechanics script

$
0
0
Spoiler: show
Alright. I did another Question though, which would be how I combine that with LightHitPoint.Lua. I always found that nice, but
didn't want to include, since it's kinda 'unfair' to only allow the Enemies to have HP Bars.

Also I would like the Player to heal, when consuming specific Powerups. I saw the Heal Function, but I'm unsure how to use it.
Sorry for the late reply (since I can't get SMBX2 working on any of my devices right now for some reason; probably a Wine update broke it), but I'm actually using LightHitPoint in my project as well. You can just assign the LightHitPoint values normally, and doing. However, I am changing the amount of damage the player can do every frame since it's the only way I could think of getting damage output to scale with the player's level before I implemented onLevelUp:
--HARM TYPES
local function onDraw()
lhp.setHarmtypeDamage(HARM_TYPE_JUMP, stat.level * 0.75) -- When Mario jumps on an enemy
lhp.setHarmtypeDamage(HARM_TYPE_FROMBELOW, stat.level * 3) -- When Mario hits a block, damaging enemies on it.
lhp.setHarmtypeDamage(HARM_TYPE_TAIL, stat.level * 1.5) -- When Mario uses a Tanooki spin.
lhp.setHarmtypeDamage(HARM_TYPE_SPINJUMP, stat.level * 1) -- When Mario spin jumps.
lhp.setHarmtypeDamage(HARM_TYPE_SWORD, stat.level * 0.75) -- When Link stabs someone.

--NPC HARM DAMAGE

lhp.setNPCDamage(13, stat.level * 1.25) --Fireballs
lhp.setNPCDamage(171, stat.level * 3) --Player Hammers
end


This is the exact code I'm using for the damage values in my episode. Feel free to change those values if you want.

A plan for later versions is to add integration with LightHitPoint so that you can assign everything in a single line, as well as finding some use for the currently unused defence stat.

I haven't been able to test it yet due to the aforementioned issues with accessing SMBX2, but this script should heal you by 5 HP whenever you grab an SMB3 Super Mushroom. Feel free to repurpose it for other items.

Code:

function onNPCKill(t,k,h) -- t = Event Token, k = Killed NPC, h = Harm Type    if h == HARM_TYPE_VANISH and k.id == 9        stats.heal(5)    endend
So I'm trying to add this to an episode im working on, and for my episode, I use the Zelda Heart item to act as a healing item. the issue is that whenever the heart is collected, it goes into the reserve box, letting it be infinitely reused to restore health! Is there any way I can only let it go into reserve if your at full health?

Statistics: Posted by Paka_Mzuri — Sun Jan 26, 2025 4:04 am



Viewing all articles
Browse latest Browse all 2964

Trending Articles