CapBlackShot 11 Posted October 24, 2014 (edited) Hello, I'm trying to use the following code on a 'Game Logic' (Objects) to make things/building/fences/lamps in a specific radius invencible: if (isServer) then {{_x allowDammage false} forEach nearestObjects [this, ["Building","Structures_Fences","Lamps","Structures_Walls"], 780];}; Unfortunately, they don't seem to be working. Could someone give a hand? Thanks! Edited October 24, 2014 by CapBlackShot Share this post Link to post Share on other sites
jshock 513 Posted October 24, 2014 Hello,I'm trying to use the following code on a 'Game Logic' (Objects) to make things/building/fences/lamps in a specific radius invencible: if (isServer) then {{_x allowDammage false} forEach nearestObjects [this, ["Building","Structures_Fences","Lamps","Structures_Walls"], 780];}; Unfortunately, they don't seem to be working. Could someone give a hand? Thanks! I've personally had some issues with using if (isServer) tags around code for a light source through a game logic object, have you tried it without those tags? Share this post Link to post Share on other sites
CapBlackShot 11 Posted October 24, 2014 I've personally had some issues with using if (isServer) tags around code for a light source through a game logic object, have you tried it without those tags? Well, I also tried: {_x allowDamage false;} forEach (nearestObjects [(getPos this), ["Building","Structures_Fences","Lamps","Structures_Walls"], 780]); Share this post Link to post Share on other sites
dreadedentity 278 Posted October 24, 2014 You didn't actually state your problem. I'm not sure about allowDammage, but allowDamage must be run on every client in multiplayer. That's actually straight from the wiki in Additional Information, but I'm not sure if that info is still current or not. Share this post Link to post Share on other sites
CapBlackShot 11 Posted October 24, 2014 You didn't actually state your problem. I'm not sure about allowDammage, but allowDamage must be run on every client in multiplayer. That's actually straight from the wiki in Additional Information, but I'm not sure if that info is still current or not. My problem is simple. I can't get that script working on 'Game Logic'. It should prevent people from running over objects and destroying them in a determined area, but it simple doesn't work. I also tried 'allowDamage', but without success. Thanks! Share this post Link to post Share on other sites
jshock 513 Posted October 24, 2014 Try going into the debug console and doing a hint format for nearest objects, as you have it there, to make sure it is returning the proper objects. hint format ["%1", nearestObjects [player, ["Building","Structures_Fences","Lamps","Structures_Walls"], 780]]; Share this post Link to post Share on other sites
CapBlackShot 11 Posted October 24, 2014 Try going into the debug console and doing a hint format for nearest objects, as you have it there, to make sure it is returning the proper objects. hint format ["%1", nearestObjects [player, ["Building","Structures_Fences","Lamps","Structures_Walls"], 780]]; Thanks! It's just returning info from Building. Any ideas? Share this post Link to post Share on other sites
jshock 513 Posted October 24, 2014 Define info from a building, is it the classname, is it position, is it what? Because your needing it to return an object that the allowDamage false command can actually apply to, if it's not returning actual objects, but something else, then that is your problem. Share this post Link to post Share on other sites
CapBlackShot 11 Posted October 24, 2014 Define info from a building, is it the classname, is it position, is it what? Because your needing it to return an object that the allowDamage false command can actually apply to, if it's not returning actual objects, but something else, then that is your problem. It shows me the buildings by 780 meters from me. Lamps, fences and walls aren't shown. I think it's weird, because these materials also have classnames. :( Share this post Link to post Share on other sites
jshock 513 Posted October 24, 2014 (edited) They are classnames, but they all come from a parent class, similar to "Buildings", so with those results that you have, I would double check the parent classes for the other objects. You could use BIS_fnc_returnParents as well to make life a bit easier (on my phone so I can't link it). Edited October 24, 2014 by JShock Share this post Link to post Share on other sites
eagledude4 3 Posted October 25, 2014 (edited) I'm pretty sure allowDammage/allowDammage isn't local. From the wiki: Command has to be executed where object is local and as long as object does not change locality the effect of this command will be global. For your nearestObjects param, "Building" should be the parent class for all of those sub classes you listed. @JShock: I think he's using the game logic in the map editor, so I think isServer should be used. Correct me if I'm wrong. Edited October 25, 2014 by eagledude4 Share this post Link to post Share on other sites
CapBlackShot 11 Posted October 25, 2014 They are classnames, but they all come from a parent class, similar to "Buildings", so with those results that you have, I would double check the parent classes for the other objects.You could use BIS_fnc_returnParents as well to make life a bit easier (on my phone so I can't link it). Thank you. As I can see, they all are "Building", including the fences. I figured out that I'm not getting damage when I destroy a fence, but it stills falling to the ground. Lamps are working properly, I can't run over them anymore. I also tried adding enableSimulation false, but no effects at all. if (isServer) then {{_x allowDamage false; _x enableSimulation false} forEach nearestObjects [this, ["Building"], 780];}; Thanks! Share this post Link to post Share on other sites
jshock 513 Posted October 25, 2014 I'm pretty sure allowDammage/allowDammage isn't local. From the wiki:For your nearestObjects param, "Building" should be the parent class for all of those sub classes you listed. @JShock: I think he's using the game logic in the map editor, so I think isServer should be used. Correct me if I'm wrong. I was just stating previous problems that I have had before, not that he can't use it. @CapBlackShot: At least now you can narrow a search to just indestructable fences :p. Share this post Link to post Share on other sites