Page 268 of 391

Re: Ask a simple question, get a simple answer

Posted: Mon Nov 12, 2018 6:31 pm
by Pompidom

Code: Select all

defineObject{
	name = "ud_roof_01_inverted",
	baseObject = "base_wall_decoration",
	components = {
		{
			class = "Model",
			model = "mod_assets/vb_models/models_under_d/env/ud_roof_01.fbx",
			staticShadow = true,
                        rotation = vec(180, 0, 0),
		},
	},
	replacesWall = true,
	tags = { "VB","Under Dungeon" },
}
So basically this, what I asked in the first place :)

Worx great! Thanks Thom!

Re: Ask a simple question, get a simple answer

Posted: Tue Nov 13, 2018 2:47 pm
by KhrougH
hello again :)
i have two help needs in one question:
how can i "use" global tables?
i'm defining an object and i want to have many on them on the map but i want the player can use it only one time each object. than i tried with a table, but i can't find a way to use as global table. i did this:
SpoilerShow

Code: Select all

local mytable = {}

defineObject{
	name = "myobject",
	baseObject = "base_mybase",
	components = {
	bla bla bla...
	{
			class = "Clickable",
			offset = vec(0, 1, -3),
			size = vec(5, 5, 0),
			maxDistance = 2,
			frontFacing = false,
			--debugDraw = true,
			onClick = function(self)
        local allow = true
        for _, v in ipairs(mytable) do
          if v == self.go.id then
            allow = false
            break
          else
            allow = true
          end
        end
        if allow == true then
          table.insert(mytable,self.go.id)
          playSound("secret")
          party.party:shakeCamera(0.02,2)
          hudPrint("hurray")
          end
        end
      end,
		},
	
it works good, but of corse, "local" is not global. so if i use all of them than i save the game and than i load the game and i use them again they still works. but they shouldn't.
so. how can i solve this problem? maybe with a "disableself" component!?

second question is:
how can i do the same thing but insted using myobject only one time, i want to use it once in a day?
so after 24 hours (game timing) i can use it again.

i hope i've been clear :?

Re: Ask a simple question, get a simple answer

Posted: Tue Nov 13, 2018 3:10 pm
by KhrougH
how can i make an object clickable on every side in defineObject?
like a rock. i would like that something happens whenever you stand around it not only in "facing" position.

Re: Ask a simple question, get a simple answer

Posted: Tue Nov 13, 2018 4:54 pm
by THOM
KhrougH wrote: Tue Nov 13, 2018 3:10 pm how can i make an object clickable on every side in defineObject?
like a rock. i would like that something happens whenever you stand around it not only in "facing" position.
Have a look how it's done with the "pushable block" object: there are four klickable zones on every side.

Re: Ask a simple question, get a simple answer

Posted: Thu Nov 15, 2018 5:14 pm
by KhrougH
THOM wrote: Tue Nov 13, 2018 4:54 pm
KhrougH wrote: Tue Nov 13, 2018 3:10 pm how can i make an object clickable on every side in defineObject?
like a rock. i would like that something happens whenever you stand around it not only in "facing" position.
Have a look how it's done with the "pushable block" object: there are four klickable zones on every side.
gosh, you're right!!!
i'll take a look, thanks

Re: Ask a simple question, get a simple answer

Posted: Thu Nov 15, 2018 5:27 pm
by KhrougH
ok, i already checked this argument on this forum and i couldn't find the right thread, so i have a brand new (annoying) question:
i'm working with blender. doing a tree. it works fine. but looks what happens when i use it in the game:
https://drive.google.com/open?id=1Pgisq ... UfAcLiK9XS
https://drive.google.com/open?id=1I4cgb ... 6XFl56CpY-
https://drive.google.com/open?id=1woHjq ... X-ISdYzt2b
https://drive.google.com/open?id=1Q8Rtp ... ue0qvcXNvt
walking back from the tree, it disappear. it doesn't happens to an already existing tree in game.
as you can see from the screenshots stepping away it vanish ... like a cheap magic! :lol:
i made copy/paste of defineObject and defineMaterial of the inGame tree. so it should be something in Blender. but i can't find the solution.
somebody knows what's going on in there?

Re: Ask a simple question, get a simple answer

Posted: Thu Nov 15, 2018 5:46 pm
by KhrougH
few days ago i asked this:
KhrougH wrote: Tue Nov 13, 2018 2:47 pm hello again :)
i have two help needs in one question:
how can i "use" global tables?
i'm defining an object and i want to have many on them on the map but i want the player can use it only one time each object. than i tried with a table, but i can't find a way to use as global table. i did this:
SpoilerShow

Code: Select all

local mytable = {}

defineObject{
	name = "myobject",
	baseObject = "base_mybase",
	components = {
	bla bla bla...
	{
			class = "Clickable",
			offset = vec(0, 1, -3),
			size = vec(5, 5, 0),
			maxDistance = 2,
			frontFacing = false,
			--debugDraw = true,
			onClick = function(self)
        local allow = true
        for _, v in ipairs(mytable) do
          if v == self.go.id then
            allow = false
            break
          else
            allow = true
          end
        end
        if allow == true then
          table.insert(mytable,self.go.id)
          playSound("secret")
          party.party:shakeCamera(0.02,2)
          hudPrint("hurray")
          end
        end
      end,
		},
	
it works good, but of corse, "local" is not global. so if i use all of them than i save the game and than i load the game and i use them again they still works. but they shouldn't.
so. how can i solve this problem? maybe with a "disableself" component!?

second question is:
how can i do the same thing but insted using myobject only one time, i want to use it once in a day?
so after 24 hours (game timing) i can use it again.

i hope i've been clear :?
i found this thread: viewtopic.php?f=22&t=8147#p82429

is this my answer?

Re: Ask a simple question, get a simple answer

Posted: Fri Nov 16, 2018 1:08 am
by Pompidom
KhrougH wrote: Thu Nov 15, 2018 5:27 pm ok, i already checked this argument on this forum and i couldn't find the right thread, so i have a brand new (annoying) question:
i'm working with blender. doing a tree. it works fine. but looks what happens when i use it in the game:
https://drive.google.com/open?id=1Pgisq ... UfAcLiK9XS
https://drive.google.com/open?id=1I4cgb ... 6XFl56CpY-
https://drive.google.com/open?id=1woHjq ... X-ISdYzt2b
https://drive.google.com/open?id=1Q8Rtp ... ue0qvcXNvt
walking back from the tree, it disappear. it doesn't happens to an already existing tree in game.
as you can see from the screenshots stepping away it vanish ... like a cheap magic! :lol:
i made copy/paste of defineObject and defineMaterial of the inGame tree. so it should be something in Blender. but i can't find the solution.
somebody knows what's going on in there?
dissolveStart = 4,
dissolveEnd = 6,

this is apparently the default settings

add this to your defineobject and increase the numbers

Re: Ask a simple question, get a simple answer

Posted: Fri Nov 16, 2018 2:23 am
by minmay
dissolveStart and dissolveEnd are nil by default. If your model has a mesh node called lod1_mesh, it will start to fade in at a distance from the camera equal to dissolveStart*3 meters, and finish fading in at dissolveEnd*3 meters. Meanwhile, the rest of the mesh nodes will fade out.

So there are two ways it is typically used: to switch to a lower-detail mesh at long distances (used for the vanilla game's trees), and to disappear completely at long distances (used for the vanilla game's grass, heather, etc.). If you want neither, leave dissolveStart and dissolveEnd nil, and no fading will occur.

Re: Ask a simple question, get a simple answer

Posted: Fri Nov 16, 2018 3:21 am
by akroma222
KhrougH wrote: Tue Nov 13, 2018 2:47 pm hello again :)
i have two help needs in one question:
how can i "use" global tables?
i'm defining an object and i want to have many on them on the map but i want the player can use it only one time each object. than i tried with a table, but i can't find a way to use as global table. i did this:
SpoilerShow

Code: Select all

local mytable = {}

defineObject{
	name = "myobject",
	baseObject = "base_mybase",
	components = {
	bla bla bla...
	{
			class = "Clickable",
			offset = vec(0, 1, -3),
			size = vec(5, 5, 0),
			maxDistance = 2,
			frontFacing = false,
			--debugDraw = true,
			onClick = function(self)
        local allow = true
        for _, v in ipairs(mytable) do
          if v == self.go.id then
            allow = false
            break
          else
            allow = true
          end
        end
        if allow == true then
          table.insert(mytable,self.go.id)
          playSound("secret")
          party.party:shakeCamera(0.02,2)
          hudPrint("hurray")
          end
        end
      end,
		},
	
it works good, but of corse, "local" is not global. so if i use all of them than i save the game and than i load the game and i use them again they still works. but they shouldn't.
so. how can i solve this problem? maybe with a "disableself" component!?

second question is:
how can i do the same thing but insted using myobject only one time, i want to use it once in a day?
so after 24 hours (game timing) i can use it again.

i hope i've been clear :?
Hey KhrougH,

It's an extremelyuseful thread indeed .... and
Here is a detailed answer to your local / global table Q (minmays response at the end)
viewtopic.php?f=22&t=18236&p=116703&hil ... ig#p116703
And further explanations / examples in .rhavin 's thread (answers provided by Isaac & minmay)
viewtopic.php?f=22&t=18159&p=115633&hil ... ig#p115637

Searching the forum for "Config" will set you on the right track ;)
(And Config. is how I usually ref global tables - but do read into it as it is not as simple at that)

Enjoy & happy reading! 8-)