Login

russian armor

Nothing I do seems to work. What am I doing wrong?

22 Dec 2014, 07:27 AM
#1
avatar of Vangruffe

Posts: 139

Just pulling my hair out, SCAR is really frustrating to even learn. Everything I do either ends up with a fatal scar, a non-running script, even if I enter a simple piece of line - Player_AddResource (player1, RT_Manpower, 1000) into the console in -dev mode in-game, I always get a nil value error. I don't even know why everything I do with this language ends with an error. Somebody please tell me and teach me what I'm doing wrong. I don't think I even understand how to use this scripting language.

Edit: I really want to make mods for this game, but if the difficulty level for SCAR is this high, then this is definitely a steep barrier for me. That or I'm just screwing up everywhere.
22 Dec 2014, 15:45 PM
#2
avatar of trigg

Posts: 139

There's a steep learning curve, but it gets better (eventually).

Why don't you post your code and maybe we can spot something.
22 Dec 2014, 16:17 PM
#3
avatar of Paid_Player

Posts: 60 | Subs: 1

Hi!
Scar has deep learning barrier because there isn't enough documentation. The language itself is pretty easy. It is running over Lua script.

Best way to code scar is by making simple mod which imports your test file. Import("test.lua") loads file from the main folder of the game (steam folder). Start a custom game with the loader mod. Then you can write code and test the result by just pressing esc and then restart.

Good way to avoid structure errors is using codepad website.
23 Dec 2014, 21:27 PM
#4
avatar of Vangruffe

Posts: 139

jump backJump back to quoted post22 Dec 2014, 15:45 PMtrigg
There's a steep learning curve, but it gets better (eventually).

Why don't you post your code and maybe we can spot something.


Code

import("ScarUtil.scar")

function onInit()

Player_SetResource(player1, RT_Manpower, 100)
Player_SetResource(player1, RT_Munition, 0)
Player_SetResource(player1, RT_Fuel, 0)
Player_SetResource(player1, RT_Command, 1)


Setup_SetPlayerRace(World_GetPlayerAt(1), 3)
Setup_SetPlayerRace(World_GetPlayerAt(2), 3)
Setup_SetPlayerRace(World_GetPlayerAt(3), 3)
Setup_SetPlayerRace(World_GetPlayerAt(4), 3)
Setup_SetPlayerRace(World_GetPlayerAt(5), 3)
Setup_SetPlayerRace(World_GetPlayerAt(6), 3)
Setup_SetPlayerRace(World_GetPlayerAt(7), 3)
Setup_SetPlayerRace(World_GetPlayerAt(8), 3)

end

Scar_AddInit(onInit)


23 Dec 2014, 23:58 PM
#5
avatar of trigg

Posts: 139

You have to define player1 before setting the resources. Try something like:
Code
local player1 = World_GetPlayerAt(1)
Then you can make the calls to set that player's resources.

I'm not sure, but setting the player race may not be supported. After you fix the player1 problem, start a game, immediately hit pause, and see if the console has any error messages regarding setting the race.

25 Dec 2014, 11:39 AM
#6
avatar of Vangruffe

Posts: 139

jump backJump back to quoted post23 Dec 2014, 23:58 PMtrigg
You have to define player1 before setting the resources. Try something like:
Code
local player1 = World_GetPlayerAt(1)
Then you can make the calls to set that player's resources.

I'm not sure, but setting the player race may not be supported. After you fix the player1 problem, start a game, immediately hit pause, and see if the console has any error messages regarding setting the race.



When I tried this I got a Fatal Scar Error but when I press the ESC key (in-game menu) and went back to the game the scar error disappears and everything goes back to normal. Bad thing or no?
25 Dec 2014, 19:40 PM
#7
avatar of trigg

Posts: 139

No, that means something blew up and the script didn't finish executing.

When that happens, open the console and scroll until you find the error message. It will give a line number and a message that may or may not be helpful understanding what it didn't like. (It may also give line numbers in the function you called, or another internal function that was called indirectly, but the line number in your own file is the best clue.)

It helps to use an editor that shows line numbers, or will let you jump to a specific line number.

Note that when you got the message it was just paused, and pressing pause again will let the game contine, though the script didn't finish executing. I often pause a game as soon as it starts so I can look at my map, and thus inadvertantly un-pause a script error when I press the key. So I usually put something visible at the very end of the script, such as changing the population cap or creating a unit, and then I have direct visible evidence as to whether the script finished.
1 user is browsing this thread: 1 guest

SHOUT IT OUT!

No ProfanityNumber of ShoutsRefresh Shout Box
Osinyagov: Suddenly, coh2 is slowly dying, but you can play it, playerbase still big enough
09 Apr 2025, 17:00 PM
Osinyagov: Wow, i remember you from zansi and vali videos, good old memories
09 Apr 2025, 16:58 PM
Beinhard: o7 miss this game and zansi
09 Apr 2025, 14:09 PM
Lady Xenarra: @Willy Pete The lack of April Fools this year is odd lol
02 Apr 2025, 01:34 AM
Willy Pete: @Rosbone not dead yet. when that happens the font will switch to Papyrus :*(
02 Apr 2025, 00:16 AM
dasheepeh: it was an honor guys :guyokay:
01 Apr 2025, 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:
01 Apr 2025, 20:29 PM
Rosbone: @dasheepeh I guess that means this site is officially dead :guyokay:
01 Apr 2025, 20:19 PM
dasheepeh: no comic sans font for april 1st this year?
01 Apr 2025, 19:56 PM
Willy Pete: @Lady Xenarra this you? https://i.imgflip.com/3e4thi.jpg
01 Apr 2025, 02:53 AM
Lady Xenarra: Does anyone else think that USF needs buffs? It feels like they’re on life support sometimes
01 Apr 2025, 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
27 Mar 2025, 15:46 PM
Rosbone: It is also good they left it free until after the free to play weekend. Points for that.
27 Mar 2025, 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.
27 Mar 2025, 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.
27 Mar 2025, 09:30 AM
Willy Pete: Re-releasing free DLC so they can charge new players money for it. Brilliant marketing strategy :clap:
27 Mar 2025, 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

Livestreams

Germany 11
Germany 1025

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

316 users are online: 316 guests
3 posts in the last 24h
6 posts in the last week
41 posts in the last month
Registered members: 53776
Welcome our newest member, Dusel144
Most online: 2043 users on 29 Oct 2023, 01:04 AM