Page 2 of 2

Re: Mari0 Modding Help Thread

Posted: 04 Nov 2013, 00:10
by Turtle95
HugoBDesigner wrote:
Mari0Maker wrote:How can I make music loop from a certain point? For example, a song has a intro. This way, the song can loop properly.
A good example of this would be Mario Kart Wii.
Make 2 sound sources:

Code: Select all

introsound = love.audio.newSource("[sound].ogg")
loopsound = love.audio.newSource("[sound 2].ogg")
introplaying = false
(introplaying is to check when the looping sound should be playing)

When you wanna play it:

Code: Select all

love.audio.play(introsound)
introplaying = true
and later, to check when intro music is finished (put it in love.update):

Code: Select all

if introsound:isStopped() and introplaying then
    introplaying = false
    loopsound:setLooping(true)
    love.audio.play(loopsound)
end
This should work, but if it doesn't, then try putting the loopsound:setLooping(true) under the love.audio.play(loopsound).

To stop the looping music just put a love.audio.stop(loopsound) where you want it to stop :)
While Hugo is correct, there is another way:

Unless the sound only happens more than once (love.update, love.draw, loops, etc), you could do:

Code: Select all

love.audio.play(introsound)
which is only going to happen once, then do

Code: Select all

if introsound:isStopped() then
  --Well, what now? Play the damn song!
  loopsound:setLooping(true)
  love.audio.play(loopsound)
end
Then on the next gamestate, call love.audio.stop(loopsound)

Re: Mari0 Modding Help Thread

Posted: 06 Nov 2013, 00:41
by Mari0Maker
How am I supposed to do that with, for example, the overworld theme?
Also, if I have a song that plays when you pause the game, how can I make the song stop when I press "Resume"?

Re: Mari0 Modding Help Thread

Posted: 23 Nov 2013, 15:50
by Vyper
How can you change how fast the timer ticks down?

Re: Mari0 Modding Help Thread

Posted: 23 Nov 2013, 16:38
by alesan99
Vyper wrote:How can you change how fast the timer ticks down?
Game.lua line 197

Code: Select all

			mariotime = mariotime - 2.5*dt
			
			if mariotime > 0 and mariotime + 2.5*dt >= 99 and mariotime < 99 then
				love.audio.stop()
				playsound(lowtime)
			end
			
			if mariotime > 0 and mariotime + 2.5*dt >= 99-7.5 and mariotime < 99-7.5 then
All you have to do is change 2.5 to whatever speed you want. The bigger the number the faster.

Re: Mari0 Modding Help Thread

Posted: 12 Dec 2013, 18:47
by HugoBDesigner
Old post:
I have a problem trying to get a value from an object.
In my mod (Mari0 +Portal if you don't know, but you probably do), i'm trying to make a loading system for Triggers where they'll load what objects triggers them. It works like this:

"player+box.id=2&box.gelid=1+goomba+gel.id=3"

It's detected like this: all entities that can activate the Trigger are separated by "+", but some entities (like "box" and "gel", in this example) have specified values to allow triggers to activate. It means that boxes will only activate the Trigger if they have the id "2" and the gel id "1".

The problem is: I made it to check in objects variables if each parameter is true. The "." represents the objects ".", so "box.id" will check the objects["box"][n].id. But, to do this, I need to use _G (which would convert the string into a variable). But I just can't do it. I tried everything, but it just doesn't works!

The code, if you guys need it:

Code: Select all

if check3 then
								local args = params[2]:split("=")
								local value = args[2]
								if args[2] == "true" then
									value = true
								elseif args[2] == "false" then
									value = false
								elseif tonumber(args[2]) then
									value = tonumber(args[2])
								end
								
								if v._G[args[1]] == value then
									--Nothing, 'can' is already true
									print("passed = YES")
								else
									can = false
									print("passed = NO")
								end
							end
Where v is the object itself (for j, v in pairs(objects[obj])), args are the two parts of the parameter (for "box.id=2", args would be {"id", "2"}) and params are the parameters divided (for "box.id=2", params would be {"box", "id=2"}).

Thanks for the help (if you help me) :)

EDIT: Nevermind. I realized that all I needed to do was this:

Code: Select all

if check3 then
								local args = params[2]:split("=")
								local value = args[2]
								if args[2] == "true" then
									value = true
								elseif args[2] == "false" then
									value = false
								elseif tonumber(args[2]) then
									value = tonumber(args[2])
								end
								
								for m, n in pairs(v) do
									if tostring(m) == args[1] then
										if v.m == value then
											--Nothing, 'can' is already true
											print("passed = YES")
										else
											can = false
											print("passed = NO")
										end
									end
								end
							end
Anyway, thanks!

Re: Mari0 Modding Help Thread

Posted: 18 Dec 2013, 07:35
by TripleXero
I've been trying to get the set keys for a controller to work through menus in Mari0 for a while now, and I've gotten the buttons to work, but I've been trying so many things to gets the directional pad or sticks to work but cannot figure them out at all. Can I get some help?

Re: Mari0 Modding Help Thread

Posted: 06 May 2014, 16:50
by OrbitalBlueprint
Silly question: Where can the code for the tile properties be found?

Re: Mari0 Modding Help Thread

Posted: 06 May 2014, 16:54
by HugoBDesigner
In quad.lua. What they do must be edited in game.lua, at random places...

Re: Mari0 Modding Help Thread

Posted: 13 Aug 2015, 00:43
by Jurassican
How do you add custom music in Mari0?

Re: Mari0 Modding Help Thread

Posted: 13 Aug 2015, 01:02
by Jurassican
How do you add Minecraft block skins in mari0?

Re: Mari0 Modding Help Thread

Posted: 13 Aug 2015, 01:13
by Technochips

Re: Mari0 Modding Help Thread

Posted: 13 Aug 2015, 03:23
by Squidish
Julien12150 wrote:this
That's only for se. 1.6 has different tile properties and music.

Re: Mari0 Modding Help Thread

Posted: 13 Aug 2015, 03:46
by zorua7551
He didn't define which Mari0 version though.