New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADD: a reputation change whenever a building is destroyed #349
ADD: a reputation change whenever a building is destroyed #349
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, thank you this look very good ! Can you use the master_daily branch (#288 (comment))? See you soon :)
Crap, sure, will do. I forgot about that comment, and I was so happy I picked the right branch this time. :D |
757e658
to
d4501ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btc_buildings_multipliers is really interesting. I know church can't be destroy sadly :/ Did you think about the https://community.bistudio.com/wiki/boundingBoxReal or https://community.bistudio.com/wiki/boundingBox for building witch are not inside the array ?
@@ -24,6 +24,23 @@ call btc_fnc_db_autosave; | |||
|
|||
addMissionEventHandler ["HandleDisconnect",btc_fnc_eh_handledisconnect]; | |||
|
|||
addMissionEventHandler ["BuildingChanged",{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a specific function like I did here : https://github.com/Vdauphin/HeartsAndMinds/blob/master_daily/%3DBTC%3Dco%4030_Hearts_and_Minds.Altis/core/init_server.sqf#L25 ? thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I also realised that the files use tabs rather than spaces by default, I'll convert these.
You mean to use the bounding box to determine roughly its size? Not sure if that'd be a good idea, some buildings are quite large (like the sheds with metal roofs), but it doesn't make much sense for the reputation hit to be as high as the big houses. There's something else I just spotted though - https://community.bistudio.com/wiki/Arma_3_CfgVehicles_EMPTY - there's a bit called "Category" which groups them by type, so you could technically apply a category filter first. The only question is how to access the category, I guess it's through some Cfg file magic. |
ok perfect :)
if the |
You mean by toppling the walls over? I checked with lamp posts, but that didn't have any impact since the model doesn't change at all. Are there any walls in Arma that don't fall down but change their model when destroyed? |
yes!
perfect
I don't think so, you write then. |
865062b
to
f4fa8cb
Compare
A quick question, since I just realised, there's also a mission_tanoa.sqm, I'm wondering if then it'd make sense to have a switch/case with different buildings depending on the (official) terrain? Current list only tackles Altis. |
I don't think. The |
I'll fix it up properly, for performance reasons it might make sense to just do a switch/case depending on map type, especially since in the future it'd be easy to just accommodate any changes by adding a new world map. |
I've got a dedicated box I'll run it on to test with 5-7 of my peeps. It's an Intel I7 6700k at 4.8ghz. I'll check logs and see if anything pops up unexpectedly. I'm working on some suicide car bomb theory test scripts. I've added that one guy's Oil Derick and added to LandMarine locations so side missions can spawn near it. Can hardly wait to add the ford class carrier way way off the shores of the islands for a hearts and minds test. Feel free to try out this crazy version I did for Tanoa on the main airport as a base of operations. https://github.com/Breech99/HeartsAndMinds/tree/Hearts-and-MindsMain_Blufor_Base |
I don't know if I am wrong but the If we take a look of your array, I can see common name like An array like that : And a filtering like that:
So if the building destroyed with keyword : Do you think this approch could be better ? |
Yeah, that was my initial issue with "How should it preferably work on Tanoa & other maps". I'll go through the list of structures in other maps such as Cherno etc. to see if they follow the same model, but could do something like this. In worse case scenario this could be expanded to give multiple categories under one multiplier to look for edge cases like different naming and such. On custom maps then, in worse case scenario it will just apply a static -5/-10 (or whatever it's set to). No a funny note, out of curiosity I did a quick google for Cherno but found references to the DayZ version of Cherno. Their house names? All in Czech :D |
X) |
f6bd6aa
to
0f31487
Compare
Pushed a change. The array is not split into two, one to allow explicit overwriting for specific buildings, the other just stacks modifiers based on the names. I had a look at Cherno/Takistan classnames as well to add some categories, but Cherno is a mix of Czech and English names. However, it seems the most important ones are in plain English. I couldn't find the hotel classname though, so that's a bit of an issue. Oh, also, I squashed your commit into the main one since it was a fix for the changes I did in PR. |
158f47c
to
77336f1
Compare
77336f1
to
d58fbc2
Compare
For me this is perfect. A little question, why do you use |
I haven't tested this myself, but based on this example it seems that the find function just finds a specific object you're looking for, it doesn't check the insides of arrays within an array. You could technically do a loop and then run a find on the string itself, but Bis_fnc_inString does the same thing pretty much. I preferred inString for readability, but then it's SQF so it's unreadable by definition. ;) Funnily enough Bis_fnc_inString is newer than find, at first I thought maybe find is supposed to replace it but doesn't look like it. |
is same as:
|
d58fbc2
to
6a139e9
Compare
I was expecting Bis_fnc_inString would be optimised (or at worst use find) for string searching, but I just checked and yeah, find is a good deal faster. Updated the handler to use find instead. |
@@ -0,0 +1,24 @@ | |||
params ["_from", "_to", "_isRuin"]; | |||
private _classname = typeOf _from; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be private _classname = toUpper typeOf _from;
private _skipCategories = false; | ||
|
||
{ | ||
if ((toUpper _classname) find (toUpper (_x select 0)) != -1) exitWith { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toUpper _classname
--> _classname
|
||
if (!_skipCategories) then { | ||
{ | ||
if ((toUpper _classname) find (toUpper (_x select 0)) != -1) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toUpper _classname
--> _classname
6a139e9
to
4a743f0
Compare
Done, I've also thrown in some more classnames to cover more buildings on Cherno. |
|
||
// The multipliers are applied on top of each other, so "Chapel" and "Small" will both multiply the malus value | ||
btc_buildings_categories_multipliers = [ | ||
["Shed", 0.75], ["Slum", 0.8], ["Small", 0.8], ["Big", 1.5], ["Villa", 2.0], ["Main", 3.0], ["Tower", 2.0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am worry about "Tower" malus. In Side mission destroy tower, you need to destroy tower like this https://github.com/mtusnio/HeartsAndMinds/blob/master_daily/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf#L139
Does the malus will be apply on tower spawn by this side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, probably best to just code out the generic "Tower" class. easy enough to do. I'll do some testing on my dedi server to see how things are going and report back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason why it wouldn't, that's a bit of an issue. I don't like commenting out the class just in case in the future another buildings gets added to the list. I'll have to look into it to see how to properly fix that. The easiest solution would require the side missions to add any spawned building to a list of "enemy" buildings that are ok to blow up. Alternatively I'll see if there's a way to find out if a building is part of the map or custom spawned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The easiest solution would require the side missions to add any spawned building to a list of "enemy" buildings that are ok to blow up. Alternatively I'll see if there's a way to find out if a building is part of the map or custom spawned.
OR when the mission is a succes (Tower destroyed ) add a bonus over the building malus so : malus - bonus = 0 ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a workaround I'd rather avoid, it'll get confusing really quickly. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jackpot! After screwing around to see if I can somehow use object ids to find out whether it's a terrain or mission-created building I found this: getObjectType. Any buildings created with createVehicle return type of 8, while pre-placed ones give 1.
I tested this out with "Land_TTowerBig_1_F" createVehicle (position player)
, then blew it up. Didn't get any hit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
4a743f0
to
7703dee
Compare
Hello, When you kill a civilan you just have a malus of 10. I am not sure but I think the malus boost increase a lot the global malus. May be the initial malus should be decreased by a half. What do you think ? One last thing thé documentation should be update to advise palyer of this. Thank you for the good job |
Oh, so the boost increase increases civilian killed punish more than -10? I'll have to check. I do think I like what the current settings are at now. btc_rep_malus_civ_hd = - 10; how much more do they increase with the boost? |
No sorry. I mean in comparison civil malus is only -10. You lost a lot more reputation when you destroy a building than killing a civilian. But if from your point of view is okay leave it like that. For documentation add here: https://github.com/Vdauphin/HeartsAndMinds/blob/master_daily/%3DBTC%3Dco%4030_Hearts_and_Minds.Altis/core/doc.sqf#L118 Something like that: |
Fantastic.. Yeah, let the player be aware in documentation "You will have to do your best to minimize collateral damage from damaging or destroying buildings." "There will be times where you cannot avoid but try and keep damage to a minimum." -either one of those comments along those lines. |
I don't have access to my PC at the moment, but yeah, I'm happy with whatever numbers you prefer. :) I'll change it and update the docs once I'm back |
7703dee
to
9e49c08
Compare
I am doing Final test on your PR before merging and.. Add a line like this should help ;) Byebye! |
9e49c08
to
3f04764
Compare
Links to #288
I don't have a dedicated server yet to test it on properly, but I'm looking mainly for review comments (although if someone can test it I won't say no to that!). As you can see in the code the idea is that the reputation malus can be applied in two ways: either by damaging a building or destroying. Technically destroying a building outright is better for your reputation then damaging and destroying, but in a way it makes sense - people don't really like you breaking their houses and then finishing them up later. ;)
The filter is applied on a prefix basis, so the first entry that matches the prefix will be the multiplier we take. I've set up basic multipliers to weed out: small buildings that shouldn't be that big of an issue, larger buildings that get a 1.5-2.0 multiplier. Chapels (churches are invincible apparently?) that go from 2.5 and 3.0, and then industrial/transport/communication buildings which give a massive penalty. After all no-one likes their factories getting ripped to shreds. Please check if you're fine with the numbers!
I looked through the code provided by @Breech99 but I don't think that's needed at the moment, as in we are only interested in knowing whether there's some building somewhere that transitions from one phase to another, the netids might come in useful though in the future to store the states of buildings between saves.
Final test :