Scripting ideas for moving boulder
Posted: Mon Jun 10, 2013 9:55 pm
Hi.
I am experimenting with a rolling boulder (Indiana Jones)
I've downloaded the files needed http://grimrock.nexusmods.com/mods/176/ ... D176&pUp=1
And I have gotten the boulder to roll north in my dungeon.
The problem I am having is that I can't trigger the script.
It triggers itself automaticly and I have no clue what to do. (Meaning that it triggers the second I start the dungeon preview in editor mode)
I have this script in game;
name: script_entity
ID: boulderScript
function launchBoulders()
launchBoulderNorth()
launchBoulderWest()
launchBoulderSouth()
launchBoulderEast()
local boulder_sound_timer = findEntity("boulder_sound_timer")
if boulder_sound_timer == nil then
local boulder_sound_timer = spawn("timer", party.level, party.x, party.y, party.facing, "boulder_sound_timer")
boulder_sound_timer:addConnector("activate", "boulder_script", "doBoulderSounds")
boulder_sound_timer:setTimerInterval(1)
boulder_sound_timer:activate()
end
end
function launchBoulderNorth()
shootProjectile("boulder",1,15,27,0, 3,0,0,0,0,0,1000,nil,true)
end
function launchBoulderWest()
shootProjectile("boulder",1,10,4,3, 3,0,0,0,0,0,1000,nil,true)
end
function launchBoulderSouth()
shootProjectile("boulder",1,2,4,2, 3,0,0,0,0,0,1000,nil,true)
end
function launchBoulderEast()
shootProjectile("boulder",1,2,10,1, 3,0,0,0,0,0,1000,nil,true)
end
function doBoulderSounds()
for i in allEntities(party.level) do
if i.name == "boulder" then
checkDistanceFromParty(i)
end
end
end
function checkDistanceFromParty(boulder)
local distance = math.floor(math.sqrt (math.pow(party.x - boulder.x,2) + math.pow(party.y - boulder.y,2)))
--print("boulder distance"..distance.."")
if distance <= 1 then
party:shakeCamera(.05, 2)
party:playScreenEffect("earthquake_dust")
playSoundAt("boulder_rolling", party.level, boulder.x, boulder.y)
elseif distance <= 2 then
party:shakeCamera(.04, 2)
party:playScreenEffect("earthquake_dust")
playSoundAt("boulder_rolling", party.level, boulder.x, boulder.y)
elseif distance <= 3 then
party:shakeCamera(.03, 2)
party:playScreenEffect("earthquake_dust")
playSoundAt("boulder_rolling", party.level, boulder.x, boulder.y)
elseif distance <= 4 then
party:shakeCamera(.02, 2)
party:playScreenEffect("earthquake_dust")
playSoundAt("boulder_rolling", party.level, boulder.x, boulder.y)
elseif distance <= 5 then
party:shakeCamera(.01, 2)
party:playScreenEffect("earthquake_dust")
playSoundAt("boulder_rolling", party.level, boulder.x, boulder.y)
end
end
After I added that I had to create a trigger-script.
Name: script_entity
ID: test
boulderScript:launchBoulderNorth()
Now every time I start the dungeon it launches the boulder.
I would like to have a hidded pressure plate trigger the "launch boulder" script so that it waits for the correct moment.
Does anyone know how to delay that script to a certain point in time, and prevent it from launching emidietly?
Thanks guys
I am experimenting with a rolling boulder (Indiana Jones)
I've downloaded the files needed http://grimrock.nexusmods.com/mods/176/ ... D176&pUp=1
And I have gotten the boulder to roll north in my dungeon.
The problem I am having is that I can't trigger the script.
It triggers itself automaticly and I have no clue what to do. (Meaning that it triggers the second I start the dungeon preview in editor mode)
I have this script in game;
name: script_entity
ID: boulderScript
function launchBoulders()
launchBoulderNorth()
launchBoulderWest()
launchBoulderSouth()
launchBoulderEast()
local boulder_sound_timer = findEntity("boulder_sound_timer")
if boulder_sound_timer == nil then
local boulder_sound_timer = spawn("timer", party.level, party.x, party.y, party.facing, "boulder_sound_timer")
boulder_sound_timer:addConnector("activate", "boulder_script", "doBoulderSounds")
boulder_sound_timer:setTimerInterval(1)
boulder_sound_timer:activate()
end
end
function launchBoulderNorth()
shootProjectile("boulder",1,15,27,0, 3,0,0,0,0,0,1000,nil,true)
end
function launchBoulderWest()
shootProjectile("boulder",1,10,4,3, 3,0,0,0,0,0,1000,nil,true)
end
function launchBoulderSouth()
shootProjectile("boulder",1,2,4,2, 3,0,0,0,0,0,1000,nil,true)
end
function launchBoulderEast()
shootProjectile("boulder",1,2,10,1, 3,0,0,0,0,0,1000,nil,true)
end
function doBoulderSounds()
for i in allEntities(party.level) do
if i.name == "boulder" then
checkDistanceFromParty(i)
end
end
end
function checkDistanceFromParty(boulder)
local distance = math.floor(math.sqrt (math.pow(party.x - boulder.x,2) + math.pow(party.y - boulder.y,2)))
--print("boulder distance"..distance.."")
if distance <= 1 then
party:shakeCamera(.05, 2)
party:playScreenEffect("earthquake_dust")
playSoundAt("boulder_rolling", party.level, boulder.x, boulder.y)
elseif distance <= 2 then
party:shakeCamera(.04, 2)
party:playScreenEffect("earthquake_dust")
playSoundAt("boulder_rolling", party.level, boulder.x, boulder.y)
elseif distance <= 3 then
party:shakeCamera(.03, 2)
party:playScreenEffect("earthquake_dust")
playSoundAt("boulder_rolling", party.level, boulder.x, boulder.y)
elseif distance <= 4 then
party:shakeCamera(.02, 2)
party:playScreenEffect("earthquake_dust")
playSoundAt("boulder_rolling", party.level, boulder.x, boulder.y)
elseif distance <= 5 then
party:shakeCamera(.01, 2)
party:playScreenEffect("earthquake_dust")
playSoundAt("boulder_rolling", party.level, boulder.x, boulder.y)
end
end
After I added that I had to create a trigger-script.
Name: script_entity
ID: test
boulderScript:launchBoulderNorth()
Now every time I start the dungeon it launches the boulder.
I would like to have a hidded pressure plate trigger the "launch boulder" script so that it waits for the correct moment.
Does anyone know how to delay that script to a certain point in time, and prevent it from launching emidietly?
Thanks guys