Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
In this case, I want to either mute the level_up sound—just once, or work out a better method that doesn't play the sound when a script improves the PC's skills.
It's not the only time this has come up... There are several internal sounds and other settings that I'd like to change on occasion, but I just don't know how to access them.
It's not the only time this has come up... There are several internal sounds and other settings that I'd like to change on occasion, but I just don't know how to access them.
Re: Ask a simple question, get a simple answer
Hey guys,
i´m working on a room with burnt out torches the Player has to light up first.
Here is the Code i am using to light a torch up. Works just fine on inserting a torch to the torch holder.
I was wondering if i could make this more general, since i have a few more torches and i don´t really want every torch to hook up to an extra script.
Something like this.......only a Version of it that works. This may be pretty Basic stuff but i couldn´t find it anywhere else.
function torcheffekt(torch_holder)
torch_holder.particle:enable()
torch_holder.sound:enable()
torch_holder.light:enable()
end
i´m working on a room with burnt out torches the Player has to light up first.
Here is the Code i am using to light a torch up. Works just fine on inserting a torch to the torch holder.
Code: Select all
function torcheffekt()
torch1.particle:enable()
torch1.sound:enable()
torch1.light:enable()
end
Something like this.......only a Version of it that works. This may be pretty Basic stuff but i couldn´t find it anywhere else.
function torcheffekt(torch_holder)
torch_holder.particle:enable()
torch_holder.sound:enable()
torch_holder.light:enable()
end
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
Yep.....moving on!
Re: Ask a simple question, get a simple answer
Also why is this not working?
Code: Select all
spawn("mummy2",partylevel,4,22,0,partylevel).monster.onDie(hudPrint("Test"))
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
Yep.....moving on!
Re: Ask a simple question, get a simple answer
It is not "partylevel" but "party.level"
Re: Ask a simple question, get a simple answer
It's more than just party.level. The onDie() function isn't called like that, and when it is called, it is given (automatically) the monster's table for use in the hook, and it has an optional return value that matters. (returning false cancels the death)Xardas wrote:Also why is this not working?Code: Select all
spawn("mummy2",partylevel,4,22,0,partylevel).monster.onDie(hudPrint("Test"))
Try this:
Code: Select all
spawn("mummy2",party.level,4,22,0).monster:addConnector("onDie", self.go.id, "onDeathAction")
function onDeathAction(self)
hudPrint(tostring(self.go.name.." #"..self.go.id.." just died on level "..self.go.level.." at location "..self.go.x..","..self.go.y))
end
-- tostring() ensures it's a string, hudPrint() chokes on anything else
Re: Ask a simple question, get a simple answer
Hey Zardas!Xardas wrote: I was wondering if i could make this more general, since i have a few more torches and i don´t really want every torch to hook up to an extra script.
Something like this.......only a Version of it that works. This may be pretty Basic stuff but i couldn´t find it anywhere else.
function torcheffekt(torch_holder)
torch_holder.particle:enable()
torch_holder.sound:enable()
torch_holder.light:enable()
end
Try this function (place in a scriptEntity called 'toggleAtorchScript')
the function args tParticle, tSound, tLight require a boolean each
>> true will enable the component, false will disable it
SpoilerShow
Code: Select all
function toggleAtorch(tHolderID, tParticle, tSound, tLight)
if not tHolderID then
return
end
local componentTab = {}
componentTab = {particle = tParticle, sound = tSound, light = tLight}
for comp, action in pairs(componentTab) do
--print(comp, action)
local thing = findEntity(tHolderID):getComponent(comp)
if action == true then
thing:enable()
else
thing:disable()
end
end
end
Code: Select all
toggleAtorchScript.script.toggleAtorch("torch_holder_1", false, false, true)
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: Ask a simple question, get a simple answer
Thanks for the answers guys. I made a few spawn commands with partylevel instead of party.level and they seem to be working just fine as well.
....
Anyways if you say it´s wrong that way it´s probably better for me to change it.

Anyways if you say it´s wrong that way it´s probably better for me to change it.
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
Yep.....moving on!
Re: Ask a simple question, get a simple answer
Oh there is one more Thing....
Where can i read more about the function Parameters and their names?
Where can i read more about the function Parameters and their names?
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
Yep.....moving on!
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Hey guys,
How does the disableSelf() on Buttons work?
I have a button (disableSelf(true)) hooked up to a script, which spawns mummies. Tought it would make the button trigger only once, but it doesn´t seem to be working this way.
After that i tried it this way:
This should remove the Buttons Connectors. I can´t find the mistake in this one.
Can anyone help me?
How does the disableSelf() on Buttons work?
I have a button (disableSelf(true)) hooked up to a script, which spawns mummies. Tought it would make the button trigger only once, but it doesn´t seem to be working this way.
After that i tried it this way:
Code: Select all
function RemoveTombbuttonConnector
for i = 1, tombbutton.button:getConnectorCount() do
tombbutton.button:removeConnector(tombbutton.button:getConnector(i))
end
end
end

In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
Yep.....moving on!