corralesid 12 Posted April 3, 2020 Looks like: Quote array_a = [222cf56b580# 21321: a_castle_bergfrit_dam.p3d]; //the object is a castle tower, a static object of the map . array_b = [128350: butterfly.p3d,2218894f580# 128272: dummyweapon.p3d,R Alpha 1-1:2]; //"whatever: say length of 20 objects!"; How can i find an element of array_a on array_b and substract it if it's there? I know the example is false cause no element of a in b; now, suppose there is an element of a in b, how can i make an object query? no valid "select" cause i don't know the position of the element in the array, i mean i want it to be dynamically. Also, how can i get operations with objects when called from this kind of namespace in regard to arrays, like adding array_a in array_b, etc. A quick method i'm thinking right know for my mission (but a lot of code awf....) is to make _x = var foreach element, but a lot of resources apply to this method also. Thnks guys. Share this post Link to post Share on other sites
corralesid 12 Posted April 3, 2020 ok i don't know what i was doing in editor. At least i was able to basic math now. array_a - array_b will do the trick. But i'm still stuck. aray_a and array_b were a reslut of nearestobject fnc, and there's no problem to do math with them, but as soon as i invent an array, lets say array_C = [R Alpha 1-1:6,R Alpha 1-1:4] i can't do operation with it, why?? i mean i cant even create this kind of array cause there's space between characters. Share this post Link to post Share on other sites
Leopard20 813 Posted April 4, 2020 Because that array you wrote makes no sense. If you want to put objects in an array, use the object itself, not its name (R Alpha... is not an object, it's a meaningless expression). If you want to use names, you should give them a variable name (using setVarName or by editing their properties in editor) Share this post Link to post Share on other sites
corralesid 12 Posted April 5, 2020 On 4/4/2020 at 8:27 AM, Leopard20 said: Because that array you wrote makes no sense. If you want to put objects in an array, use the object itself, not its name (R Alpha... is not an object, it's a meaningless expression). If you want to use names, you should give them a variable name (using setVarName or by editing their properties in editor) Are static objects on the map. So i guess i need to reach the function setting variables, is what you mean? such like: for "_i" from 0 to 4 {(format ["var_%1",_i]) = array_a select _i}; ?? Share this post Link to post Share on other sites
Leopard20 813 Posted April 5, 2020 7 minutes ago, corralesid said: Are static objects on the map. So i guess i need to reach the function setting variables, is what you mean? such like: for "_i" from 0 to 4 {(format ["var_%1",_i]) = array_a select _i}; ?? I'm saying don't use strings instead of objects. Read about variable types here:https://community.bistudio.com/wiki/Data_Types#Available_Types What are you even trying to do? Share this post Link to post Share on other sites
corralesid 12 Posted April 5, 2020 Just now, Leopard20 said: I'm saying don't use strings instead of objects. Read about variable types here:https://community.bistudio.com/wiki/Data_Types#Available_Types What are you even trying to do? Well, i striked a V2 rocket in a castle near allies positions, since this mod only powers a v2 rocket as a mortar cartridge i wanted to amplified the damage of the nearest objects in an extended radius of 100 for infantry and 20 for vehicles, i have no problem with this part, but the tower castle seems to me unrealistic to be destroyed by the v2, so thats it... im trying to substract the element (tower) from the array, Yes by the method i'm doing it i can know the index of this object in the array wich will be 4 (so select 3), but i was wondering if i wanted to export this in another mision or whatever, what if i can make an object undestructable by the rocket, if it is (an object) placed i know i will put it a var name but what about an static object as in the tower that i only wanted to work as a mortar boom that dammage that object but dosen't kill it or totally ruined. When the v2 strikes the ground not via script it causes a more realistic dammage since is 10mts far more than the radius mentioned, the effect is that one side of the wall is falling down but the tower still stands, when i do via scripting it crumbles complete. So that will be my complete question, how can i work with stinged arrays involved objects, cause the function nearestobjects is what returns you, an array of objects but with strings, and i know i cant parse toObject XD.. so.. or an aletrnative solution? Share this post Link to post Share on other sites
corralesid 12 Posted April 5, 2020 Just now, corralesid said: Well, i striked a V2 rocket in a castle near allies positions, since this mod only powers a v2 rocket as a mortar cartridge i wanted to amplified the damage of the nearest objects in an extended radius of 100 for infantry and 20 for vehicles, i have no problem with this part, but the tower castle seems to me unrealistic to be destroyed by the v2, so thats it... im trying to substract the element (tower) from the array, Yes by the method i'm doing it i can know the index of this object in the array wich will be 4 (so select 3), but i was wondering if i wanted to export this in another mision or whatever, what if i can make an object undestructable by the rocket, if it is (an object) placed i know i will put it a var name but what about an static object as in the tower that i only wanted to work as a mortar boom that dammage that object but dosen't kill it or totally ruined. When the v2 strikes the ground not via script it causes a more realistic dammage since is 10mts far more than the radius mentioned, the effect is that one side of the wall is falling down but the tower still stands, when i do via scripting it crumbles complete. So that will be my complete question, how can i work with stinged arrays involved objects, cause the function nearestobjects is what returns you, an array of objects but with strings, and i know i cant parse toObject XD.. so.. or an aletrnative solution? thnks BTW Share this post Link to post Share on other sites
Leopard20 813 Posted April 5, 2020 3 hours ago, corralesid said: if i wanted to export this in another mision or whatever Object IDs change per map (and so does the object). You can't do it for the object itself. You can, however, export the type of the object, which is a string corresponding to its class name: typeOf _obj For example: Let's say typeOf _obj for your tower returns: "Land_Tower". You should create an array with a list of object types you don't want to damage. Then, you remove objects that match these types: _noDamageObjTypes = ["Land_Tower"]; //this is an example; you should use the correct object type (typeOf _obj) here _noDamageObjs = (nearestObjects [player, ["Building"], 100]) select {!(typeOf _x in _noDamageObjTypes)}; If you want to do it for terrain objects, replace nearestObjects with nearestTerrainObjects. Learn about array operations here:https://community.bistudio.com/wiki/Array 3 hours ago, corralesid said: nearestobjects is what returns you, an array of objects but with strings No, it returns objects. What you see are object IDs converted to strings. Share this post Link to post Share on other sites
corralesid 12 Posted April 5, 2020 Just now, Leopard20 said: Object IDs change per map (and so does the object). You can't do it for the object itself. You can, however, export the type of the object, which is a string corresponding to its class name: typeOf _obj For example: Let's say typeOf _obj for your tower returns: "Land_Tower". You should create an array with a list of object types you don't want to damage. Then, you remove objects that match these types: _noDamageObjTypes = ["Land_Tower"]; //this is an example; you should use the correct object type (typeOf _obj) here _noDamageObjs = (nearestObjects [player, ["Building"], 100]) select {!(typeOf _x in _noDamageObjTypes)}; If you want to do it for terrain objects, replace nearestObjects with nearestTerrainObjects. No, it returns objects. What you see are object IDs converted to strings. thnk you, you're right, besides i'm using type of while nearestobjects i never realize it XD for example in type "Man" were i want to kill infantry at 100 radius, so i will give it a try. Share this post Link to post Share on other sites
Leopard20 813 Posted April 5, 2020 1 hour ago, corralesid said: thnk you, you're right, besides i'm using type of while nearestobjects i never realize it XD for example in type "Man" were i want to kill infantry at 100 radius, so i will give it a try. If you don't know the correct type for nearestObjects, just leave it empty or use "All" Share this post Link to post Share on other sites