"Angles" is a three part number for X, Y, and Z. They can be used by asking for them by numbers 0, 1, and 2. But the numbers have to be in brackets.
[0] [1] [2]
Here is an example from a global script called "wombat_moveit"--may be easier to read if you copy it to Notepad.
Code: Select all
// Script by Wombat dpwyatt@iprimus.com.au
// A small request. If you use this script, and you like it, email me, with your gratitude ? I would love to read where my
// script is being used . Thanks. Enjoy
// Move it script, similar to a projectile, from an exploder, but allows you to set things like
// the number of frames, to animate too, the angle and position of the end result of an explosion.
// Usage:
// (Original.object) thread global/wombat_moveit.scr::moveit (script_origin) (path of destroyed model) (number of frames)(bomb emitter)(effect)
// for example:
// 1. Set up a script_model of your truck/tank etc
// Set angles [key] and X Y Z [value] to the starting position.
// Set a targetname (garage_truck)
// 2. Set up a script_origin
// Set a targetname (garage_truck_moveto)
// Set the angles to the position you want the model to be in finished position
//
// This is best done by another script_model set to the destroyed position, and model. Make note of the origin value,
// This model has served its purpose, so delete it
// Position the script_origin at the recorded origin coords. ( I found I had to move it there physically, so to speak
// as setting it in the origin [key] of the script_origin didn't work).
// From the thread that is called to trigger the event, whether that be a damage trigger, or bomb etc.
// call the global/wombat_moveit.scr::moveit script
// eg: $garage_truck thread global/wombat_moveit.scr::moveit $garage_truck_moveto vehicles/opeltruck_d.tik 25
// This will give the script the start position, and angles, the end position, and angles. The destroyed model to display,
// and the number of frames to animate to ( each frame 0.02 sec). Animation takes three seconds, so the number of frames is (3/0.02) or
// 150 frames.. The change in angle, and change in position, is divide by the number of frames for a smooth animation.....
// If this is a multi part move then use a thread to run the wombat_moveit script and use waitthread instead of thread, using
// script_origins, strung together, to form a path.
// ie :
// thread garage_truckmove // call this thread to allow the called thread to continue running
// // use for more than one path objected truck ( a convoy ?? )
// ........
// garage_truckmove:
// $garage_truck waitthread global/wombat_moveit.scr::moveit $garage_truck_moveto vehicles/opeltruck_d.tik 25
// // wait until first move finished , then set to next target
// $garage_truck waitthread global/wombat_moveit.scr::moveit $garage_truck_moveto2 vehicles/opeltruck_d.tik 40
// // still waiting, truck moving slower though [( more frames = slower ) over the same distance]
// $garage_truck thread global/wombat_moveit.scr::moveit $garage_truck_movetoEND vehicles/opeltruck_d.tik 25
// // just go and end the thread
// end
// My script follows
moveit local.moveto local.endmodel local.framenumber: // local variables
// means you can call the script more than once ( 2 or 3 trucks at once )
local.start1x = self.angles[0] // the x part of the angles array
local.start1y = self.angles[1] // y etc
local.start1z = self.angles[2]
local.movex = local.moveto.angles[0] - local.start1x // change this much per frame ( x )
local.movey = local.moveto.angles[1] - local.start1y // y etc
local.movez = local.moveto.angles[2] - local.start1z
if ( local.movex >180 ) {local.movex -= 360 } // go the short way
if ( local.movey >180 ) {local.movey -= 360 }
if ( local.movez >180 ) {local.movez -= 360 }
//println local.movex " , " local.movey " , " local.movez //debugging
local.movex = local.movex / local.framenumber
local.movey = local.movey / local.framenumber
local.movez = local.movez / local.framenumber
//println local.movex " , " local.movey " , " local.movez //debugging
self model local.endmodel // change the model
local.vec = local.moveto.origin - self.origin // create a vector for the origin manipulations
local.vec[0] = local.vec[0] / local.framenumber // divide the vector by #frames (x)
local.vec[1] = local.vec[1] / local.framenumber // y etc
local.vec[2] = local.vec[2] / local.framenumber
for (local.i=1;local.i<=local.framenumber;local.i++){ // loop for this number of frames
local.start1x += local.movex // reads start1x = start1x + movex
local.start1y += local.movey
local.start1z += local.movez
if (local.start1z <0 ){local.start1z += 360} // if angle goes negative then make it positive again
self.angles = (local.start1x local.start1y local.start1z) // set the new angles of the script_model
//println self.origin // debugging
//println local.vec
self.origin += local.vec // add the vector to the origin
//println local.start1x "," local.start1y "," local.start1z
wait .02
}
end
Hope that helps--don't ask me how it works, ha ha.
Your images are probably not working in the forum because they are bmp format.