james23222000 Posted October 9, 2008 Report Share Posted October 9, 2008 I was just wondering, what do the following lines of script do:Math::EulerToMatrix(0.f, 0.f, 0.f, ident);Math::MultiplyMatrices();Also, on thing I am gonfused about is when to use a '.' or an '->' in a script.e.gv->PushActionWait(ACTION_APPEND, 6.0f);v.PushActionWait(ACTION_APPEND, 6.0f);RegardsJames Quote Link to comment Share on other sites More sharing options...
Hoppah Posted October 10, 2008 Report Share Posted October 10, 2008 I was just wondering, what do the following lines of script do:Math::EulerToMatrix(0.f, 0.f, 0.f, ident);Math::MultiplyMatrices();Kinda hard to explain as I don't know what each line exactly does.But I can explain how to use it and what the whole code together does.You have x, y and z axes, right? z-axis is always up/down and not really important for now.Look at my awesome sketch:You have these axes on the maps (=red), but vehicles have them too (in green)!When you use the following code to get the position which should be based on the axes your vehicle (the caller) the game will use the MAP-axes to place it.Vehicle v(Caller);Vector NEWPOS = v.GetPosition() + Vector(400.f, 0.f, 0.f);A vector is an x,y,z position. In this case the NEWPOS is the position of the Caller + 400 on the x-axis of the MAP.This means you can never put on object directly in front of a vehicle with a code like this, because the NEWPOS is not on the x-axis of the vehicle.This code however, makes it possible to get a new vector based on the axes of the vehicle and not the map:Vehicle v(Caller);Vector NEWPOS = v.GetPosition(); float r[9]; float childr[9];v.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);float dx = 400.f, dy = 0.f, dz = 0.f;Math::RotateVector(dx, dy, dz, r);Math::EulerToMatrix(0.0f, 0.f, 0.f, childr);Math::MultiplyMatrices(childr, r);NEWPOS = NEWPOS + Vector(dx, dy, 0);-------------------------------------------------------------------Also, on thing I am gonfused about is when to use a '.' or an '->' in a script.e.gv->PushActionWait(ACTION_APPEND, 6.0f);v.PushActionWait(ACTION_APPEND, 6.0f);RegardsJamesIn simple words a '->' means the object is a variable. It's not defined (yet). Example:Caller->PushActionWait(ACTION_NEWLIST, 1.0f);The Caller in this example might be everything. From a vehicle to a person or even a particle.PushAction codes usually work well with variables.A '->' doesn't really work with codes that are bound to a specific object type. For exampleCaller->GetHealth();The above won't work, because that code can only be used with objects defined as persons (vehicles don't have health lol). So this would be necessary for example:Person p(Caller);p.GetHealth();I hope this makes it more clear for you,Hoppah Quote Link to comment Share on other sites More sharing options...
james23222000 Posted October 11, 2008 Author Report Share Posted October 11, 2008 Thanks Hoppah ,Just one last simple question, what is the difference between a single timer and an interval timer in mission scripts?RegardsJames Quote Link to comment Share on other sites More sharing options...
Hoppah Posted October 11, 2008 Report Share Posted October 11, 2008 Thanks Hoppah ,Just one last simple question, what is the difference between a single timer and an interval timer in mission scripts?RegardsJamesSingle timer ends, interval is a 'looped' timer.For example:Mission::StartSingleTimer("Timer1", 60.f);Mission::StartIntervalTimer("Timer1", 60.f);60.f is the time in seconds. After 60 seconds the SingleTimer stops, but the IntervalTimer starts again.This way you can make a code that checks something each minute. Timers only work in missionscripts ofcourse.Use the following OnTimer code for the timer results, like this:void OnTimer(const char* timer_, float time_){ switch(timer_) { case "Timer1": { Mission::PlayHint("Timer test"); } break; }}Using the SingleTimer will play this hint after 60 seconds.IntervalTimer will play it every 60 seconds until you stop the timer. Hoppah Quote Link to comment Share on other sites More sharing options...
james23222000 Posted October 11, 2008 Author Report Share Posted October 11, 2008 Single timer ends, interval is a 'looped' timer.Thanks Hoppah Quote Link to comment Share on other sites More sharing options...