Jump to content

create.... functions + math.


Jockie

Recommended Posts

Posted

I'm a bit sad because I can't use this.

createObject( 1225, 3923.9899902344, math.random(461,351.8), 2.0592248439789, 90,0,0)

It would be usefull for spawning random objects at random places. :>

Posted
function moveBarrel(object)
local x,y,z = getElementPosition(object)
moveObject (object, 45000, x - MOVE_DELTA, y, z)
setTimer(respawnBarrel,45000,1,object)
end
 
function respawnBarrel(object)
destroyElement(object)
  newBarrel = createObject( 1225, 3923.9899902344, math.random(461,351.8), 2.0592248439789, 90,0,0)
setTimer(moveBarrel, 50, 1, newBarrel)
end

And this: http://img28.imageshack.us/img28/6507/createobjectpr.png

Posted

The first argument of math.random is the lower and the second the upper limit for the number to be generated.

In your case the lower limit is greater than the upper which makes no sense and thus gives you an error.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...