Login

russian armor

Giving Players Custom Abilities

21 Jan 2016, 01:16 AM
#1
avatar of oblivion8

Posts: 5

Hi!

After scouring the internet, I have found that looking for documentation on using SCAR script has been quite disappointing. Among my issues is the fact that, for example, I wasn't able to find any clear guide or list on how to implement the Player_AddAbility function. I wasn't sure whether to just take the name from the game or whether it required any special syntax.

So if anyone can please offer some guidance as to a clear and definitive way to do what I need to do, it would be much appreciated.

This is the script I have so far:


function OnInitID()

for i = 1, World_GetPlayerCount() do
local player = World_GetPlayerAt(i)

Player_CompleteUpgrade(player, BP_GetUpgradeBlueprint("Recon_Sweep"))
Player_AddAbility(player, BP_GetAbilityBlueprint("Recon_Sweep"))
Modify_AbilityMunitionsCost(player, BP_GetAbilityBlueprint("Recon_Sweep"), -60)

end

-- [[ Markers ]]

-- [[ Squad Groups ]]

-- [[ Entity Groups ]]

end


I created this using a forum's content that I was able to find. However it doesn't quite do what I want.

1) When specifying a player, I realize I could use World_GetPlayerAt function to find the player at a certain spawn. However I am unsure whether that player spot needs to be filled or whether, for example, I can specify to give the ability to players 1, 2 and 3, whether or not those players are in the game or not.

2) I was able to implement Recon Sweep by just using the name, however when I tried to input "P47_Strafing_Run" instead, it came up as a critical SCAR error in the game. How am I supposed to type the name of the ability I wish to give?

3) I saw on the SCAR Documentation page that you can edit the munition costs, recharge and duration etc... of an ability, and while the above munition cost reduction works, I also would like to change the Command Point cost so it's available immediately. Is there a way to do this? And if so, is there a way to do it so that the only ability affected is the one I give the player and not, for example, someone who takes the Tactical Support Company (who comes with Recon Sweep)?

4) The next step, after figuring out the above is to allow the players who've received the ability the restriction to only use it once. A one time use kind of thing, given at the beginning of the match. Is this difficult or possible?


Thank you so much to whoever can help me, I'm working on a D-Day inspired beach assault map. I've placed mines on the beach head but want to give a one time use strafing run ability to even up the teams.

Cheers!
21 Jan 2016, 01:18 AM
#2
avatar of oblivion8

Posts: 5

Quick update: If anyone has a link to a useful SCAR scripting documentation other than the main one I was able to find:
http://fortresseuropemod.com/scardoc/frameset.htm

I would be much appreciative. :)
23 Jan 2016, 14:39 PM
#3
avatar of eliw00d
Honorary Member Badge

Posts: 756 | Subs: 8

1. Your for loop is handling that just fine. If there are 3 players, your loop executes 3 times.

2. You should always use the BP_* functions to get the actual ability.

3. Unfortunately, there is no Command Point cost modifier for abilities. There is an Action Point cost modifier, though, that you would need to create your own function for. The best thing would be to create a Tuning Pack to adjust costs.

4. The best way would be to edit the abilities in a Tuning Pack. Otherwise, you would have to use a Game Event like GE_AbilityExecuted to catch when the ability is used, and then disable it after that using Player_SetAbilityAvailability.

What would you say is lacking in that documentation?
23 Jan 2016, 21:14 PM
#4
avatar of oblivion8

Posts: 5

jump backJump back to quoted post23 Jan 2016, 14:39 PMeliw00d
1. Your for loop is handling that just fine. If there are 3 players, your loop executes 3 times.

2. You should always use the BP_* functions to get the actual ability.

3. Unfortunately, there is no Command Point cost modifier for abilities. There is an Action Point cost modifier, though, that you would need to create your own function for. The best thing would be to create a Tuning Pack to adjust costs.

4. The best way would be to edit the abilities in a Tuning Pack. Otherwise, you would have to use a Game Event like GE_AbilityExecuted to catch when the ability is used, and then disable it after that using Player_SetAbilityAvailability.

What would you say is lacking in that documentation?


First of all, thanks for the response!

1) So the loop is only affecting human players? I still would like it to target players at certain positions, because the ability should only be available to the players starting on the beach.

2)I understand the BP function is necessary. That said, when I use BP_GetAbilityBlueprint("P47_Strafing_Run"), it doesn't work...

3/4) What's the best place to start in regards to 'creating a tuning pack'?


Again, thanks for the help. What I meant by lacking documentation, is that, for example, the SCAR link only details the different functions available, but doesn't really go into any detail as to the syntax of the variables, or any examples of how to format it. This lead me to trouble with the P47 Strafing Run, as I know it's possible, but have no idea what the syntax is.
23 Jan 2016, 22:05 PM
#5
avatar of eliw00d
Honorary Member Badge

Posts: 756 | Subs: 8

1. It affects all players the way you are using it. There is a Player_IsHuman function if you prefer to check if the player is human or not.

2. Is

3 & 4. Use the included Mod Builder to create a Tuning Pack mod. There are various tutorials that cover this, including the official Wiki:

http://modding.companyofheroes.com

That is because SCAR is actually just Lua, so syntax can be learned via any Lua tutorial.
1 user is browsing this thread: 1 guest

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

769 users are online: 1 member and 768 guests
aerafield
0 post in the last 24h
8 posts in the last week
34 posts in the last month
Registered members: 49107
Welcome our newest member, Falac851
Most online: 2043 users on 29 Oct 2023, 01:04 AM