VictorFarbau 0 Posted September 10, 2007 Howdy, I wonder if anybody has a clue. I wanted my group to be able to detect satchel charges placed by friendly or enemy troops. All my attempts using "nearObjects" and the like were in vain. Once placed the charges are only recognized as "dummyWeapon.p3d" object using the "near" commands. I placed some grenades and magazines on the ground too - and they're also being put into the list as "dummyWeapon.p3d" objects. Is there any scripting way known to check for the presence of any defined weapons / magazines lying on the ground? Btw - I could command my men to pickup that stuff from the ground one by one, so the engine knows very well about the presence and nature of these. Seems I am just using the wrong commands to identify them somehow. Thanks, VictorFarbau Share this post Link to post Share on other sites
VictorFarbau 0 Posted September 10, 2007 Darn - this ended in the wrong board, please move to Mission Editing and Scripting. Thanks! Share this post Link to post Share on other sites
chops 111 Posted September 11, 2007 Have you tried using the "fired" eventhandler? Share this post Link to post Share on other sites
SoldierIsNotHistory 0 Posted September 11, 2007 Satchel seems to have some bugs. For example, using self made satchel 3d in the engine is not fully supported by the game, who seems to have hard coded things which refer to BI satchel. Placing custom charge Disarming charge Hop, you haven't anymore your custom one, but BI satchel What I mean is maybe engine is able to retrieve satchel using hard coded stuff, and so we can't do anything But, if it's simple "dummyWeapon.p3d", maybe you have to look what kind of magazine have on it, and read special stuff in CPP using ArmA command able to read in CPP. Share this post Link to post Share on other sites
sickboy 13 Posted September 11, 2007 dummyWeapon.. hmm, are they not weapon/mag holders like when you put weapons on the ground etc? In that aspect, it might be possible to read the 'content' of that holder. Haven't tested nor researched. Share this post Link to post Share on other sites
fasad 1 Posted September 11, 2007 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">getpos player nearestObject "timebomb" or <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">getpos player nearestObject "pipebomb" return a satchel. Share this post Link to post Share on other sites
VictorFarbau 0 Posted September 11, 2007 @fasad - these statements return a <NULL-object>. I believe satchel charges can only be detected as such when armed. In that case the nearestObject function works. But if you just dump them onto the ground they also become a "dummyweapon.p3d" object like any other weapon or magazine you place using the inventory function. I will try some of the above suggestions and report back. Thanks, VictorFarbau Share this post Link to post Share on other sites
fasad 1 Posted September 11, 2007 They work for me, but the player may need to be quite close to the satchel. I was intending to show satchels can be found using the near* commands using the "pipebomb" and/or "timebomb" classnames rather than providing a working solution Share this post Link to post Share on other sites
VictorFarbau 0 Posted September 11, 2007 Hold it Fasad, from the picture I can see that you placed (and armed) your Pipebomb there. If you now just enter your inventory and drop a Pipebomb next to it then you will find that they even look different. The armed Pipebomb is green satchel - the same dropped from inventory will be a smaller brown satchel. Difference: you can detect the armed charges with "nearObjects", the same won't work on the inventory items. Do we agree on that? I have a hunch what the problem could be - have a look at this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nearestObjects [player, [], 15] Result: [5630: cl_feathers2.p3d,dude,ammobox,5167: <no shape>] Ok, so let's look for that "ammobox" that is being detected: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(getpos player) nearObjects ["ammobox",20] Result: [] Yeah, why would it be so easy? Let's try this (picked this from the CfgVehicles class names): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(getpos player) nearObjects ["ammoboxWest",20] Result: [ammobox] Is it that the nearObject queries return object names whereas I need to know the exact object model class name ? This is really an obstacle since I haven't found a complete list of all objects and their related class names yet (including magazines, weapons, pipebombs etcpp). VictorFarbau PS: The "ammobox" is a real ammobox I placed there for testing. Share this post Link to post Share on other sites
fasad 1 Posted September 11, 2007 Okay, so you want to be able to find satchels dropped on the ground, rather than placed (by action)? I misinterpreted your question. I'll do some testing... Share this post Link to post Share on other sites
VictorFarbau 0 Posted September 11, 2007 Exactly Fasad. In fact I want to be able to detect any weapons and ammo lying around. I made some progress: each item you place onto the ground from your inventory is being wrapped into a "WeaponHolder" object and can be detected by the nearObject functions. The funny thing is that even opening your inventory creates a weaponholder. So if you place one charge and you inventory window is still open you can see already 2 weaponholder objects. Weird stuff, this Arma engine. Anyways, what's missing now is how to access the inventory of a Weaponholder. The only thing I found so far was a request for exactly this on the ArmA Wishlist Quote[/b] ]Access to MagazineCargo/WeaponCargo as an array of the magazines and weapons in a cargospace or weaponholder. Bedges 23:38, 7 December 2006 (CET) I wonder if this has been implemented already The "weapons" and "magazines" commands return [] when used on the WeaponHolder. Cheers, VictorFarbau Share this post Link to post Share on other sites
fasad 1 Posted September 11, 2007 Hmm, yes the WeaponHolder class object seems to be treated as a temporary vehicle/ammo crate that disappears when empty - it can use the addWeaponCargo etc commands. Unfortunately AFAIK there is no real way to check the weapons cargo of a vehicle or crate. edit: It might be possible (however unsensible) to check if a satchel is in a weaponHolder using a brute force check: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">unit action ["TAKEMAGAZINE", weaponHolderObject, "pipebomb"] if (count magazines unit > 0) then {weaponHolderObjectHasSatchel = true} unit action ["DROPMAGAZINE", weaponHolderObject, "pipebomb"] The actions take a little bit of time. unit can be anywhere in the game world (maybe even a gamelogic???) the weaponHolderObject stays in existance (although it breifly disappears visually) during the check. You could have the unit add before, then remove after some ammo to the weaponholder to maintain it's visual form. Share this post Link to post Share on other sites