Jump to content
Sign in to follow this  
nuxil

iskindof bugged ?

Recommended Posts

Iskindof tank dosent seams to work,. it works on air & ship.

cant get it to work on tank.

did this change in arma2 ?

i made a little test script

if (vehicle this isKindOf  "Tank") then {hint "yes";};

i put this test script on a tank it dosent hint yes to me..

strange..

so i named the tank "TANK"

and ran 2nd test script. it returns yes.

if (vehicle TANK isKindOf  "Tank") then {hint "yes";};

whats up with iskindof command ? anyone else have this issue?

Edited by nuxil

Share this post


Link to post
Share on other sites

Was the tank named something before?

I seem to recall my scripts being wonky on "this" if the unit isnt named.

Share this post


Link to post
Share on other sites

1 st test i didnt name the tank..in 2nd test i named the tank "TANK"

Share this post


Link to post
Share on other sites

Yes well I mean did you use:

if (vehicle this isKindOf  "Tank") then {hint "yes";};

With the unit named "tank"?

Share this post


Link to post
Share on other sites

no no.. isee why you got confused.

as i said in 1st test no name set. in 2nd test the name was TANK.

even tho if i named the tank.. TANK .. this should refere to the object. so its strange,

try to run my 2 examples., no name set in 1st and TANK as the name in 2nd test.

EDIT:



sleep 2;
if ((typeof vehicle this) isKindOf 'LandVehicle') then 
{
hint "Ok1";
}else{
hint "no1";
};

sleep 2;


if ((vehicle this) isKindOf 'LandVehicle') then 
{
hint "Ok2";
}else{
hint "no2";
};

sleep 2;

if ((vehicle TANK) isKindOf 'LandVehicle') then 
{
hint "Ok3";
}else{
hint "no3";
};

sleep 2;
hint "done testing"

if you run this.. the only time it hints out OkX is when the tank name is TANK. "ok3"

i used LandVehicle here, bit that should not matter as its the base config for tank.

Edited by nuxil

Share this post


Link to post
Share on other sites

im surprised the first reply wasnt "what's kind of bugged?" >.> ha, haha? yea little bored.

anyway, I think what Murk is trying to say, is just give your vehicle a name and it should work. there are some commands that dont appreciate being used with "this", but much prefer and work more reliably if you name the unit and call on it by its name rather than "this".

Not saying you have to name the tank "TANK"... you could name it "Beavis" and it wouldnt make a difference, so long as it is named.

Share this post


Link to post
Share on other sites

well so its bugged.

this will cause problems since then you need to name every tank of the map..

example you want to use nearestObjects [_pos,["AIR","LANDVEHICLES"],_range]

then you want to check the entire list for tanks beceause you want to do something on each tank,, this will give you a headic if you dont name the tanks then,, this also mean you need to name the tanks if some respawn script is in use for vehicles,

bummer :(

Share this post


Link to post
Share on other sites

I dont really see why nearestObjects would be an issue with this. If you want to check the list, you use forEach which will step through the array regardless of the unit having a name or not. You wont even use "this".

Share this post


Link to post
Share on other sites
I dont really see why nearestObjects would be an issue with this

because you didnt even try it..

the problem is with the iskindof command. how you step trough the list has nothing to do with the case.. using for,while or foreach. it dosent matter.

while {true} do
{
   _list = nearestObjects [position player,["air",landvehicles"],100];
   {
          if  (vehicle _x iskindof  "TANK") then {hint "tank  in 100 meter of you";};
   } foreach _list;
   sleep 3;
};

this example will not hint when a tank is 100 m of your pos.

if you replace tank with air it works,

altho with nearestObjects you can spesify tank as its search.but why have 2 nearestObjects commands running, one for all but tank and one dedicated for tanks..

hope you see the issue now

Share this post


Link to post
Share on other sites

I've used it extensively these past 2 days, and it's fine.

are you confusing this with _this?

Share this post


Link to post
Share on other sites
_list = nearestObjects [position player,["air",landvehicles"],100];

this example will not hint when a tank is 100 m of your pos.

There's a " missing in front of landVehicles.

Share this post


Link to post
Share on other sites

Indeed. It didnt even spit out an error message. This might work better...

while {true} do
{
   _list = nearestObjects [player,["LandVehicle"],100];
   {
         if  (_x iskindof "Tank") then { hint "tank within 100 meters of you"; };
   } foreach _list;
   sleep 3;
};

Share this post


Link to post
Share on other sites

:couch:

landvehicles suppose to be landvehicle

had a typo i my script

Edited by nuxil

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  

×