Page 1 of 1
pressure plates and variables...
Posted: Thu Dec 20, 2012 2:46 pm
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
Re: pressure plates and variables...
Posted: Thu Dec 20, 2012 2:54 pm
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
Re: pressure plates and variables...
Posted: Thu Dec 20, 2012 3:19 pm
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 !!
Re: pressure plates and variables...
Posted: Thu Dec 20, 2012 3:53 pm
by Komag
wow, I missed this before, very handy, thanks!