Wednesday, May 12, 2010

Droppin rocks on yo face!


So I finally figured out out to drop rocks(objects) out of the sky.









Set-up:
-Make a trigger
-Make a mark or spawn point where ever(name matters)

*note: The names and id's of objects and markers don't change when you restart the game, as far as I can tell. But the do on the player.

Link:
-In the "enterCommand" for the trigger call a function that you have made in an outside script. Mine: "MoveRock(Bold1,fall1);" Bold1 is my boulder, fall1 is my marker.

*note: You cant just set the position of the rock to the position of the mark like portal-ing a player. You must break it down using the getTransform() and getword() commands. Then use the setTransform()command to move your object.

This is my function code:

function MoveRock(%shape,%mark)
{
echo("Start of MoveRock Function");

//First break down the location of the mark
%temp = %mark.getTransform();
%lx = getword(%temp,0);
%ly = getword(%temp,1);
%lz = getword(%temp,2);

//Then set the location of the shape with those values
%shape.setTransform(%lx SPC %ly SPC %lz SPC "0 0 1 0");

echo("End of MoveRock Function");
}

-Lonny

No comments:

Post a Comment