forked from Giallustio/HeartsAndMinds
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
Merged
Vdauphin
merged 1 commit into
Vdauphin:master_daily
from
mtusnio:Add_Building_Reputation
May 23, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/buildingchanged.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
params ["_from", "_to", "_isRuin"]; | ||
private _classname = toUpper typeOf _from; | ||
private _malus = [btc_rep_malus_building_damaged, btc_rep_malus_building_destroyed] select _isRuin; | ||
private _skipCategories = false; | ||
|
||
// Accept only static, terrain buildings, discard any dynamically created ones | ||
if (getObjectType _from != 1) exitWith { }; | ||
|
||
{ | ||
if (_classname find (toUpper (_x select 0)) != -1) exitWith { | ||
_malus = _malus * (_x select 1); | ||
_skipCategories = true; | ||
}; | ||
} forEach btc_buildings_multipliers; | ||
|
||
if (!_skipCategories) then { | ||
{ | ||
if (_classname find (toUpper (_x select 0)) != -1) then { | ||
_malus = _malus * (_x select 1); | ||
}; | ||
} forEach btc_buildings_categories_multipliers; | ||
}; | ||
|
||
if (btc_debug) then { | ||
systemChat format [ "BuildingChanged: %1 to %2. Malus: %3", | ||
typeOf _from, typeOf _to, _malus ]; | ||
}; | ||
|
||
_malus call btc_fnc_rep_change; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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!