Skip to content
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

help me with lua script pls :'( #11235

Closed
Noel3454565FNF opened this issue Nov 14, 2022 · 30 comments
Closed

help me with lua script pls :'( #11235

Noel3454565FNF opened this issue Nov 14, 2022 · 30 comments
Labels
help wanted Extra attention is needed

Comments

@Noel3454565FNF
Copy link

Describe your problem here.

heya,
i want make a custome note if he press that change to the next background,
and a custom note if he press that change to the previous background,

but i don't know how do it,
i look for on any website and that not helpful.

if you know how pls respond me or DM me on discord Noel345 is back ))))#4280

thanks for who read this and for you're futur help :D

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

@Noel3454565FNF Noel3454565FNF added the help wanted Extra attention is needed label Nov 14, 2022
@bruh1cat
Copy link

You can't change bgs but, you can change the images that are being used to create the bg to another set of images which make a bg. Hope this helped bc I cannot make a script since I'm not home.

@Noel3454565FNF
Copy link
Author

you mean i can create a assets of bg (like for character) and create an event to change it?

@bruh1cat
Copy link

bruh1cat commented Nov 14, 2022

you mean i can create a assets of bg (like for character) and create an event to change it?

Yes, and be sure to use function onCreate() to precache things and removeLuaSprite('tag', false) false makes it be added back later

@Noel3454565FNF
Copy link
Author

i think i understand but i just start LUA so i think im not understand

@bruh1cat
Copy link

i think i understand but i just start LUA so i think im not understand

Do you alr have the stage.lua?

@Noel3454565FNF
Copy link
Author

Noel3454565FNF commented Nov 15, 2022 via email

@Noel3454565FNF
Copy link
Author

Noel3454565FNF commented Nov 15, 2022 via email

@Noel3454565FNF
Copy link
Author

its possible to do like:
if note1 press: then add 1 to value.

if note2 press: then add -1 to value.

@DisIsNOt
Copy link

local Stage = 0
function goodNoteHit()
if noteType == 'something' then
Stage = Stage + 1
end

if noteType == 'another' then
Stage = Stage - 1
end
end

@Noel3454565FNF
Copy link
Author

local Stage = 0 function goodNoteHit() if noteType == 'something' then Stage = Stage + 1 end

if noteType == 'another' thenStage = Stage - 1endend end

thanks :D,
i put it on a stage.lua or create a custom note?
(sorry im starting on LUA)

@DisIsNOt
Copy link

DisIsNOt commented Nov 15, 2022

You can put it on the ummm custom_events folder

I mean make a new .lua file and paste that in and put it in custom_events folder

@Noel3454565FNF
Copy link
Author

yeah i understand but if its an event this be active unicaly for 1moment and nit for all the song?

@Noel3454565FNF
Copy link
Author

day = 0

function onCreate()
makeLuaSprite('bg1', 'image1', screenWidth, screenHeight)--makes the image appear in the middle of the screen
makeLuaSprite('bg2', 'image2', screenWidth, screenHeight)--makes the image appear in the middle of the screen
makeLuaSprite('bg3', 'image3', screenWidth, screenHeight)--makes the image appear in the middle of the screen
makeLuaSprite('bg4', 'image4', screenWidth, screenHeight)--makes the image appear in the middle of the screen
setObjectCamera('tag', 'camGame')--can be changed to camHUD, or camOther, game makes it be below everything. Hud makes it be at the same camera the healthbar and notes are. Other makes it above everything.
end

function goodNoteHit(id, direction, noteType, isSustainNote)
if noteType == 'GREEN-Tycoon'
then addProperty(getProperty('day') + 1);
day = day + 1;
elseif noteType == 'RED-Tycoon'
then addProperty(getProperty('day') - 1);
day = day - 1;
end
end

any error for you? (for me its not working)

@DisIsNOt
Copy link

DisIsNOt commented Nov 16, 2022

Well my computer is on repair so I can't really test that code myself so yeah.

And addProperty() doesn't exists ectually
day is already a global variable so you don't need to get it's property

can you tell me what exactly you're making again? Like a stage changer or something like that?

@Noel3454565FNF
Copy link
Author

i try doing like:
if you press a custom note, this show the next background,
if you press another custom note, this show the previous background,

i have 10 backgrounds at all

@DisIsNOt
Copy link

DisIsNOt commented Nov 16, 2022

You can do like

if the day equals to 0 then
it adds the current background

And if the day equals to 1 then
remove the previous background and adds another background

Idk if you understand this crappy explanation

@Noel3454565FNF
Copy link
Author

Noel3454565FNF commented Nov 16, 2022 via email

@Noel3454565FNF
Copy link
Author

Noel3454565FNF commented Nov 16, 2022 via email

@TheKitBoi
Copy link

then keep counting and add the numbers to each BG

@Noel3454565FNF
Copy link
Author

like that?

local Stage = 0

function onCreate()
makeLuaSprite('Stage', 'temp1', screenWidth, screenHeight)--makes the image appear in the middle of the screen
makeLuaSprite('Stage1', 'temp2', screenWidth, screenHeight)--makes the image appear in the middle of the screen
makeLuaSprite('Stage2', 'temp3', screenWidth, screenHeight)--makes the image appear in the middle of the screen
makeLuaSprite('Stage3', 'temp4', screenWidth, screenHeight)--makes the image appear in the middle of the screen
setObjectCamera('tag', 'camGame')--can be changed to camHUD, or camOther, game makes it be below everything. Hud makes it be at the same camera the healthbar and notes are. Other makes it above everything.
end

function goodNoteHit()
if noteType == 'taco note' then
Stage = Stage + 1
end

if noteType == 'error_taco note' then
Stage = Stage - 1
end

-- Event notes hooks
function onEvent(name, value1, value2)
end
-- event note triggered
-- triggerEvent() does not call this function!!

end -- print('Event triggered: ', stage-check, value1, value2);

@Noel3454565FNF
Copy link
Author

okay so i test the script, i don't have error but the bg not show, i think the game can't take the PNG of bg.
i put it on mods/images but for no reason its not working

@Noel3454565FNF
Copy link
Author

(i do something wrong?)

@bruh1cat
Copy link

(i do something wrong?)

I can't help rn but when I can I'll try to fix it

@Noel3454565FNF
Copy link
Author

okay thanks :D,
just a question, i have to create a stage.json for all the custom bg?

@bruh1cat
Copy link

okay thanks :D,

just a question, i have to create a stage.json for all the custom bg?

No just one bc like I said there really isn't a way to change stages with its .json file ur just changing the images.

@Noel3454565FNF
Copy link
Author

okay

@Noel3454565FNF
Copy link
Author

i try debug the script and if you have a idee of where is the error just told me pls

@Noel3454565FNF
Copy link
Author

Noel3454565FNF commented Nov 16, 2022

okay i try debug it myself but can't find why bg not show

@DisIsNOt
Copy link

DisIsNOt commented Nov 17, 2022

`
day = 0
function onCreate()
--bg1
makeLuaSprite ('something', 'he', 300,400)

--bg2
makeLuaSprite ('somethingpart2', 'hee', 400, 300)

end

function onUpdate()
if day == 0 then
addLuaSprite('something')
removeLuaSprite ('something2)
end

  if day == 1 then
      addLuaSprite ('something2')
       removeLuaSprite('something')
  end

end
`

Here's and example or something

@Noel3454565FNF
Copy link
Author

Noel3454565FNF commented Nov 17, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants