(Request)script or code for x numbers of star coins to trigger event.
Posted: Tue Jan 12, 2021 1:52 pm
by icez
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.
Re: (Request)script or code for x numbers of star coins to trigger event.
Posted: Wed Jan 13, 2021 1:07 am
by Animebryan
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.
Re: (Request)script or code for x numbers of star coins to trigger event.
Posted: Wed Jan 13, 2021 8:53 am
by icez
thanks this will help immensely.