Ask a simple question, get a simple answer

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Hmm...

So I figured out that mostly it's the custom assets where I used setWorldPosition that have minimal save state issues are set to true and I just have to set all these objects to false. Let's hope this won't become a clusterfuck :D
User avatar
THOM
Posts: 1267
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

minmay explains here (among others) what to know about minimalsavestate.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I should be okay, I can change the custom assets in false.
Just time consuming, that's all.

When I start up log2 now I get the following console message:

warning! [string "ModSystem.lua"]:0: File not found: mod/assets/dungeon_manifest.bin

Everything still works, but this message comes up now every single time I start up Log2 after I failed to export my mod and ran out of memory because I didn't lower graphics first.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Pompidom wrote: Tue Sep 25, 2018 11:24 am I should be okay, I can change the custom assets in false.
Just time consuming, that's all.

When I start up log2 now I get the following console message:

warning! [string "ModSystem.lua"]:0: File not found: mod/assets/dungeon_manifest.bin

Everything still works, but this message comes up now every single time I start up Log2 after I failed to export my mod and ran out of memory because I didn't lower graphics first.
Probably a side effect from the 4 gb patch. Reinstall fixes it.
furiousuk
Posts: 6
Joined: Wed Mar 09, 2016 12:18 am

Re: Ask a simple question, get a simple answer

Post by furiousuk »

Can't seem to find the answer to this one:
How do you place a torch holder with a custom torch?

I have a custom torch defined, I have a custom torch holder defined, but how can I muck with the TorchHolderComponent such that it spawns 'my_torch' rather than the standard torch in the holder?

I did try a bit of hack to disable the `hasTorch` checkbox in the editor and manually spawn `my_torch` in via the component i.e.

Code: Select all

{
  class = "Socket",
  offset = vec(0.05, 1.53, -0.25),
  rotation = vec(-2, -24, -90),
  onAcceptItem = function(self, item)
    return self:count() == 0 and not not item:hasTrait('sconce_torch')
  end,
  onInit = function(self, item)
    self:addItem(spawn('my_torch').item)
  end,
},
However, doing this places `my_torch` in the holder just fine, but, it also places a regular torch in there :( Or, at least, it gives me a regular torch when I click on it, then `my_torch` is also in there (and can be picked out).

How do I get just the custom torch in there?

I have a slightly different question too, doesn't sound so simple, any clean way of making different coloured torches such that the light emitted in hand or in holder reflects the different types of torches?
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I can't answer your specific questions,

But I will tell you my practical solution how I would do it as a complete noob.

Just place your torchholder with your custom torch in it.
on the same spot, place a 2nd torch holder with everything disabled. model/light/has torch etc... included
(let's assume that the worldPosition of the torchholder = (34.5,0,75,0) as example

Now place a "no sound invisible button" in front of it with world Position 34.5,0,74.8,0

Attach a script to the invisible button that:
1. places/spawns your custom torch in your hands.
2. disables model and lightning etc.. from torchholder one
3. enable model of the empty torchholder 2

So basically as soon you attempt to click on the torchholder, you will basically press the button that spawns your custom torch in your hands, disables the entire torch holder + torch + light, enables an empty torchholder
You now have your custom torch in your hands and the torch holder appears empty.
User avatar
Zo Kath Ra
Posts: 932
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

furiousuk wrote: Thu Sep 27, 2018 11:37 am However, doing this places `my_torch` in the holder just fine, but, it also places a regular torch in there :( Or, at least, it gives me a regular torch when I click on it, then `my_torch` is also in there (and can be picked out).
I can't tell you why, but it works if you place the onInit function in the TorchHolderController component:
(hasTorch must be unchecked, or there will also be a regular torch in the holder)

Code: Select all

{
    class = "TorchHolderController",
    name = "controller",
    onInit = function(self, item)
        self.go.socket:addItem(spawn("my_torch").item)
    end,
},
edit:
Again I don't know why, but this spawns a unlit (not burnt-out) torch:
(hasTorch can be checked or unchecked, in both cases only the unlit my_torch will be in the holder)

Code: Select all

{
    class = "Socket",
    offset = vec(0.05, 1.53, -0.25),
    rotation = vec(0, -20, -90),
    onAcceptItem = function(self, item)
        return (item.go.name == "my_torch" or item.go.name == "my_torch_everburning") and self:count() == 0
    end,
    --debugDraw = true,
    onInit = function(self, item)
        self:addItem(spawn("my_torch").item)
        self.go.controller:setHasTorch(false)
    end,
},
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I need some help with a script.

What I have so far is a battle where you are running away from a vampire, as soon you have opened all the curtains a counter disables his brain and thus he stands still.

What I need now that after this happened a second later a fire effect spawns on the current position the vampire is standing
and then dies after a couple of seconds.

Can anyone help me script this? :)
User avatar
THOM
Posts: 1267
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

In the script that disables his brain use delayedCall() to trigger another function after a few seconds.

In this function you can spawn whatever you want, kill your monster etc.

You know how the syntax of delayedCall() works?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

not really, but it should be easy to figure out looking at other editor files,

what I need the most help with is a scriptline that:

findEntity vampire_7 and then spawn a fire effect on the random location where his brain got disabled.
Post Reply