The Custom Alcove Thread. (Neikun, Batty and Crisman)
-
- Posts: 163
- Joined: Fri Sep 14, 2012 6:20 pm
Re: (Object Assets) Empty Catacomb as Alcove and other alcov
Here it be in all it's glory....thanks Neikun & Batty for contributions
Re: (Object Assets) Empty Catacomb as Alcove and other alcov
Looks like a nice little appartment lol
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: (Object Assets) Empty Catacomb as Alcove and other alcov
Neikun found these wall lanterns which I really like and want to use:
But defining them as TorchHolders doesn't make sense because they have embers in them that are meant to be lit by a torch - the torch is not supposed to be stuck in the lantern. You can see in the above pic the torch clipping through the lantern and the fire is off center.
I want them to look like this:
How can it be done so that you light the embers and keep the torch? Alcoves! (again)
You need 2 alcoves: visual & logical. The first one simply displays the lantern image:
The clickbox (targetSize) is nullified so it doesn't function as an alcove.
The second one is not so simple:
First, the clickbox is reduced to fit around the embers so that you have to click right on them to light the lantern. Then, everything happens in the onInsertItem hook. It checks if a torch is being clicked on the lantern and if it is, assigns an identifier (id) to the lantern that's the sum of its map coordinates. So, a lantern at 3,5 will have id = 8. This is done because to spawn the particle system and lightsource you need a unique entity or the game crashes.
The torch particle system ("flame") is then spawned. Next, the lightsource is spawned ("light") and the light can be adjusted by setLight(red, green, blue, brightness, range, duration, shadows).
You have to track the id's of the lanterns you place. If you light two lanterns at 3,5 and 5,3 they'll both have the same id (8) and the game will crash because you'll be creating entities flame8 and light8 twice. This really isn't a problem as I've been placing them all over and haven't conflicted. Spawning too many particle systems and lightsources will probably cause a framerate hit anyway.
EDIT: Komag pointed out that constructing the id from a concatenated string of coordinates would allow less conflict between lanterns so the id is now: level_x_y_facing which creates a fully unique id for each lantern throughout the dungeon and you no longer need to track lantern placement. You can stick them everywhere! Thanks Komag!
Finally, the burning sound is played and the alcove is destroyed because if it were clicked on a second time the game would crash (again, duplicate flame & light entities).
Why do all this? It's really cool to walk around with one torch and click on all the lanterns lighting them up. And the shadows!
Multiple lanterns with shadows crossing and on the ceiling:
Caveat: a burnt out torch will still light the lanterns since there's no way to test for empty torches. Torches don't become a new object (torch_burnt_out would be nice) when they run out of fuel and there's no convenient hasFuel() function to call. Maybe they'll be a way to fix that.
SpoilerShow
I want them to look like this:
SpoilerShow
You need 2 alcoves: visual & logical. The first one simply displays the lantern image:
Code: Select all
defineObject{
name = "wall_lantern_visual",
class = "Alcove",
anchorPos = vec(0, 0, 0),
targetPos = vec(0, 0, 0),
targetSize = vec(0, 0, 0),
model = "assets/models/env/wall_lantern.fbx",
placement = "wall",
replacesWall = false,
editorIcon = 92,
}
The second one is not so simple:
Code: Select all
defineObject{
name = "wall_lantern_logical",
class = "Alcove",
anchorPos = vec(0, 1.65, 0),
targetPos = vec(0, 1.65, 0),
targetSize = vec(0.2, 0.2, 0.2),
onInsertItem = function(self, item)
if item.name == "torch" or "everlasting_torch" then
local id = self.level.."_"..self.x.."_"..self.y.."_"..self.facing
xface = {0, 1.18, 0, -1.18}
zface = {1.18, 0 , -1.18, 0}
spawn("fx", self.level, self.x, self.y, 0, "flame"..id)
local flame = findEntity("flame"..id)
flame:setParticleSystem("torch")
flame:translate(xface[self.facing + 1], 1.85, zface[self.facing + 1])
spawn("fx", self.level, self.x, self.y, 0, "light"..id)
local light = findEntity("light"..id)
light:setLight(0.7, 0.5, 0.5, 10, 12, 36000, true)
light:translate(xface[self.facing + 1], 1.85, zface[self.facing + 1])
playSoundAt("torch_burning", self.level, self.x, self.y)
self:destroy()
end
end,
placement = "wall",
replacesWall = false,
editorIcon = 92,
}
The torch particle system ("flame") is then spawned. Next, the lightsource is spawned ("light") and the light can be adjusted by setLight(red, green, blue, brightness, range, duration, shadows).
You have to track the id's of the lanterns you place. If you light two lanterns at 3,5 and 5,3 they'll both have the same id (8) and the game will crash because you'll be creating entities flame8 and light8 twice. This really isn't a problem as I've been placing them all over and haven't conflicted. Spawning too many particle systems and lightsources will probably cause a framerate hit anyway.
EDIT: Komag pointed out that constructing the id from a concatenated string of coordinates would allow less conflict between lanterns so the id is now: level_x_y_facing which creates a fully unique id for each lantern throughout the dungeon and you no longer need to track lantern placement. You can stick them everywhere! Thanks Komag!
Finally, the burning sound is played and the alcove is destroyed because if it were clicked on a second time the game would crash (again, duplicate flame & light entities).
Why do all this? It's really cool to walk around with one torch and click on all the lanterns lighting them up. And the shadows!
SpoilerShow
SpoilerShow
Last edited by Batty on Mon Oct 01, 2012 4:03 pm, edited 7 times in total.
Re: (Object Assets) Empty Catacomb as Alcove and other alcov
You're a genius, Batty haha.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: (Object Assets) Empty Catacomb as Alcove and other alcov
Maybe the ID could just be the coordinates together, such as 3_5, so that there really is no problem with 3,5 and 5,3, because someone may in fact run into this problem in some room near the diagonal of the dungeon map
But very good work, those look cool!
But very good work, those look cool!
Finished Dungeons - complete mods to play
Re: (Object Assets) Empty Catacomb as Alcove and other alcov
oh nice, that may work but I'm gonna add level to it which should make a unique id because 3_5 on different levels will conflict so adding level in front should fix it such as 1_3_5 and 2_3_5. oooh and facing too then it'll be unique!Komag wrote:Maybe the ID could just be the coordinates together, such as 3_5, so that there really is no problem with 3,5 and 5,3, because someone may in fact run into this problem in some room near the diagonal of the dungeon map
But very good work, those look cool!
Tested & works great! Just need to fix the empty torch problem now.
Re: (Object Assets) Empty Catacomb as Alcove and other alcov
Hey guys. New alcove project.
I want to turn a spear statue into a three part alcove.
Thanks to the discovery of the anchorRotation string, I think it can be done.
I want the head to hold a helmet, the spear arm to hold a spear, and the shield to hold a legionary shield.
I've run out of time to work on it, but I was hoping you guys might be able to figure it out
This gets the helmet in front of his head, but not on it.
It would not surprise me if it has to be done entirely with logical alcoves with the statue model as something less outside the wall.
Good luck, I'll be back after work, maybe.
I have since made the helmet alcove. I think you will be impressed
I want to turn a spear statue into a three part alcove.
Thanks to the discovery of the anchorRotation string, I think it can be done.
I want the head to hold a helmet, the spear arm to hold a spear, and the shield to hold a legionary shield.
I've run out of time to work on it, but I was hoping you guys might be able to figure it out
This gets the helmet in front of his head, but not on it.
Code: Select all
defineObject{
name = "statue_alcove_spear",
class = "Alcove",
anchorPos = vec(0, 2, -0.2),
anchorRotation = vec(0,0,0),
targetPos = vec(0,2, -0.2),
targetSize = vec(0.3, 0.3, 0.3),
model = "assets/models/env/temple_gladiator_statue_spear.fbx",
placement = "wall",
replacesWall = true,
editorIcon = 92,
}
Good luck, I'll be back after work, maybe.
I have since made the helmet alcove. I think you will be impressed
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: (Object Assets) Empty Catacomb as Alcove and other alcov
Temple_gladiator_spear_alcove
I've turned one of the temple statues into an alcove that holds a legionary_helmet.
More to come: Shield alcove and spear as well
Now with shield.
I've turned one of the temple statues into an alcove that holds a legionary_helmet.
More to come: Shield alcove and spear as well
Code: Select all
defineObject{
name = "statue_alcove_spear_helmet",
class = "Alcove",
anchorPos = vec(0.027, 2.115, 0.225),
anchorRotation = vec(13,1,1.9),
targetPos = vec(0.027,2.13, 0.25),
targetSize = vec(0.3, 0.3, 0.3),
model = "assets/models/env/temple_gladiator_statue_spear.fbx",
onInsertItem = function(self, item)
return item.name == "legionary_helmet" and self:getItemCount() == 0
end,
placement = "wall",
replacesWall = true,
editorIcon = 92,
}
Now with shield.
Code: Select all
defineObject{
name = "statue_alcove_spear_shield",
class = "Alcove",
anchorPos = vec(0.34, 1.56, 0.18),
anchorRotation = vec(22,356,88.7),
targetPos = vec(0.34,1.56, 0.18),
targetSize = vec(0.3, 0.3, 0.3),
onInsertItem = function(self, item)
return item.name == "legionary_shield" and self:getItemCount() == 0
end,
placement = "wall",
replacesWall = true,
editorIcon = 92,
}
Last edited by Neikun on Tue Oct 16, 2012 1:04 pm, edited 3 times in total.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: (Object Assets) Empty Catacomb as Alcove and other alcov
that, my friend, is awesome!
Finished Dungeons - complete mods to play
Re: (Object Assets) Empty Catacomb as Alcove and other alcov
Looks very promising. Do you plan to change the model so it'll loose the shield and spear when they'll be taken?