A3Wasteland / ArmA3_Wasteland.Altis

A3Wasteland is a survival sandbox mission for Arma 3 where two teams and independent players fight for survival. Built in collaboration between GoT, TPG, KoS, 404Games, and others.
http://a3wasteland.com
GNU Affero General Public License v3.0
104 stars 185 forks source link

allowDamage not working properly in my mission? #339

Open LouDnl opened 9 years ago

LouDnl commented 9 years ago

Could there be something wrong with this part of my mission?

Vanilla: https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/blob/master/server/functions/spawnStoreObject.sqf#L174-L178

My mission: https://github.com/LouDnl/ArmA3_Wasteland.Altis/blob/NL-United/server/functions/spawnStoreObject.sqf#L191-L195

If I buy lets say an ammocrate and a military wall green on a local hosted game (vanilla and my mission) both objects get the "allowDamage" variable set accordingly and you can read it out. When I do the same on a dedicated server hosted game, both objects do not get the variable set, or atleast you cannot read it out. This is intentional? On vanilla this doesn't seem to effect the real allowDamage setting. So the crates cannot be damaged and the military wall can. Neither on local or dedicated hosted game.

On my own server there seems to be something wrong with the allowDamage setting. We have a Box_NATO_AmmoVeh_F to be bought (also tested on the default buyable ammocrate) but for some reason the allowDamage setting doesn't get set to false. Even though when checking on a locally hosted game the variable is set to false. What could be wrong?

Also I can see in the database that only spawnbeacons (and camonets) get the value AllowDamage set tot 1.

For some reason the object does not get allowDamage set to false which in turn makes it damageble. But only on my mission --

LouDnl commented 9 years ago

Found the reason I think. It's this part I put in: https://github.com/LouDnl/ArmA3_Wasteland.Altis/blob/NL-United/server/functions/spawnStoreObject.sqf#L191

Although that should work?

Still doesn't explain the variable not showing up on a dedicated box.

LouDnl commented 9 years ago

Figured out the variable and database part. The "allowdamage" variable is not set globally in spawnstoreobject.sqf. And seeing that saving is done by the headlessclient on my server it doesn't pick up on the variable. Hence why it's not showing on my client either. So that's fix one.

Now I only need a fix for this line so that allowDamage gets set to true or false accordingly: https://github.com/LouDnl/ArmA3_Wasteland.Altis/blob/NL-United/server/functions/spawnStoreObject.sqf#L191

LouDnl commented 9 years ago

Well I probably "fixed" too much, but this seems to work now :)

https://github.com/LouDnl/ArmA3_Wasteland.Altis/commit/8e85b648cf92c6ce63c4fe1c51b460cc157d63c4

LouDnl commented 9 years ago

One question remains. Why does _isDamageable = !(_object isKindOf "ReammoBox_F" || _object isKindOf "Land_InfoStand_V2_F"); work

and _isDamageable = !({_object isKindOf _x} count ["ReammoBox_F", "Land_InfoStand_V2_F"] > 0); doesn't?

Oh and also, why I correct in assuming that the headlessclient saving didn't pick up the allowdamage variable as it wasn't broadcast globally?

LouDnl commented 9 years ago

Hmmm this allowDamage thing is cracking my brain. Had it on: _isDamageable = !(_object isKindOf "ReammoBox_F" || _object isKindOf "Land_InfoStand_V2_F"); And it worked.

After a while I bought new ammoboxes, put a satchel near, blew it up, and they burned down?

Whent back to the vanilla line, worked again (as in no damage). Put back in my line, no damage.

But then after a while the allowDamage setting seems to go away?? When I manually set the allowdamage to false the boxes don't get damaged.

Tried with the vanilla line again and worked fine. No damage to crates. Even after waiting a while. Except for one ammocrate that burned away.

Must be something wrong with the allowDamage setting then?

LouDnl commented 9 years ago

I give up haha :-1:

AgentRev commented 9 years ago

You are right in that not putting the allowDamage variable as global prevented the HC from seeing it, however setting that variable to false has no effect.

The object loading code does, by default, disable damage to all objects, and re-enables after loading only if the allowDamage variable is true. The only effect it would have on the HC is cause it to save all object with damage disabled.

However, I don't know what's the problem with the burning crates. All I know is that allowDamage stops working if the object changes locality, but normally this only happens for vehicles and static weapons, when somebody enters them.

LouDnl commented 9 years ago

Checking the objects bought from the generalstore with 'local cursorTarget' shows that locality is false. But as soon as you pick them up with R3F (3.1 in my case) the locality changes to true. So this means the allowDamage is changed. I think localizing where the locality is changed and adding an '_object allowDamage false;' should suffice?

LouDnl commented 9 years ago

Buying an ammocrate shows its not local, and when shooting it it doesn't get damaged. As soon as you pick it up and release it the locality is changed. When you then shoot it you can see it get damaged.

In deplacer.sqf the locality of the object is changed here: https://github.com/LouDnl/ArmA3_Wasteland.Altis/blob/NL-United/addons/R3F_LOG/objet_deplacable/deplacer.sqf#L144-L150

And this is why in the description (stupid French): 'We ask that the object is local to the player to reduce latencies (setDir, periodic attachTo)'

I'm going to add this to see if it helps: if (_objet isKindOf "ReammoBox_F") then { _objet allowDamage false; };

LouDnl commented 9 years ago

Ok so locality only changes when moving around an object with R3F 3.1. Can't seem to find that in Vanilla R3F. Good to know.

My temp fix for now seems to work like a charm: https://github.com/LouDnl/ArmA3_Wasteland.Altis/commit/8930128184de34515d7ada342f6428932024c216

AgentRev commented 9 years ago

The locality change is done here: https://github.com/LouDnl/ArmA3_Wasteland.Altis/blob/8930128184de34515d7ada342f6428932024c216/addons/R3F_LOG/objet_deplacable/deplacer.sqf#L144-L150

It says it's to improve fluidity when moving and rotating objects.

LouDnl commented 9 years ago

Yep found that and made a temporary fix :) thanks Rev