-
Notifications
You must be signed in to change notification settings - Fork 2.2k
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
script problem #10006
Comments
you didn't reset the variable when the event is called |
Dawg please just help me out and fix it up for me. it seems like you know what to fix lmao, im new to coding |
don't ask people to do it for you |
ok fine but wdym when you said i didnt reset the variable |
Set it to 0 |
the timer?? |
no, the variable |
which variable? idk which ur talking abt |
There is only one variable in the script |
what is it bro |
I think the variable is `spacePresses' |
it is 0? |
Idk if this made it into 1 but 'spacePresses = spacePresses + 1;' |
i think they mean the 1st setProperty() in the onTimerCompleted() function |
what do i do |
change the last function to this and see if it works: function onTimerCompleted(tag, loops, loopsLeft) |
i gain health when i dont press space, why? |
the first two times it works but on the third try it does that |
try removing one of the timers then this: function onTimerCompleted(tag, loops, loopsLeft) |
still does it |
may I see the current script? |
spacePresses = 0; function onCreate() function onUpdate(elapsed) function onEvent(name, value1, value2) function onTimerCompleted(tag, loops, loopsLeft) |
honestly idk whats wrong |
|
HOW do i reset it? do i move the variable under on event? |
|
then theres no point to the event? |
No, as the event is now it has no point because you can mash space at the start of the song and completely ignore the event |
its already 0....? |
Are you just ignoring this line |
yeah because if i change it to 0 the event wont do anything |
i just fixed it |
nvm it still doesnt work |
I didn't tell you to change it 💀 that line is the reason you need to reset the value |
dawg, then how do i reset it, ive been on this shi for days what do i change bruv |
I've already told you twice |
spacePresses = spacePresses + 0; ???? |
That's adding 0, it does nothing |
its not spacePresses = spacePresses + 1; or spacePresses = 0; so what is it |
HeY tHaT’s My cOdE |
yea thanks |
Try this. |
doesnt work spacePresses = 0; function onUpdate(elapsed) function onEvent(name, value1, value2) function onTimerCompleted(tag, loops, loopsLeft) |
plz help me |
Describe your problem here.
made an event where u gotta spam space or else you die, but the script like breaks when it does it for the third time, like for the first time i dont spam space i take damage, second time i do spam it i take no damage, then when i dont spam again i gain health and dont die?
heres my code:
`spacePresses = 0;
function onCreate()
spacePresses = 0;
precacheImage('spacebar');
precacheSound('DODGE');
precacheSound('Dodged');
end
function onUpdate(elapsed)
if keyJustPressed('space') then
spacePresses = spacePresses + 1;
end
end
function onEvent(name, value1, value2)
if name == "DodgeEvent" then
cameraFlash('other', 'ff0000', 0.5, false)
runTimer('Mashh', 4.5);
runTimer('NOMashes', 4.5);
makeAnimatedLuaSprite('spacebar', 'spacebar', 420, 200);
luaSpriteAddAnimationByPrefix('spacebar', 'spacebar', 'spacebar', 25, true);
luaSpritePlayAnimation('spacebar', 'spacebar');
setObjectCamera('spacebar', 'other');
scaleLuaSprite('spacebar', 0.70, 0.70);
addLuaSprite('spacebar', true);
makeLuaText('mashhhhh', 'MASH SPACE!!', 1300, 10, 450)
setTextColor('mashhhhh', '990000')
setTextSize('mashhhhh', 56)
setObjectCamera('mashhhhh', 'camOther')
addLuaText('mashhhhh')
cameraShake('hud', 0.01, 4.5)
cameraShake('game', 0.01, 4.5)
cameraShake('other',0.01, 4.5)
playSound('DODGE');
end
end
function onTimerCompleted(tag, loops, loopsLeft)
if tag == 'NOMashes' and spacePresses < 10 then
removeLuaSprite('spacebar');
removeLuaText('mashhhhh');
setProperty('health', 100);
elseif tag == 'Mashh' and spacePresses > 10 then
removeLuaSprite('spacebar');
removeLuaText('mashhhhh');
setProperty('health', 100);
end
end
`
Are you modding a build from source or with Lua?
Lua
What is your build target?
Windows x64
Did you edit anything in this build? If so, mention or summarize your changes.
No response
The text was updated successfully, but these errors were encountered: