Page 256 of 391

Re: Ask a simple question, get a simple answer

Posted: Tue Sep 25, 2018 2:53 am
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

Re: Ask a simple question, get a simple answer

Posted: Tue Sep 25, 2018 9:34 am
by THOM
minmay explains here (among others) what to know about minimalsavestate.

Re: Ask a simple question, get a simple answer

Posted: Tue Sep 25, 2018 11:24 am
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.

Re: Ask a simple question, get a simple answer

Posted: Wed Sep 26, 2018 11:32 am
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.

Re: Ask a simple question, get a simple answer

Posted: Thu Sep 27, 2018 11:37 am
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?

Re: Ask a simple question, get a simple answer

Posted: Thu Sep 27, 2018 1:20 pm
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.

Re: Ask a simple question, get a simple answer

Posted: Thu Sep 27, 2018 6:19 pm
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,
},

Re: Ask a simple question, get a simple answer

Posted: Thu Sep 27, 2018 9:40 pm
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? :)

Re: Ask a simple question, get a simple answer

Posted: Thu Sep 27, 2018 9:55 pm
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?

Re: Ask a simple question, get a simple answer

Posted: Thu Sep 27, 2018 10:13 pm
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.