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

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: (Object Assets) Empty Catacomb as Alcove and other alcov

Post by Neikun »

Lol the free one is prettier.
"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
  • Message me to join in!
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: (Object Assets) Empty Catacomb as Alcove and other alcov

Post by Batty »

flatline wrote:Batty, I've copied your stuff and it works fine except that it seems the script accepts ANY object to light the lanterns. When I fool around in the editor, I can put in a sling and still light one of the lanterns. At first, I thought the script lacked a "else"-parameter telling it to end if anything but a torch was inserted. I can't seem to fix it though. Thoughts?

Great work btw, and I'm quite new to scripting Grimrock so bear with me. I did manage to make some nice looking drainage floors with custom fires glowing far below and filling the room with smoke, so progress is being had.
LOL thanks for finding & reporting that, I may have never found it. I lit a lantern with a rock lol. Anyway, It's fixed, here's the new script:

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 item.name == "everlasting_torch" then
		   	spawn("wall_lantern_fx_"..self.facing, self.level, self.x, self.y, 0)
		   	playSoundAt("wall_lantern_crackling", self.level, self.x, self.y)
		   	self:destroy()		
		   end
	   end,
   	placement = "wall",
   	replacesWall = false,
   	editorIcon = 84,
}
Only change was if item.name == "torch" or item.name == "everlasting_torch" then. The previous if statement didn't compare "everlasting_torch" with the item passed to the function so it was always testing as true and letting any object into the script. I tested various items before and after lighting and it works but keep testing yourself, you never know. I'm a rusty, semi-experienced scripter.

I really like the fire in the floor drainage! I'm gonna try that one myself.

edit: whoops, I guess it's "torch_everburning" and not "everlasting_torch" don't know how I did that.
Last edited by Batty on Thu Oct 04, 2012 3:23 pm, edited 2 times in total.
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: (Object Assets) Empty Catacomb as Alcove and other alcov

Post by Grimwold »

flatline wrote: Batty, I've copied your stuff and it works fine except that it seems the script accepts ANY object to light the lanterns. When I fool around in the editor, I can put in a sling and still light one of the lanterns. At first, I thought the script lacked a "else"-parameter telling it to end if anything but a torch was inserted. I can't seem to fix it though. Thoughts?.
I've fixed the logical lantern script so it only turns on with a "torch" or "torch_everburning", but the item is not destroyed as the script suggests it should be... will look into that.

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)
             hudPrint(item.name)      
             if item.name == "torch" or item.name == "torch_everburning" 
             then
               spawn("wall_lantern_fx_"..self.facing, self.level, self.x, self.y, 0)
               playSoundAt("wall_lantern_crackling", self.level, self.x, self.y)
               self:destroy()
             end
          end,
          placement = "wall",
          replacesWall = false,
          editorIcon = 84,
    }
now I just need a way to turn them on automatically.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: (Object Assets) Empty Catacomb as Alcove and other alcov

Post by Batty »

Grimwold wrote:but the item is not destroyed as the script suggests it should be... will look into that.
The alcove not the item is destroyed so you can't light the lantern twice, dunno why you'd want to destroy the torch. The lantern has red embers/coals in it presumably with some fuel in them so the flame from the torch lights it and you keep the lit torch.

Neikun suggested lighting the lanterns consumes an amount of fuel (say 20%) from the torch but (I think) there's no way atm to do that.
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: (Object Assets) Empty Catacomb as Alcove and other alcov

Post by Grimwold »

Batty wrote:
Grimwold wrote:but the item is not destroyed as the script suggests it should be... will look into that.
The alcove not the item is destroyed so you can't light the lantern twice, dunno why you'd want to destroy the torch. The lantern has red embers/coals in it presumably with some fuel in them so the flame from the torch lights it and you keep the lit torch.
ah. that was my misunderstanding, sorry. I saw the destroy and thought it meant to destroy the item used for lighting.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: (Object Assets) Empty Catacomb as Alcove and other alcov

Post by Batty »

Actually, that also makes game sense to me (that you'd have to use an entire torch to light a lantern) and might make things more strategically interesting for the player but you'd have to separately destroy the torch.


MAJOR EDIT: There is:
Item:setFuel(fuel)
Sets the remaining fuel (in seconds) for torches.
and
Item:getFuel(fuel)
Returns the remaining fuel (in seconds) for torches.
in the reference! You can handle lighting the lanterns however you want now and they're fully functioning - no more dead torch problem.

I guess it's time to actually read the entire reference. :lol:
flatline

Re: (Object Assets) Empty Catacomb as Alcove and other alcov

Post by flatline »

Batty wrote:Actually, that also makes game sense to me (that you'd have to use an entire torch to light a lantern) and might make things more strategically interesting for the player but you'd have to separately destroy the torch.


MAJOR EDIT: There is:
Item:setFuel(fuel)
Sets the remaining fuel (in seconds) for torches.
and
Item:getFuel(fuel)
Returns the remaining fuel (in seconds) for torches.
in the reference! You can handle lighting the lanterns however you want now and they're fully functioning - no more dead torch problem.

I guess it's time to actually read the entire reference. :lol:
This means we can make a level where the player has to compare the benefits of rushinng ahead to light lanterns before his single lonely torch runs out, or rely on light spells and creeping in darkness. Is there any way to lower the ambient light in the dungeon, besides a constant darkness-spell?
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: (Object Assets) Empty Catacomb as Alcove and other alcov

Post by Batty »

flatline wrote:This means we can make a level where the player has to compare the benefits of rushinng ahead to light lanterns before his single lonely torch runs out, or rely on light spells and creeping in darkness. Is there any way to lower the ambient light in the dungeon, besides a constant darkness-spell?
I've looked at this a little but couldn't find anything. Beyond adjusting ambient light levels, I'd also like to adjust the effect that the light spell produces but I haven't found a way for that either.

I'd also like to shut the lanterns off. You can destroy the LightSource object thus shutting off the flame but the crackling sound persists forever. I'll keep trying.
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: (Object Assets) Empty Catacomb as Alcove and other alcov

Post by Grimwold »

This is great. I must've read past those getFuel and setFuel commands a few times and not noticed.

The sound is a bit of an issue though... we really need a way to stop a looping sound. even if it's by means of silencing anything playing in a particular square.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: (Object Assets) Empty Catacomb as Alcove and other alcov

Post by Batty »

Grimwold wrote:This is great. I must've read past those getFuel and setFuel commands a few times and not noticed.

The sound is a bit of an issue though... we really need a way to stop a looping sound. even if it's by means of silencing anything playing in a particular square.
I asked for it already in the editor requests thread but more people should request it then maybe we'll get it.
Post Reply