SetObjectModel: Difference between revisions
Jump to navigation
Jump to search
JonChappell (talk | contribs) No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
==Example== | ==Example== | ||
This | This will continually change an object model every 2.5 seconds at the location -1084.52, -1634.81, 76.36 (Truth's farm). | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | myobject = createObject ( 5822, -1084.52, -1634.81, 76.36 ) | ||
--We create an initial object element. I choose object model 5822 to begin with. | |||
-- | |||
setTimer ( "objectRandomization", 2500, 0 ) | |||
--Every 2.5 seconds, the function 'objectRandomization' is called by this timer. | |||
--Each time the function runs, it changes the object model by applying a new whole- | |||
--integer random object ID. This timer is called an infinite amount of times since | |||
--it's repeat value is set to 0. | |||
function objectRandomization () | |||
randomobjectnumber = randInt(1, 18000) | |||
--Choose a random number between 1 and 18000 as a whole integer and assign it to | |||
--the varible 'randomobjectnumber' | |||
setObjectModel ( myobject, randomobjectnumber ) | |||
--Change our object appearance by applying a new model ID | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Object functions}} | {{Object functions}} | ||
Revision as of 07:18, 11 April 2007
This sets a new object model to the specified element.
Syntax
bool setObjectModel ( element object, int id )
Required Arguments
Returns
Returns true if the model change was successful, false otherwise.
Example
This will continually change an object model every 2.5 seconds at the location -1084.52, -1634.81, 76.36 (Truth's farm).
myobject = createObject ( 5822, -1084.52, -1634.81, 76.36 ) --We create an initial object element. I choose object model 5822 to begin with. setTimer ( "objectRandomization", 2500, 0 ) --Every 2.5 seconds, the function 'objectRandomization' is called by this timer. --Each time the function runs, it changes the object model by applying a new whole- --integer random object ID. This timer is called an infinite amount of times since --it's repeat value is set to 0. function objectRandomization () randomobjectnumber = randInt(1, 18000) --Choose a random number between 1 and 18000 as a whole integer and assign it to --the varible 'randomobjectnumber' setObjectModel ( myobject, randomobjectnumber ) --Change our object appearance by applying a new model ID end
See Also