Login

russian armor

A note on scripting

Only Relic postRelic 28 Feb 2014, 08:49 AM
#1
avatar of Tribalbob
Developer Relic Badge

Posts: 160 | Subs: 3

Hey guys, I see a lot of you are starting to delve into SCAR scripting, and I think that's awesome.

One thing I wanted to note; I've seen a few tutorials referencing the mapname_ID.scar file as the file you script in.

I would recommend against using this as it's a scar file that auto generates when the map is saved to store map-defined egroups/sgroups/markers. This means you'd have to be constantly backing up and copy+pasting work.

The engine will actually automatically execute a scar file that matches the map's sgb name.

For example: If your map is named MyMap.sgb, then it will have MyMap_ID.scar as the auto-generated file.

What you want to do is make a NEW scar file and call it MyMap.scar. You can then script to your heart's content (be sure to create an OnInit function and Scar_AddInit(OnInit) it!).

All you have to do is ensure you package this file with your other files (via Mod Tools or whatever application you use). Best part about it is you no longer have to worry about saving in the map and overwriting your work!

Happy scripting!

(ps: Don't forget to call import("ScarUtil.scar") on line one of your file so you can make use of our library of functions!)

EDIT: Here's sort of what it would look like:

Code
import("ScarUtil.scar")

function OnInit()

-- Here you can do stuff!
-- Like call another function
MyNewFunction()

end

Scar_AddInit(OnInit)

function MyNewFunction()

-- More stuff!

end
28 Feb 2014, 10:02 AM
#2
avatar of Janne252
Admin Black Badge
Patrion 15

Posts: 3421 | Subs: 11

Hey Tribalbob!
Thank you for sharing this information. This is relevant but unfortunately this does not work at the moment. WorldBuilder DOES NOT include <mapname>.scar in the archive which is built via "Export Package". I would never have written those tutorials telling people to use <mapname>_ID.scar unless it was the only way available to include scripts.

I've messaged Lardinal a couple of times about WorldBuilder's inability to include relevant files in the archive. Could you please forward this issue? I really would like to include several .scar files in a map archive for creating custom libraries.

List of files I'd like to include in a custom map archive:
  • .SCAR for scriptig
  • .NIS for NIS animations
  • .rgd (and other attrib related files) to include custom abilities, units in a map
  • .DDS files for overriding game GUI images
  • .fnt for custom fonts ( mainly for altering dr_text2D output font)
  • .lua files for adjusting game config (Camera max zoom out height, player colors, etc.)
  • folders to include all of this data
    Basically including all of these files in the archive would require a some kind of fully recursive loop though the project folder and some filtering. This leads to an issue map project requiring a base directory. Maps could no longer be saved in /mp/.
28 Feb 2014, 10:02 AM
#3
avatar of OnkelSam
Honorary Member Badge

Posts: 1582 | Subs: 4

i guess that's why tribalbob said you should export using the .sga packer tool by Corsix instead of worldbuilder itself
1 user is browsing this thread: 1 guest

SHOUT IT OUT!

No ProfanityNumber of ShoutsRefresh Shout Box
blvckdream: @Rosbone yeah ... still no alternative to coh2 -_-
Last Sunday, 09:12 AM
Rosbone: @blvckdream They just might. Glad you are still in the mix brother!
Last Saturday, 14:59 PM
blvckdream: @Rosbone I submitted a request. Let`s see if they do something lol
Last Saturday, 12:28 PM
Rosbone: If you go thru the process, please mention @aerafield just for kicks :foreveralone:
Last Saturday, 10:54 AM
Rosbone: relic stopped banning people. But was rumored to do a ban-wave recently. They just announced this new portal: https://help.relic.com/hc/en-us/sections/36051779792147-Code-of-Conduct-Relic-Account
Last Saturday, 10:53 AM
blvckdream: Obvious map hacker. doesnt even hide it. who can i send the replay?
Last Saturday, 09:25 AM
blvckdream: Is there still a way to report coh2 maphackers?
Last Saturday, 09:19 AM
donofsandiego: "boo womp"
Last Friday, 19:01 PM
donofsandiego: me when my riflemen blob gets insta wipeb by a V1
Last Friday, 19:00 PM
Rosbone: @Willy Pete :clap:
Last Friday, 03:33 AM
Willy Pete: And apparently Relic has as well lol
Last Friday, 02:37 AM
Willy Pete: Do enough people care to even complain? I don't mind the v1 but I've given up caring about balance
Last Friday, 02:36 AM
Lady Xenarra: @aerafield :rofl:
Last Wednesday, 14:11 PM
aerafield: "Deploy a devastating V-1 rocket capable of wiping out the opponent's base immediately. Only 9.99$ BUY IT NOW!"
31 Dec 2024, 22:19 PM
Lady Xenarra: I am surprised by the lack of screaming that the V-1 will be in the new battle groups.
31 Dec 2024, 14:55 PM
Rosbone: Its going to be one of those years.
25 Dec 2024, 12:39 PM
donofsandiego: rosbone coming out in the shoutbox was not on my 2024 bingo card
25 Dec 2024, 06:46 AM
Hannibal: Relic lost their most professional CoH3 hater
24 Dec 2024, 11:48 AM
Rosbone: However, since Relic added kill counts I cannot trash Coh3 anymore. And have subsequentially started to sprout breasts. I am slowly transitioning into a Coh3 enjoyer :blush:
23 Dec 2024, 13:43 PM

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

444 users are online: 444 guests
7 posts in the last 24h
18 posts in the last week
60 posts in the last month
Registered members: 50404
Welcome our newest member, rartayardigufum
Most online: 2043 users on 29 Oct 2023, 01:04 AM