Login

russian armor

Single Player Script: Bounty

7 Aug 2015, 11:02 AM
#1
avatar of IronMedic

Posts: 318

note: This is a re-writen/updated script that was used in vCoH's ToV La Fière


This Script checks whenever player2 loses a squad and reward player1 whit manpower, munition and fuel.


How to use:


This script ether be appended directly into your already existing "mapname".scar
or
Import into your "mapname".scar.

If you append the directly into "mapname".scar you can export the map as normal using the worldbuilder. To do this simply copy paste the bounty script at the end of "mapname".scar.

If you wish to keep your "mapname".scar a bit more tidy copy the script file into the same folder as your map and ad import("bounty.scar") to the beginning of "mapname".scar, but this will require you to create a scenario pack using the CoH2 Mod Builder

Variables Of The Script


g_playerToRewardForSquadWhipe = The player who gets rewarded when the player defined as "g_playerEnemyAI" losses a squad.

g_playerEnemyAI = The enemy of "g_playerToRewardForSquadWhipe".

These multipliers will be applied on the base "cost" value for each resource type
g_MunitionMultiplier = Affects the amount of Munition.
g_ManpowerMultiplier = Affects the amount of Manpower.
g_FuelMultiplier = Affects the amount of Fuel.

g_textString =This is the text string displayed as the Reward "Kicker" and has to be formatted like this "+%1AMOUNT%:MP\n +%2AMOUNT%:MU\n +%3AMOUNT%:FU" the text highlighted in red is the most important part of this text string and will break the script if missing from the string.

g_vehKillCount =completely optional, and if defined this script can track vehicles destroyed for objectives.

The table cost is used to define the base value of the bounty.

The table BountyRewards is used to define each unit. I've defined the most common units in full script, the script contains a few example unit.

Download the full script:the_bounty_script.zip


--This is a re-writen/updated script that was used in CoH ToV La Fière Campaign, re-writen/updated by IronMedic @coh2.org.
function BountyInit()

sg_Bounty = SGroup_CreateIfNotFound("sg_Bounty")
sg_Kicker = SGroup_CreateIfNotFound("sg_Kicker")
sg_temp = SGroup_CreateIfNotFound("sg_temp")

g_playerToRewardForSquadWhipe = player1
g_playerEnemyAI= player2
g_HasSyncWeapon = false
--g_vehKillCount = 0


--these multipliers will be applied on the base "cost" value for each resource type
g_MunitionMultiplier = 1
g_ManpowerMultiplier = 0.8
g_FuelMultiplier = 0.2


--"+%1AMOUNT%:MP\n +%2AMOUNT%:MU\n +%3AMOUNT%:FU" or $uniqueModID:lineInLocaleLanguageFile"
--g_textString = "$024741c43f0f47a783f888eaf1983d4a:3"
t_Bounty = {
cost = {
--bounty reward for:
--basic infantry.
basicInf = 15,
--elite infantry.
eliteInf = 25,
--light and medium vehicles.
LMVeh = 55,
--buildings and team weapons.
TWorBuilding = 75,
--"heavy medium" and heavy vehicles.
MHVeh = 100,
},
}
t_Bounty.BountyRewards = {
--infantry
{
sbp = SBP.AEF.RIFLEMEN_SQUAD_MP,
value = t_Bounty.cost.basicInf,
},
--team weapons
{
sbp = SBP.AEF.M1_57MM_AT_GUN_SQUAD_MP,
value = t_Bounty.cost.TWorBuilding,
teamweapon = true,
},
--vehicles
{
sbp = SBP.AEF.DODGE_WC51_50CAL_SQUAD_MP,
value = t_Bounty.cost.LMVeh,
vehicle = true,
},
}


SGroup_Clear(sg_Bounty)
Rule_AddInterval(Bounty_RuleAdd, 5)

end

Scar_AddInit(BountyInit)

function Bounty_SetSGroupKicker(sgroup)

SGroup_Clear(sg_Kicker)
SGroup_AddGroup(sg_Kicker, sgroup)

end

function Bounty_DeathEvent(squad)

for k, this in pairs(t_Bounty.BountyRewards) do
-- if squad that's dead is a heavyMG or a mortar
if Squad_GetBlueprint(squad) == this.sbp and this.teamweapon ==true then

if g_HasSyncWeapon == false then

Player_AddResource(g_playerToRewardForSquadWhipe, RT_Munition, this.value * g_MunitionMultiplier)
Player_AddResource(g_playerToRewardForSquadWhipe, RT_Manpower, (this.value * g_ManpowerMultiplier))
Player_AddResource(g_playerToRewardForSquadWhipe, RT_Fuel, (this.value * g_FuelMultiplier))
print("Someone killed "..this.value )
if g_textString ~= nil then
local num1 = Loc_ConvertNumber(math.floor(this.value * g_ManpowerMultiplier))
local num2 = Loc_ConvertNumber(math.floor(this.value * g_MunitionMultiplier))
local num3 = Loc_ConvertNumber(math.floor(this.value * g_FuelMultiplier))

local text = Loc_FormatText(g_textString, num1, num2, num3)

UI_CreateColouredPositionKickerMessage( g_playerToRewardForSquadWhipe, Squad_GetPosition( squad ), text, 198, 120, 74, 0)
--UI_CreateColouredPositionKickerMessage( g_playerToRewardForSquadWhipe, Squad_GetOffsetPosition( squad, 5, 5), "teameWeapon", 250, 120, 74, 0)
end
-- switches flag to true so that it skips the next duplicated team weapon squad
g_HasSyncWeapon = true

if Rule_Exists(Bounty_RestoreSyncWeapon) == false then

Rule_Add(Bounty_RestoreSyncWeapon)

end

end
break
elseif Squad_GetBlueprint(squad) == this.sbp then
Player_AddResource(g_playerToRewardForSquadWhipe, RT_Munition, this.value * g_MunitionMultiplier)
Player_AddResource(g_playerToRewardForSquadWhipe, RT_Manpower, (this.value * g_ManpowerMultiplier))
Player_AddResource(g_playerToRewardForSquadWhipe, RT_Fuel, (this.value * g_FuelMultiplier))
print("Someone killed "..this.value )
if g_textString ~= nil then
local num1 = Loc_ConvertNumber(math.floor(this.value * g_ManpowerMultiplier))
local num2 = Loc_ConvertNumber(math.floor(this.value * g_MunitionMultiplier))
local num3 = Loc_ConvertNumber(math.floor(this.value * g_FuelMultiplier))
--"+%1AMOUNT%:MP\n +%2AMOUNT%:MU\n +%3AMOUNT%:FU"
local text = Loc_FormatText(g_textString, num1, num2, num3)
UI_CreateColouredPositionKickerMessage( g_playerToRewardForSquadWhipe, Squad_GetPosition( squad ), text, 198, 120, 74, 0)
--UI_CreateColouredPositionKickerMessage( g_playerToRewardForSquadWhipe, Squad_GetOffsetPosition( squad, 5, 5), "squad", 250, 120, 74, 0)
end
-- track the number of vehicles the player has killed for the first mission
if this.vehicle == true then

if g_vehKillCount ~= nil then
g_vehKillCount = g_vehKillCount + 1
local textKill = ("Vehicles Killed: "..g_vehKillCount )
--UI_CreateColouredPositionKickerMessage( g_playerToRewardForSquadWhipe, Squad_GetOffsetPosition( squad, 6, 6), textKill, 250, 120, 74, 0)
end

end
break
end
end

end

function Bounty_RestoreSyncWeapon()
-- restores the flag so that the next sync weapon equipped squad can be counted
if g_HasSyncWeapon == true then

g_HasSyncWeapon = false
Rule_RemoveMe()
end

end

function Bounty_RuleAdd()

SGroup_Clear(sg_temp)
Player_GetAll(g_playerEnemyAI, sg_temp)
SGroup_RemoveGroup(sg_temp, sg_Bounty)

if SGroup_IsEmpty(sg_temp) == false then
Rule_AddSGroupEvent(Bounty_DeathEvent, sg_temp, GE_SquadKilled)
end

SGroup_AddGroup(sg_Bounty, sg_temp)

end
7 Aug 2015, 21:47 PM
#2
avatar of Sirlami
Donator 11

Posts: 422 | Subs: 3

Very nice feature!
9 Aug 2015, 01:54 AM
#3
avatar of IronMedic

Posts: 318

Added a download to the full script, and a quite simple tutorial.
1 user is browsing this thread: 1 guest

SHOUT IT OUT!

No ProfanityNumber of ShoutsRefresh Shout Box
Lady Xenarra: @Willy Pete The lack of April Fools this year is odd lol
Today, 01:34 AM
Willy Pete: @Rosbone not dead yet. when that happens the font will switch to Papyrus :*(
Today, 00:16 AM
dasheepeh: it was an honor guys :guyokay:
Yesterday, 20:34 PM
aerafield: yeah I already prepared my "Can't believe there's comic mode for the 10 daily visitors even on this April 1st" :guyokay:
Yesterday, 20:29 PM
Rosbone: @dasheepeh I guess that means this site is officially dead :guyokay:
Yesterday, 20:19 PM
dasheepeh: no comic sans font for april 1st this year?
Yesterday, 19:56 PM
Willy Pete: @Lady Xenarra this you? https://i.imgflip.com/3e4thi.jpg
Yesterday, 02:53 AM
Lady Xenarra: Does anyone else think that USF needs buffs? It feels like they’re on life support sometimes
Yesterday, 02:36 AM
Willy Pete: @Rosbone Ahh I missed that memo. I still think its a bad decision though. Adds frustration for players and isnt gonna make them that much money
Last Thursday, 15:46 PM
Rosbone: It is also good they left it free until after the free to play weekend. Points for that.
Last Thursday, 09:34 AM
Rosbone: But I agree, the cost to get a full decent Coh game pushing $115 US is not the best idea. Especially when it needs so much more work for casuals.
Last Thursday, 09:32 AM
Rosbone: To be fair, it was a thank you to early fans right? They said it was not free for long and it would become a pay DLC at some point.
Last Thursday, 09:30 AM
Willy Pete: Re-releasing free DLC so they can charge new players money for it. Brilliant marketing strategy :clap:
Last Thursday, 04:31 AM
Soheil: Coh2 still broken server ?
25 Mar 2025, 18:27 PM
Rosbone: Congrats to Relic. Looks like Coh3 has finally usurped Coh2 s the popular Coh. You smell terrific. :snfQuinn:.
24 Mar 2025, 02:46 AM
Nickbn: and again someone else replies. I mean come on guys. Give @adamírcz a chance
22 Mar 2025, 14:00 PM
Willy Pete: @Nickbn you didn't ask a question, and this is a chat box...
20 Mar 2025, 13:11 PM
Nickbn: @Rosbone it's incredibly rude to speak on someone elses behalf, especially when a question is directly adressed to them. I understand your passion for the subject at hand but I want to hear from him.
20 Mar 2025, 10:16 AM
Rosbone: @Nickbn No, I am just saying people should not be using any Relic owned forum since they have proven they ban anyone who says true things about Coh3.
18 Mar 2025, 19:01 PM
Nickbn: @Rosbone do you speak on his behalf? I didn't know. In that case keep us updated please.
18 Mar 2025, 16:47 PM

Livestreams

unknown 9
unknown 11
Russian Federation 8
United States 5

Ladders Top 10

  • #
    Steam Alias
    W
    L
    %
    Streak
Data provided by Relic Relic Entertainment

Replay highlight

VS
  • U.S. Forces flag cblanco ★
  • The British Forces flag 보드카 중대
  • Oberkommando West flag VonManteuffel
  • Ostheer flag Heartless Jäger
uploaded by XXxxHeartlessxxXX

Board Info

274 users are online: 274 guests
1 post in the last 24h
11 posts in the last week
81 posts in the last month
Registered members: 53140
Welcome our newest member, 98win98win
Most online: 2043 users on 29 Oct 2023, 01:04 AM