Stoll

[SOLVED] Deleting gear of AI

6 posts in this topic

Posted (edited)

Let's say I spawned 7 AI with predefined gear and I want all gear deleted when the AI died.
So I would use:

	removeHeadgear _unit;
	removeallweapons _unit;
	removeallassigneditems _unit;
	removeAllItemsWithMagazines _unit;
	removeGoggles _unit;
	removeuniform _unit;
	removevest _unit;
	removebackpack _unit;	

But how do I prompt it?
Something with

if (!alive _unit) exitWith {};

?
I tried some things and refered to other scripts but didn't find a solution.
My scripting knowledge seems to be still low, but I'm eager to learn more. :)

 

Edited by Stoll

Share this post


Link to post
Share on other sites
Advertisement

Before I posted my question here I had a look at DMS.
Guess it's the fn_OnKilled.sqf. I found some code in there, but I have no clue how I could use it.
I did some research and stitched together some code that of course isn't working.
Maybe I'm on the right way with that?

private _removeAll =
{
		removeHeadgear _unit;
		removeallweapons _unit;
		removeallassigneditems _unit;
		removeAllItemsWithMagazines _unit;
		removeGoggles _unit;
		removeuniform _unit;
		removevest _unit;
		removebackpack _unit;
};
	
_unit addMPEventHandler ["Dead", {if (lifeState _unit == "DEAD") then _removeAll};];	


 

Share this post


Link to post
Share on other sites

Posted (edited)

Solved the problem myself this time with

setVehicleLock "LOCKED";

:)

Edited by Stoll

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.