Jump to content

Recommended Posts

Posted (edited)

I'm getting into mission building using scripts and have made some good progress.

Now I want to get a unit's speed and I am unsure about how to do that.

 

Using my somewhat rusty bits of math, I would go with something like:

speed = Object.getVelocity(unit)
speed = math.sqrt(speed.x^2 + speed.y^2 + speed.z^2)

 

Is that correct? If not, how does it work?

 

And on this note: Thanks to Grimes and Speed for their contribution with MIST and Slmod and the scripting documentation on the wiki! :thumbup:

 

Edit: Another question that came up:

I want to build an event handler, that reacts to pilot ejections. The function is properly called with event.id == world.event.S_EVENT_PILOT_DEAD, but I can't seem to get the unit that ejected.

I've tried event.initiator, event.target, and event.place, but they're all set to nil. Any way to do that?

Edited by St3v3f

aka: Baron

[sIGPIC][/sIGPIC]

  • 7 years later...
Posted

Not directly, no. Currently almost all accessors to a Unit are getters only, and we can only set (change) very things once a unit is added to the mission. 

  • 2 years later...
  • Recently Browsing   0 members

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