Jump to content
Sign in to follow this  
Skelt

deletevehicle on 1 of 100+ identical objects

Recommended Posts

I currently have a script running for a survival mission I'm making that allows the player to pick up water, carry it with them until they need it, then drop it, and "consume" it. Which works perfectly if it's just one item because I can name it. But I have hundreds. These items are scattered everywhere, so naming, and calling a script for each one is pretty much impossible.

Item Init:

this addaction ["Consume Hydration Pack","scripts\water.sqf"];

water.sqf

if (not((_this select 1)==player)) exitwith {}; 
thirst=thirst-2.5;
hint format['%1 You drink the water you've found: dehydration -25%',_this select 1];
if (thirst<0) then {thirst=0;};
[color="Red"]execVM "scripts\drink_water.sqf";[/color]

drink_water.sqf

I've used many versions of delete vehicle and I can't get it to work. Any help would be very much appreciated. Thanks

Share this post


Link to post
Share on other sites

What object are you using to simulate the hydration pack? Are they preplaced in the editor?

Share this post


Link to post
Share on other sites

yes that is correct, using editor placed "empty" objects. If I name it: water_1 then call delete vehicle on that object, works perfect, but as mentioned, I have hundreds of these objects, so I would have to redefine the script(s) each time they were called haha.

(They are the ACE hydration backpacks btw.)

Thx for your reply**

Edited by Skelt

Share this post


Link to post
Share on other sites

Yeah I thought about using that, but for some reason refrained from trying it due to some strange feeling it would delete something else I wasn't intending, which is also in close range. But I see how I would define the class name so I wouldn't have to worry about that.

My next issue with that, is finding the class name for the hydration pack, I believe the backpacks are from a mod daveygarys Rangers with ESS Tactical Sunglasses and backpacks <-- armaholic. The mod itself came with pbo only, where do I look when I crack the pbo, to find the class names? Or perhaps these small hydration packs are part of ACE? I'm not sure, I haven't used ACE in well over a year. Suppose I'll dig around anyways,

Thanks very much Riouken**

Share this post


Link to post
Share on other sites

work smarter not harder:

Place one of the packs down in the editor, in the init of the object paste this:

myclass = typeOf this; hint format ["The class name is: %1",myclass];copyToClipboard myclass;

This will get the classname, hint it to you, then copy it to the clipboard so you can paste it as needed.

Edited by Riouken

Share this post


Link to post
Share on other sites

To find the classname just place a hydration pack in the editor, save the mission and look into the mission.sqm file with notepad.

Share this post


Link to post
Share on other sites

Well... those are most definitely a lot faster than what I was going to do. Thank you both for saving my time, and possible frustration. ( I just ran up to the store real fast I would of been ripping it apart as you guys posted haha)

This should pretty much wrap things up here, if not, you'll be hearing back from me today.

Thanks again, you guy's help is very much appreciated.

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  

×