Jump to content

Recommended Posts

Posted

Given the name of a trigger zone how do you get the position?

 

If my variable _aaaZone contains the name of the zone then is it:

 

local _zonepos = {x=_aaaZone.point.x, y=_aaaZone.point.y, z=_aaaZone.point.z}

 

?

 

Passing this and the targets current position to get3DDist fails with the error that I'm trying to an arithmetic operation on a nil value in x.

 

Code snippet below:

 

local _zonepos = {x=_aaaZone.point.x, y=_aaaZone.point.y, z=_aaaZone.point.z}

local _curpos = {x=_targetpos.x, y=_targetpos.y, z=_targetpos.z}

local _range = mist.utils.get3DDist(_curpos, _zonepos)

 

What's my dumb mistake please someone as I can't see it for the life of me. (With a bit of hindsight now I think I probably don't need _curpos and could probably just pass _targetpos which has been populated with inZoneUnits:getPosition().p)

 

Thanks,

Stonehouse

Posted

I might be wrong, but If I remember correctly zones has a Vec2 coordinate system in use.

 

So, maybe, it could be:

 

local _zonepos = {x=_aaaZone.pos.x, y= 0, z=_aaaZone.pos.y}

 

if you need the point on the ground you may use land.getHeight function passing the same x and y variable of the zone.

 

Sorry if I'm wrong, can't check before a couple of days...

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted

Found this by searching in this forum -

 

function SignalTarget()
   Aimpoint = trigger.misc.getZone(target2)
   Aimpointpos = {}
   Aimpointposx = Aimpoint.point.x 
   Aimpointposz = Aimpoint.point.z
   Aimpointposy = land.getHeight({x = Aimpoint.point.x, y = Aimpoint.point.z})
   Aimpt3 = {x=Aimpointposx, y=Aimpointposy, z=Aimpointposz}
   trigger.action.smoke({x=Aimpointposx, y=Aimpointposy, z=Aimpointposz}, trigger.smokeColor.Red, 0)
   return timer.getTime() + 5
end

 

Code by SNAFU.

Posted
...must be tired missing that zones are vec2 not vec3...

 

Not sure: Xcom posted a code that refers to a vec3, and use point instead of pos. I can check this evening if you need.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Posted

Thanks Chromium, but it is vec 2 with land height giving the 3rd dimension and point appears to work ok. Anyway getting past that section of code now with people's help from this thread and getting stuck on some table issues lol.

Posted

Lua scripting for us newbie or not programmers is a mined field almost. But when you start to sede results... It's really fantastic

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

  • Recently Browsing   0 members

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