Page 282 of 396

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 17, 2019 10:40 am
by THOM
Yes:

Code: Select all

delayedCall(entity, time, function, arg1, arg2, ...)
For example you can put the following line in a script:

Code: Select all

delayedCall(self.go.id, 0.3, "turnParty2") 
In this case this line in your function would call the function "turnParty2" after 0.3 seconds, while "turnParty2" must be in the same script entity (in this case).

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 17, 2019 10:41 am
by Zo Kath Ra
shayologo wrote: Sun Feb 17, 2019 9:41 am It's existe a time delay function?
Oui, ça existe :)
http://www.grimrock.net/modding/scripting-reference/
delayedCall(receiver, delay, msg)

So if you have a script entity named script_entity_1
that contains a function named test(a, b)

delayedCall("script_entity_1", 5, "test", 123, 456)
calls the function after 5 seconds with the parameters 123 and 456

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 17, 2019 10:44 am
by Zo Kath Ra
shayologo wrote: Sat Feb 16, 2019 10:06 pm because it's don't existe any tutorial of moddig and object are very hard to find in editor
There's the modding section of the LoG website:
http://www.grimrock.net/modding/

And Skuggasveinn's editor tutorials:
viewtopic.php?f=22&t=7055

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 17, 2019 1:49 pm
by shayologo
scripting make me some trouble

I follow the Official tutoriel

So i try this

Code: Select all

actif = beach_lever_1:getLeverState()
and that crash "Attempt to call method 'getLeverState' (a nil value)"

I understand beach_lever_1 is nil, but why? it's my Object ID. i tried to directly but Hexa name 0x5287fc0

Code: Select all

 actif = 0x5287fc0:getLeverState()
But it's crash always

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 17, 2019 7:51 pm
by Isaac
shayologo wrote: Sun Feb 17, 2019 1:49 pm So i try this

Code: Select all

actif = beach_lever_1:getLeverState()
...
But it's crash always
The scripting model has changed in Grimrock 2 from how it was in Grimrock [1]. That will always crash, because the methods are moved to an object's component in Grimrock 2.

So in order to work as you intend, it must (in this case) be called like this:
(...and the variable actif should probably be local; if it is within a function in the script_entity.)

Code: Select all

local actif = beach_lever_1.lever:isActivated()
...or like this:

Code: Select all

local actif = beach_lever_1.lever:isDeactivated()
Where actif will be assigned a value of true or false.

Here is a more up-to-date list of the components, and their methods.
https://github.com/JKos/log2doc/wiki/Components

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 21, 2019 11:18 am
by kelly1111
What is the simpelest and efficiënt way to set this up?

What I want is the following. The party hears a bell sound/ or siren. the party has an x amount of time to retreat to a safehaven. If the party is not in the savehaven area by then, in the area's that are not the safehaven black mist will appear that damages the party over time. This will happen sometimes when the party is out exploring and the party has to wait it out in a safehaven.

The savehaven area can be expanded upon by places torches in tochholders that dispel the black mist


This is the short version.

---My question is, how would I do this efficiently without placing spawn objects in all the hallway, corridors that spawn the black mist (poison cloud spell) ?
---Can a spawn object spawn a poison cloud that is active on more than one tile? I mean script it to be a bigger area?
---I think I could use a torchholder, that when a torch is placed deactivates the spawner(s) that are near it ?
--- Is there a way to modify the fog particle to make it appear black / or that it has faces in it? I am looking for a horror type of look... any ideas?

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 21, 2019 3:23 pm
by Pompidom
The bigger question would be.. Why?
This may sound cool. But in reality it will be extremely boring having to backtrack to a safe area, press R a couple of times and then continue your journey.
Monsters that are not poison immune will die by the poison. There are so many "if" and "what if" situations.

Why don't you consider other more practical solutions, like entire sections cut off by the black mist. You can move around in black mist areas getting poisoned just a few squares to place a torch in a torchholder. invisible blockers keep you from advancing into the specific area with a warning that the black mist is too strong there to advance.
This way you don't have to spawn the black mist everywhere and only on a few squares just for looks.
and the torches are some kind of currency that can be placed into torchholders to clear a big area or even an entire map.

This way you only have to place a simple poison mist script hooked to a timer with invisible floor trigger when you enter the map and disable the script when you leave the map.
As soon you place a torch in a torchholder, the script is stopped and the floor triggers disabled.
The blockers are removed and you can explore the section of the map as soon the last poison cloud has dissipated.

Use the bell sound as a cool animation/cutscene/scripted event when you're already in a safehaven, black mist is activated everywhere around the safehaven gradually spreading comming out of floor grates and wall gratings or something like that. Invisible blockers are activated to keep the party trapped in the safehaven. And you have to do some kind of puzzle to get to the torches that have to be placed strategically to open up the way again.

This is how I would do it.

Scripted events where you have something to do is much more enjoyable to the player than some random obnoxious backtrack mechanic that's completely negated by pressing R.

As for ideas to replace the default looking poison cloud, I would look more into the direction of the graveyard fog or something alike. And I have some demon face that moves towards you in a fog square as a scare effect, but i can't remember what it's called. Or from which asset pack it came from. I think it's from Thom, but I'm not sure.

Also check out the effect of a single swamp_dungeon_fog object on your map and see if you can combine the object with a "fade in" script or if you can make it into a custom object with different colors.

https://youtu.be/jf-UjwmTKWc

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 21, 2019 7:50 pm
by Isaac
Pompidom wrote: Thu Feb 21, 2019 3:23 pm The bigger question would be.. Why?
This may sound cool. But in reality it will be extremely boring having to backtrack to a safe area, press R a couple of times and then continue your journey.
This is effectively the same as a fire puzzle, where the flames (or lava) rise up, and the party wants to avoid burns; also the same as a large spike trap floor, where you have a little time before the entire floor becomes a sharp skewering hazard... This is the equivalent done with poison gas.

I have done this one before, and the way I would suggest, is to use a timer to call the warning bell, and with a delayedCall to call the trap effect (built using a loop with a table of the affected tiles; and with a condition to skip a tile if it has an active torch on it.)

_______________

@Pompidom I think your idea to use the swamp fog is a neat one, but I cannot think of a clean way to carve out a fresh air space within it. Aside from that it would work VERY well to simply enable or disable it anytime the level needed to be covered in fumes.

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 21, 2019 8:44 pm
by Pompidom
Isaac wrote: Thu Feb 21, 2019 7:50 pm @Pompidom I think your idea to use the swamp fog is a neat one, but I cannot think of a clean way to carve out a fresh air space within it. Aside from that it would work VERY well to simply enable or disable it anytime the level needed to be covered in fumes.
Forest_pit_fog can be a solution. It's a square specific object and you can rotate it with worldrotation angles making the fog fall down on you from the sky, make it come out of walls and wall gratings or simply let it move upwards from the ground and floor gratings.
You can even place them more randomly with setworldposition as well.
And I bet you can do something nice with "fade In" and "fade Out" scripts.

https://youtu.be/u76M5VbVP68

Place invisible walls or blockers and make the "black mist" act as walls, or place invisible poison clouds fired in intervals with a script if you allow the party to walk through it.
Lots of options. If i come with a better idea, I will let you know, because your idea of the bell and the "black mist" makes me want to do something similar in my mod. creating fire in certain places so that the party can create a safe path through the toxic fumes.

As for the faces in the fog, I believe journey to justice asset pack has it. death skull particle or something like that.

Re: Ask a simple question, get a simple answer

Posted: Sat Feb 23, 2019 1:39 pm
by Pompidom
Ok, when my mod is done I will be adding custom music/ambient tracks.

I have no experience however yet adding custom music.

https://ibb.co/NTz0qt2

As you can see in this screenshot, this is a map filled with the interiors of different houses. Some are cozy little houses with friendly npc's, other houses are a slaughterfest with occult stuff and scripted events/puzzles/battles.

Is there a way to add different ambient custom music for each interior (3x5 squares)
or am i stuck with 1 global ambient music track on the entire map?

Right now the interiors are placed exactly at the same spot where the exteriors are on the outside map.
so it would be nice to keep the same layout to not lose track.

if the music track is only possible global on the map I will have to resort to making multiple maps. Placing the "creepy" interiors on 1 map and the "cozy" interiors on another.

So I would like to know what my options are so i can start mapping properly so it will be compatible with the custom music tracks I plan to add.

Or can I simply play/enable custom ambient tracks with invisible floor triggers upon entering the interiors?