Jump to content
Sign in to follow this  
csj

Problem with positioning

Recommended Posts

With the object i am working on none of the destruct types suit the vehicle when killed.

So when killed I delete the dead vehicle and replace with destroyed version.

The problem is when the exchange takes place the replacement 'destroyed version' is always placed about 3 to 4 meters east of the last position of the origional killed vehicle.

This happens either if the vehicle was moving or stationary at the time of being destroyed.

This section is in loop

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_posX = (getPos _vehicle) select 0;

_posY = (getPos _vehicle) select 1;

_vehicleDir = direction _vehicle

Then when vehicle is destroyed we go to this section

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

deadvehicle = "Deadvehicle" createVehicle [_posX, _posY, 0];

deadvehicle setDir _vehicleDir

deleteVehicle _vehicle

exit

Can someone help with this?

Thanks

Share this post


Link to post
Share on other sites

Unfortunately it hasn't mad any difference to the end result.

sad_o.gif

Share this post


Link to post
Share on other sites

What's the destroyed version defined as in CfgVehicles? If

it's a static, they sometimes get 'moved around' by

createvehicle. Two ways to fix it:

1) Adjust the x,y you use in createvehicle, taking into account

the direction.

2) Move the model in O2 so that it's positioned 'correctly'

away from the (0,0,0) origin.

Share this post


Link to post
Share on other sites

Thanks Footmunch

The destroyed version is car class same as other.

I set the _posX to _posX+3 to compensate for diff but this seemed to effect outcome in other ways.

Will check again in O2 for be centre. I usually centre all when

making stuff.

When I run script from in editor it works pretty good but when running it from pbo it doesn't. Maybe its just my slow PC that is playing silly buggers with it.

Share this post


Link to post
Share on other sites

Maybe it can be of some help for you :

The DKMM Mi28 use a ruined model to replace the actual model when it is destroyed.

In the vehicle definition is launched by this eventhandler

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Killed="[_this select 0, 0] exec ""\dkmm_mi28_controls\scripts\dkmm_downer.sqs""";

};

then the scripts "dkmm_downer" is this one

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? format ["%1", DKMM_Mi28_crash] == "true" : exit

_chopper = _this select 0

_crew = crew _chopper

? getpos _chopper select 2 >= 2 : goto "wait"

#go

_s = "DKMM_Mi28_crashsound" createvehicle getpos _chopper

_s setdammage 1

DKMM_Mi28_crash = true

_dir = getdir _chopper

_chopper setpos [getpos _chopper select 0, getpos _chopper select 1, 10]

? typeof _chopper == "DKMM_Mi28_N" : _t = "DKMM_Mi28_N_wreck", _w = "DKMM_mi28_cw3", goto "set"

? typeof _chopper == "DKMM_Mi28_NG" : _t = "DKMM_Mi28_N_wreck", _w = "DKMM_mi28_cw2", goto "set"

? typeof _chopper == "DKMM_Mi28_NAA" : _t = "DKMM_Mi28_N_wreck", _w = "DKMM_mi28_cw5", goto "set"

? typeof _chopper == "DKMM_Mi28_A" : _t = "DKMM_Mi28_A_wreck", _w = "DKMM_mi28_cw4", goto "set"

? typeof _chopper == "DKMM_Mi28_AB" : _t = "DKMM_Mi28_A_wreck", _w = "DKMM_mi28_cw1"

#set

_t = _t createvehicle getpos _chopper

_w = _w createvehicle getpos _chopper

~0.05

_t setdir _dir

_w setdir (_dir + 180)

_pos = [(getpos _t select 0), (getpos _t select 1), 0]

_w setpos _pos

_i = 0

"unassignvehicle _x, _x setpos [getpos _chopper select 0,getpos _chopper select 1,10 + _i], _i = _i + 1" foreach _crew

~0.5

"_x assignascargo _t, _x moveincargo _t" foreach _crew

? count _crew == 3 : (_crew select 2) setdammage 1

? count _crew == 4 : (_crew select 2) setdammage 1, (_crew select 3) setdammage 1

? _this select 1 == 0 : "_x setdammage 1" foreach _crew

?player in _crew : cuttext ["", "BLACK IN", 0.5]

_chopper setpos [0,0,0]

DKMM_Mi28_crash = false

exit

#wait

@getpos _chopper select 2 < 2

goto "go"

Share this post


Link to post
Share on other sites

Thanks all

I will try and let you know how it goes.  smile_o.gif

-------

Ok started with the shortest method first and that hit the nail on the head so I will leave it at that.

Thanks again all for replies. biggrin_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×