(Request)script or code for x numbers of star coins to trigger event.

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

icez
Spike
Spike
Posts: 263
Joined: Fri Dec 20, 2013 7:21 pm

(Request)script or code for x numbers of star coins to trigger event.

Postby icez » Tue Jan 12, 2021 1:52 pm

Looking for a script or code for an amount of star coins to trigger an event like player collected x amount of star coins will trigger example event such as show star after collecting x amount of star coins in said level, anyone able to help with this?, I am still learning the basics of lunalua code.

Animebryan
Spike
Spike
Posts: 262
Joined: Fri Jun 03, 2016 5:40 pm
Flair: Need help!
Contact:

Re: (Request)script or code for x numbers of star coins to trigger event.

Postby Animebryan » Wed Jan 13, 2021 1:07 am

Put this in a luna.lua file for each level you want the effect in:

Code: Select all

local starcoin = require("npcs/ai/starcoin")
local collected = false

function onTick()
    if starcoin.getLevelCollected(Level.filename()) >= starcoin.count() and not collected then
        triggerEvent("Event Name")
        collected = true
    end
end
It triggers the event when ALL of the Star Coins for that level are collected.

icez
Spike
Spike
Posts: 263
Joined: Fri Dec 20, 2013 7:21 pm

Re: (Request)script or code for x numbers of star coins to trigger event.

Postby icez » Wed Jan 13, 2021 8:53 am

thanks this will help immensely.


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 3 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari