pressure plates and variables...

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Pandafox
Posts: 268
Joined: Wed Apr 11, 2012 11:25 pm
Location: France
Contact:

pressure plates and variables...

Post by Pandafox »

hello dudes,

is anyone knows if it is possible :

- a pressure plate can start a script with variables ? If yes, how to ?
- a script can get the X and the Y of the pressure plate which started it ?

thanks
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: pressure plates and variables...

Post by Grimwold »

in general any activator (plate, button, lever etc.) passes itself as a variable to the script it calls...

So if you add a variable to your script you can access all the properties of the entity that called the function:

Code: Select all

function checkPlate(trigger)
  hudPrint("pressure plate with id " .. trigger.id .. " located at " .. trigger.level .. "," .. trigger.x .. "," .. trigger.y .. " was activated")
end
User avatar
Pandafox
Posts: 268
Joined: Wed Apr 11, 2012 11:25 pm
Location: France
Contact:

Re: pressure plates and variables...

Post by Pandafox »

Grimwold wrote:in general any activator (plate, button, lever etc.) passes itself as a variable to the script it calls...

So if you add a variable to your script you can access all the properties of the entity that called the function:

Code: Select all

function checkPlate(trigger)
  hudPrint("pressure plate with id " .. trigger.id .. " located at " .. trigger.level .. "," .. trigger.x .. "," .. trigger.y .. " was activated")
end
Yes ! it works !
Thanks a lot, you are great !! :)
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: pressure plates and variables...

Post by Komag »

wow, I missed this before, very handy, thanks!
Finished Dungeons - complete mods to play
Post Reply