Page 20 of 36

Re: The Custom Alcove Thread. (Neikun, Batty and Crisman)

Posted: Sat Oct 13, 2012 6:32 pm
by Huder
Normals on my model are not recalulated that why you can see this black shadow on edges. Sorry for that, here is fix: http://www.mediafire.com/?c584r3p38rhdw08

Re: The Custom Alcove Thread. (Neikun, Batty and Crisman)

Posted: Mon Oct 15, 2012 11:48 pm
by Neikun
Here is a recent request from Belblind
Image

I would like to see it done better. Add a light or a particle system to it (only there is no model)
Make for some method of stopping a player from walking through it?
-probably use a floor texture as a blockage. Have the blockage destroyed upon pickup.
Scripts for the socket, and floor blockages as well.
I'm going to see if I can't make them glow.
SpoilerShow

Code: Select all

defineObject{
	name = "floating_sword_socket",
	class = "Alcove",
	anchorPos = vec(0, 1.1, -1.0),
	anchorRotation = vec(90,0,90),
	targetPos = vec(0, 1.1, -0.38),
	targetSize = vec(0, 0, 0),
	placement = "wall",
	editorIcon = 92,
}
defineObject{
	name = "dungeon_floor_blockage",
	class = "Blockage",
	model = "assets/models/env/dungeon_floor_01.fbx",
	placement = "floor",
	repelProjectiles = true,
	hitSound = "impact_blade",
	editorIcon = 56,
}

defineObject{
	name = "temple_floor_blockage",
	class = "Blockage",
	model = "assets/models/env/temple_floor_01.fbx",
	placement = "floor",
	repelProjectiles = true,
	hitSound = "impact_blade",
	editorIcon = 56,
}

defineObject{
	name = "prison_floor_blockage",
	class = "Blockage",
	model = "assets/models/env/prison_floor_01.fbx",
	placement = "floor",
	repelProjectiles = true,
	hitSound = "impact_blade",
	editorIcon = 56,
}
EDIT: Changed the anchorPos.
NOTE: With an alcove it is impossible to have the item in the center of the square and still be retrievable.
I have sent a query to the devs on this matter.

Re: The Custom Alcove Thread. (Neikun, Batty and Crisman)

Posted: Tue Oct 16, 2012 2:44 am
by msyblade
For the Key behind the wall drainage no code is required. I pulled it off early on by placing the key on the near side of the square behind it. Much like a pad on the far side of a portcullis. Works just fine. Not sure if you can place items thru though,...some sort of "feed the rats" puzzle trigger with a 2 sec item teleporter connected? :)

Re: The Custom Alcove Thread. (Neikun, Batty and Crisman)

Posted: Tue Oct 16, 2012 4:22 am
by Hustin
crisman wrote:Image

Here you go!
SpoilerShow
defineObject{
name = "dungeon_wall_drainage_alcove",
model = "assets/models/env/dungeon_wall_drainage.fbx",
class = "Alcove",
anchorPos = vec(0, 0.00, 0.5),
targetPos = vec(0, 0.1, 0),
targetSize = vec(0.3, 0.2, 0.1),
placement = "wall",
replacesWall = true,
editorIcon = 92,
}
I'm a bit in hurry, so it's not exactly perfect, you can put in everything. I'll tweak in that way -maybe- later! ;)
Man you guys are awesome. Here's my first attempt at a Lua script. I modded it so it only accepts keys:

Code: Select all

defineObject{
name = "dungeon_wall_drainage_alcove",
model = "assets/models/env/dungeon_wall_drainage.fbx",
class = "Alcove",
anchorPos = vec(0, 0.00, 0.5),
targetPos = vec(0, 0.1, 0),
targetSize = vec(0.3, 0.2, 0.1),
placement = "wall",
replacesWall = true,
editorIcon = 92,
onInsertItem = function(self, item)
  i, j = string.find(item.name, "_key")
  return (i ~= nil) and (j == string.len(item.name)) and (self:getItemCount() == 0)
end,
}
I've coded in BASIC, Pascal, Ada, C, Java, Perl, and Ruby, but Lua is one weird animal...

Re: The Custom Alcove Thread. (Neikun, Batty and Crisman)

Posted: Tue Oct 16, 2012 1:42 pm
by Neikun
I've started compiling the in-game model alcoves into a single .lua file
I have to go to work now, so I'll put it up later.
There are 24 alcoves in it.

Re: The Custom Alcove Thread. (Neikun, Batty and Crisman)

Posted: Tue Oct 16, 2012 4:13 pm
by Deadlylama
Neikun wrote:I've started compiling the in-game model alcoves into a single .lua file
I have to go to work now, so I'll put it up later.
There are 24 alcoves in it.
does this file contain all (or most) of the alcoves in this topic?

Re: The Custom Alcove Thread. (Neikun, Batty and Crisman)

Posted: Tue Oct 16, 2012 6:00 pm
by crisman
Hustin wrote:

Code: Select all

defineObject{
name = "dungeon_wall_drainage_alcove",
model = "assets/models/env/dungeon_wall_drainage.fbx",
class = "Alcove",
anchorPos = vec(0, 0.00, 0.5),
targetPos = vec(0, 0.1, 0),
targetSize = vec(0.3, 0.2, 0.1),
placement = "wall",
replacesWall = true,
editorIcon = 92,
onInsertItem = function(self, item)
  i, j = string.find(item.name, "_key")
  return (i ~= nil) and (j == string.len(item.name)) and (self:getItemCount() == 0)
end,
}
I've coded in BASIC, Pascal, Ada, C, Java, Perl, and Ruby, but Lua is one weird animal...
I have a question for your code, can you explain me what this does?

i, j = string.find(item.name, "_key")
return (i ~= nil) and (j == string.len(item.name))

there is a lot of stuff I've never seen, so I'm pretty confused about these:

i, j = ...
string.find (for this one the name of the function explain everything, but how it works?)
string.len

thank you!

Re: The Custom Alcove Thread. (Neikun, Batty and Crisman)

Posted: Tue Oct 16, 2012 6:20 pm
by Filipsan
crisman wrote:
i, j = ...
string.find (for this one the name of the function explain everything, but how it works?)
string.len

thank you!
See: http://lua-users.org/wiki/StringLibraryTutorial

s:len() --Return the length of the string passed.

s:find(pattern [, init [, plain]]) -- Find the first occurance of the pattern in the string passed. If an instance of the pattern is found a pair of values representing the start and end of the string is returned. If the pattern cannot be found nil is returned.

Re: The Custom Alcove Thread. (Neikun, Batty and Crisman)

Posted: Tue Oct 16, 2012 6:34 pm
by Hustin
It's basically checking that (a) the pattern was found and (b) the pattern is at the very end of the name. It lets the alcove accept only object types ending in "_key".

Re: The Custom Alcove Thread. (Neikun, Batty and Crisman)

Posted: Tue Oct 16, 2012 7:25 pm
by crisman
ok got it. I did not understand that string.find gives two results. Thank you!