Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
MCW-Shrapnel

Getpos Stops working

Recommended Posts

Hi. I don't like asking for help, but i'm stuck.:confused:

I made a AI Vehicle respwawn script, it works great but.

After respawn, I can no longer track this unit using markers.

After the Respawn.

My AI vehicle, has the same name, rank and skill as it's original.

the Driver and gunner showup as it's name with the d and g attached.

And the leader shows up ok.

"RAir1M" SetMarkerPos getPos RAir1; no longer works, i've used this for a year with no problem, but my respawn script is changing something.

is there a hidden Id that stops getpos from working here.

Any Ideas.

Edited by MCW-Shrapnel
Better description

Share this post


Link to post
Share on other sites

Have you tried to delete the old RAir1 before re-spawning it?

deletevehicle  RAir1

it may also be a problem with naming, I know I've had this before.

Try respawning it with a tempory name ie temp and then give it a name.

example

pos = [(getpos gl select 0), (getpos gl select 1),(random 90)+50];  
temp = [pos,180, vtype, grp] call BIS_fnc_spawnVehicle;  
aircraft = temp select 0;

I can then use the name aircraft like any other object, without it it wouldn't respond to some commands.

Share this post


Link to post
Share on other sites

Thank's for the help.

But the problem remain. SetMarker won't take Getpos, is a better description of problem.

It's not giving the name or spawning, that's the problem. I don't think.

I can use cursorTarget on it, I get back the Name just as it should be, without an internal name like B1 -2 or something.

I Get RAir1 as unit name and RAir1d as driver ect.. and the leader info is ok.

But I can no longer use the getpos on it.

I can getPos the vehicle, and view it with hint. I see the position array.

But I can't get the marker the use the position.

Any Ideas.

Edited by MCW-Shrapnel
More info

Share this post


Link to post
Share on other sites
Thank's for the help.

But the problem remain. SetMarker won't take Getpos, is a better description of problem.

It's not giving the name or spawning, that's the problem. I don't think.

I can use cursorTarget on it, I get back the Name just as it should be, without an internal name like B1 -2 or something.

I Get RAir1 as unit name and RAir1d as driver ect.. and the leader info is ok.

But I can no longer use the getpos on it.

I can getPos the vehicle, and view it with hint. I see the position array.

But I can't get the marker the use the position.

Any Ideas.

Looking at your info it seems there is a spelling error somewhere..

for using setmarker with getpos correct spelling is:

"RAir1M" SetMarkerPos (getPos RAir1)

note the () around the getpos RAir1..

Share this post


Link to post
Share on other sites

Thank's for your help, I tried the (getPos BAir1), but that could not be the problem since it works fine until they respawn.

After respawn, they have the proper name, the proper Varname ,the proper Driver and gunner names, and the leader and group are ok.

GetPos returns an array position, just as expected. But the SetMarkerpos is unable to use it. This is the first time I have asked for help for programing in 30 years. I ask only because I spent 2 weeks checking every posibility, and come up empty.:confused:

But thank's for your input, it is very much appreciated.:)

Share this post


Link to post
Share on other sites

I just had a look at a spawn script I had and attached a marker to it and it seems to work when re-spawned.

_spawn = markerPos "ospreyspawn";

osprey = createVehicle ["MV22", _spawn, [], 100, "FLY"];
osprey setvelocity [0,0,0];

osprey  setPos [ getPos osprey select  0, getPos  osprey select  1, (getPos osprey select  2)];
osprey setdir markerdir  "ospreyspawn";

ospreygroup = createGroup WEST;
pilot = ospreygroup createUnit ["USMC_Soldier_Pilot",[0,0,30], [], 0, "FORM"];
pilot moveInDriver osprey;
copilot =  ospreygroup createUnit ["USMC_Soldier_Pilot",[0,0,30], [], 0, "FORM"];
copilot moveInDriver osprey;
ospreygroup selectLeader pilot;

_marker1 = createMarker["vehicle",getPos osprey];
"vehicle" setMarkerType "Dot";
"vehicle" setMarkerColor "ColorRed";

while {alive osprey or (getpos osprey select 2 > 5) } do
{
"vehicle" setMarkerPos getpos osprey;
sleep 0.3;
};


sleep 10;
deletemarker _marker1; 

Share this post


Link to post
Share on other sites

Thank's F2k Sel

Your script was not the solution, but it made me think of a solution.

Your script is giving the unit it's name, as it makes it.

My script is getting the name as an argument (Select 0).

I make the unit then give it a name, avoiding a script for each .

I was able to fix the problem by embeding the setmarkerpos inside the script.

now it all works fin and I don't have to use a seperate script for moving Markers.

I still don't know, why the setmarkerpos, does not work ouside my script, since my spawed unit is identical in every way.

But it's working for now .

Thank's for the help.

Edited by MCW-Shrapnel

Share this post


Link to post
Share on other sites
Sign in to follow this  

×