Help to FX

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
stochastic
Posts: 15
Joined: Fri Dec 28, 2012 11:59 pm

Help to FX

Post by stochastic »

I was planning to get some new red light in my dungeon, however... I cannot really get that "FX" to work...

I have tried:

function test11111()
if testp1:isDown() == true
fxtest:setLight(1, 0, 0, 10, 3, 200, true)
else

end
end

with a pressure_plate and a FX

(The script doesn't work) :(
Hariolor
Posts: 42
Joined: Sun Apr 15, 2012 5:59 am

Re: Help to FX

Post by Hariolor »

Probably easier to clone a light source and spawn or toggle it as you desire.

Add something like this to your mod_assets/scripts/objects.lua file

Code: Select all

cloneObject{
   name = "red_ceiling_light",
   baseObject = "temple_ceiling_lamp",
   particleSystem = false,
   lightColor = vec(0.75,0,0), -- sets light to red. edit the three numbers to any r,g,b values between 0 and 1 to change the color
}
then reload your dungeon in the editor and you'll have a new object called "red_ceiling_light" that you can use like any other object.

Try something like

Code: Select all

function redlighton()
  if testp1:isDown() == true
    then
    spawn("red_ceiling_light",level,x,y,facing,"myredlight")
  end
end

(tip: you don't need to put the "else" unless you want to do something else when the if statement returns false)

if you want the light to only be on while the plate is held down, you'd need a different approach. The ham-handed way is to have two functions:

Code: Select all

function lighton()
  spawn("red_ceiling_light",level,x,y,facing,"myredlight")
end

function lightoff()
  myredlight:destroy()
end

make your plate trigger "lighton" when activated and trigger "lightoff" when deactivated...I'm sure there's a more elegant solution but I think this gets the job done at least.
User avatar
Komag
Posts: 3654
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Help to FX

Post by Komag »

yes definitely use a lightsource and not fx for something like this
Finished Dungeons - complete mods to play
Post Reply