Jump to content
Sign in to follow this  
ViciousViper

Check if th unit is a player

Recommended Posts

Hello there, Scripters!

i have got a Problem with my mission.

My mission is a Survival mission.

The mission has AI controllable player slots, which moves with waypoints.

Anyway,i want to let dead AI bodies dissapear, but the ai should respawn after this ( Deletevehicle willl destroy the Ai), but, if the unit is a player, the Corpse shouldnt despawn / disappear.

For an Example, if the Unit is killed, which is not an AI, the corpse of it shouldnt despawn, but if the killed unit is an AI, it should disappear.

Well, since i tried some scripts, which removes every type of dead bodies (AI and not AI), i was thinking about asking here.

My script:

if (isPlayer _this) then

{

Dont hide the corpse.

};

else

{

Hide the corpse of the Ai.

};

IF anyone knows the solution of this, please just post it below.

Yours Faithfully, ViciousViper.

---------- Post added at 18:27 ---------- Previous post was at 18:02 ----------

Oh, yeah, my current script thingy looks like this:

if (isPlayer _this) then

{

/anything else.

};

else

{

hidebody _this;

};

Share this post


Link to post
Share on other sites

really no need to write your own "remove dead script" unless you REALLY need something very specific to your needs.

this is just 1 of many when doing a search on here. http://forums.bistudio.com/showthread.php?113434-CLY-Remove-Dead-script&highlight=execvm+after+respawn

this option is in script: Prevent an individual unit from being removed: this setVariable ["CLY_removedead",false,true]

so in your init.sqf (so every player runs it) put

player setVariable ["CLY_removedead",false,true]

when players respawn you'll have to issue that again to them. maybe use "MPRespawn EventHandler" for that.

Edited by Nimrod_Z

Share this post


Link to post
Share on other sites

Well, thats not what i want.

I want to let AI Corpses despawn and the Player corpses shouldnt despawn.

Another example ~.~: Ai got killed = AI Corpse is despawning.

Player got killed, Corpse ist despawning.

Share this post


Link to post
Share on other sites

did you even look at the script ? clearly has those options..

Share this post


Link to post
Share on other sites

I did, but im not an expert in scripiting and i dont really know Where the option is, to despawn only AI cropses

Share this post


Link to post
Share on other sites

it's ok.. running the script effects every unit. so unless u use what I prev posted above all units will eventually be removed. you can choose who NOT to be removed and how long before units are removed (if allowed). just read the very top and he describes the uses and gives examples. up until a few months ago the guy that wrote the script WAS a BI Developer and I've used it in several missions.

Share this post


Link to post
Share on other sites

Well, this will work if the unit is only able to controlled by an AI or a player, but in my mission, every unit can be played as player or can be played by an AI.

( in the description.ext disabledAi is 0.)

Share this post


Link to post
Share on other sites

Okay i tried it with the Cly script, but i cant get it to work.. Can you create an example for me? This would be very nice (:

Share this post


Link to post
Share on other sites
Well, this will work if the unit is only able to controlled by an AI or a player, but in my mission, every unit can be played as player or can be played by an AI.

( in the description.ext disabledAi is 0.)

I think your a little confused bud, units can ONLY be AI or a PLAYER. a unit has to be set to "playable" in order for a player to be able to use it. if the unit is NOT set to playable then it CAN NOT be used by a player. a player can take control of any playable unit at anytime during the game (like join in progress players) now that former AI is now a player. when a player leaves the game that unit now is NOT a player but still playable AI.

so, if you use the example I posted (2nd post) everything will work fine for you. note the variable in the example is "PLAYER". so only a unit that is actually a player will not delete like you requested. all other NON players (AI) even if they are playable units WILL be removed. and remember a player is only a player when another person has control over it. if a player leaves the game or is no longer playing as that unit, that unit is no longer "PLAYER"..

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  

×