Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
What is it that you would want it to do?
Reading the script that you have, it would appear that each lava_effects object would spawn, and assign itself a random timer interval. When the timer activates, it would spawn the effects, and assign itself a new random timer interval.
It would continually repeat the above, and it would run the init hook every time the player reloaded. Have you tried it yet, and what doesn't work?
*Technically the init hook isn't needed (if the timers are all active), but what it does is randomize all of the effect timers when the player reloads.
What you could use it for, is to randomly disable or enable the timers at load, and this could change each time the game is reloaded.
________________________________________________________________________________
That gives me a wonderful idea... Use an onInit hook to shuffle the solutions, and behavior of puzzle & traps at each reload—if they have not yet been interacted with.
I was going to do this with the ORRR2 slider puzzle, but learned that potentially half of the possible shuffles are physically impossible to solve... so I had to leave it fixed in a known good position.
Reading the script that you have, it would appear that each lava_effects object would spawn, and assign itself a random timer interval. When the timer activates, it would spawn the effects, and assign itself a new random timer interval.
It would continually repeat the above, and it would run the init hook every time the player reloaded. Have you tried it yet, and what doesn't work?
*Technically the init hook isn't needed (if the timers are all active), but what it does is randomize all of the effect timers when the player reloads.
What you could use it for, is to randomly disable or enable the timers at load, and this could change each time the game is reloaded.
________________________________________________________________________________
That gives me a wonderful idea... Use an onInit hook to shuffle the solutions, and behavior of puzzle & traps at each reload—if they have not yet been interacted with.
I was going to do this with the ORRR2 slider puzzle, but learned that potentially half of the possible shuffles are physically impossible to solve... so I had to leave it fixed in a known good position.
Re: Ask a simple question, get a simple answer
Yes it works great, I only want to optimize that for the saving time.
I wanted to have this object with minimal save, to reduce numbers of objets that are saved. There is something like 50-70 objetcs like that placed on a level.
But as Minmay said, I undertand that every time the mod will be loaded it will spawn the under tile damage, that mean with 50 reload, there will be 50* more objects added, if I understand it correctly.
Anyway, I will do that in an other way, I will directly put the object, then place a new object wich do the huge tile damage, under the first object. With minimalsavestate on all of these objects.
The timer component will be removed.
This object is from lava stuff, I guess its from Andakrainor, I'm not sure now, this is a little old.
Well anyway, this do a small damage on the surface or defaut heigth of the object, and spawn another tiledamage directly under the first, so when the player walk in that, he fall and come in a huge tiledamage who kills him (under_lava_effects), like he was falling in lava. I guess the small tile damage is not really needed when the goal is to kill the player when he falls into lava, but I use it under magic bridges to simulate small damage of fire.
In the same time it can spawn some kind of eruption, randomly, depending on how many object are placed in the level. (the eruption is part is spawned with the timer component)
I wanted to have this object with minimal save, to reduce numbers of objets that are saved. There is something like 50-70 objetcs like that placed on a level.
But as Minmay said, I undertand that every time the mod will be loaded it will spawn the under tile damage, that mean with 50 reload, there will be 50* more objects added, if I understand it correctly.
Anyway, I will do that in an other way, I will directly put the object, then place a new object wich do the huge tile damage, under the first object. With minimalsavestate on all of these objects.
The timer component will be removed.
This object is from lava stuff, I guess its from Andakrainor, I'm not sure now, this is a little old.
Well anyway, this do a small damage on the surface or defaut heigth of the object, and spawn another tiledamage directly under the first, so when the player walk in that, he fall and come in a huge tiledamage who kills him (under_lava_effects), like he was falling in lava. I guess the small tile damage is not really needed when the goal is to kill the player when he falls into lava, but I use it under magic bridges to simulate small damage of fire.
In the same time it can spawn some kind of eruption, randomly, depending on how many object are placed in the level. (the eruption is part is spawned with the timer component)
Re: Ask a simple question, get a simple answer
I am trying to simulate a cave-in effect to lock a player in a certain area. I have used a floor trigger and a couple of spawners (one for each level transition so the player can see it from both sides should they loop back around) to spawn in the mine_cave_in asset. This works fine but could do with some effects to accompany it.
First of all sound: I have created the following script:
~~~
function westforestrubble()
playSound("magma_golem_footstep")
end
~~~
This plays the sound of rubble falling into place quite nicely. However the sound is played without any regard for direction or distance.
I noticed in this video about the first Grimrock that you can play the sound from a specific point:
https://www.youtube.com/watch?v=nufMQSHgjmk
Obviously in Grimrock 2 its not as simple as definining the level and coordinates, so I took a stab in the dark and tried this:
~~~
function westforestrubble()
playSound("magma_golem_footstep", -1, -4, 0, 28, 2)
end
~~~
You can probably see what I was going for, the coordinates of the level in relation to all the other levels and then the coordinates within the level itself. Nothing changes, it still plays with omnipresence. How do I achieve what is done in this video but in Grimrock 2 please?
Also I cannot figure out camera shake. I tried as shown in part 2 of that video: https://www.youtube.com/watch?v=cpPYo4XHUhQ
~~~
party:shakeCamera(0.5,0.5)
~~~
I just get the "is a nill value" error. I looked at the scripting reference and tried:
PartyComponent:shakeCamera(…, number)
I wasn't sure what to put in parentheses, I tried 0.5,0.5 but again, same error.
Finally, is there a way to emit smoke particles in this game? I feel like they would obfuscate the rubble pinging into existence if the player happens to be looking at it.
So in short:
1) How can I play a sound from a specific point on the map?
2) How to I make the camera shake to simulate a tremor?
3) Can I spawn/emit particles (i.e. smoke) in this game?
First of all sound: I have created the following script:
~~~
function westforestrubble()
playSound("magma_golem_footstep")
end
~~~
This plays the sound of rubble falling into place quite nicely. However the sound is played without any regard for direction or distance.
I noticed in this video about the first Grimrock that you can play the sound from a specific point:
https://www.youtube.com/watch?v=nufMQSHgjmk
Obviously in Grimrock 2 its not as simple as definining the level and coordinates, so I took a stab in the dark and tried this:
~~~
function westforestrubble()
playSound("magma_golem_footstep", -1, -4, 0, 28, 2)
end
~~~
You can probably see what I was going for, the coordinates of the level in relation to all the other levels and then the coordinates within the level itself. Nothing changes, it still plays with omnipresence. How do I achieve what is done in this video but in Grimrock 2 please?
Also I cannot figure out camera shake. I tried as shown in part 2 of that video: https://www.youtube.com/watch?v=cpPYo4XHUhQ
~~~
party:shakeCamera(0.5,0.5)
~~~
I just get the "is a nill value" error. I looked at the scripting reference and tried:
PartyComponent:shakeCamera(…, number)
I wasn't sure what to put in parentheses, I tried 0.5,0.5 but again, same error.
Finally, is there a way to emit smoke particles in this game? I feel like they would obfuscate the rubble pinging into existence if the player happens to be looking at it.
So in short:
1) How can I play a sound from a specific point on the map?
2) How to I make the camera shake to simulate a tremor?
3) Can I spawn/emit particles (i.e. smoke) in this game?
Re: Ask a simple question, get a simple answer
You have found the scripting reference? At the beginning there are some global commands listed.
1. Regarding your sound you are looking for
2. Your command for shaking the camera is missing one "party":
It's (almost) always: objectID.component:command()
3. You can spawn particleobjects. So if you have one specific particlesystem in mind, which should be spawned, you have to find or to create an object with this particlesystem first and spawn it where you want it to have.
1. Regarding your sound you are looking for
Code: Select all
playSoundAt(sound, level, x, y)
2. Your command for shaking the camera is missing one "party":
Code: Select all
party.party:shakeCamera(0.5,0.5)
3. You can spawn particleobjects. So if you have one specific particlesystem in mind, which should be spawned, you have to find or to create an object with this particlesystem first and spawn it where you want it to have.
Re: Ask a simple question, get a simple answer
Thanks ever so much, I did immediately realise that the level list is still ordered numerically. As for missing the global commands, this is why you don't ctrl+f and hope to skim read your way to the answer! Thanks ever so much for your help, that has resolved everything I was looking for. Just need to see if there's anything in-game that I can use as a suitable particle effect, been a while since I actually played through the game so nothing springs to mind.
Re: Ask a simple question, get a simple answer
There is a second (more up-to-date) scripting reference for LoG2: https://github.com/JKos/log2doc/wiki
LoG2 has a major change from LoG1 scripting, is that objects are no longer each a separate/dedicated class. They all now contain component classes, and can have various functionality built into them using these component features.
The reason the camerashake function (above) needs that [extra] .party to work, is that it is a function of the party object's own party component.
LoG2 has a major change from LoG1 scripting, is that objects are no longer each a separate/dedicated class. They all now contain component classes, and can have various functionality built into them using these component features.
The reason the camerashake function (above) needs that [extra] .party to work, is that it is a function of the party object's own party component.
Re: Ask a simple question, get a simple answer
Thank you, I will properly study the scripting for this game - I don't have any programming background so right now I'm constructing the world, trialing out ideas that require some light scripting here and there and then when I do another pass through the whole game I'll be working on the scripting for the more complex ideas I have. These resources will definitely come in handy for then
For something completely unrelated, does anybody have any idea what the asset is called in the linked image? I want a sort of portcullis that closes from below and these fit the bill if memory serves correctly. Problem is, I cannot seem to find it in the editor. Doesn't come under the door category and I've tried under gates, portcullis, grating - anything I think it could be.
https://imgur.com/oD4WmPS
For something completely unrelated, does anybody have any idea what the asset is called in the linked image? I want a sort of portcullis that closes from below and these fit the bill if memory serves correctly. Problem is, I cannot seem to find it in the editor. Doesn't come under the door category and I've tried under gates, portcullis, grating - anything I think it could be.
https://imgur.com/oD4WmPS
- Zo Kath Ra
- Posts: 937
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Ask a simple question, get a simple answer
mine_door_spearoldboy87 wrote: ↑Mon May 13, 2019 5:42 pm For something completely unrelated, does anybody have any idea what the asset is called in the linked image? I want a sort of portcullis that closes from below and these fit the bill if memory serves correctly. Problem is, I cannot seem to find it in the editor. Doesn't come under the door category and I've tried under gates, portcullis, grating - anything I think it could be.
https://imgur.com/oD4WmPS
Re: Ask a simple question, get a simple answer
How would you go about activating a particle effect with animation event? I have the 2 events that take place set up already and I have the 2 particle effects. I just need to know how to start them once the event takes place. I know there is playSound ("sound_name"). Is there a similar set up for particles? like playParticle ("particle_name")?
I will have to have both particle effects with in the object definition with a unique name right?
I will have to have both particle effects with in the object definition with a unique name right?
Re: Ask a simple question, get a simple answer
it's
Code: Select all
myObjectID.myparticle:restart()