Help : Scar + Map -1 reply

Please wait...

iDeekz

Sniper Regiment

50 XP

15th February 2008

0 Uploads

1,052 Posts

0 Threads

#1 10 years ago

Do i create a map first, then when its complete save it and edit the SCAR Files?. If so please tell me, and i really need to know a small script on troops constantly spawning, and going to a postion on the map. Also, could you please tell me were the SCAR file is located so i can edit it. Yeah, im not much of a SCAR Coder yet but i will learn. So please, help me with this small problem. Thanks, Icespeed.




$_TEXAS_$

Don't Mess with Texas

50 XP

5th September 2007

0 Uploads

195 Posts

0 Threads

#2 10 years ago

After you have save the map in the map editor you can create the .scar file, to do this all you need to do is open a text file and rename it to be "your_map_name.scar". A suggestion would be to look at examples of code from other maps, you may need to extract the .sga maps to view code. for starters this line of code calles a reinforcement function, which will call in a certain reinforcement every 60 seconds, and should be located in the main part of the code: Rule_AddInterval(reinf, 60) this next part is the function that's called from the main, all this particular code does is call in a King Tiger for player one, the markers for this code are random, markers need to be placed in the map via the worlbuilder and they are used to direct the units. function reinf() targetpos = Util_GetPosition(Marker_FromName("marker"..World_GetRand(3,7), "blue_marker")) local sg_reinf = SGroup_CreateIfNotFound("sg_reinf") SGroup_Clear(sg_reinf) target = marker1 Util_CreateSquads(player1, sg_reinf, SBP.AXIS.KING_TIGER, target, nil, 1) Cmd_Move(sg_reinf, Util_GetPosition(targetpos), 15) end If you have a question about any line in this code just a ask, I would also suggest playing with code in a test map before implementing in a final map (this code is from my test map). NOTE: the code for OF and CoH(1.71-) are different, this bit of code is for OF and patch 2+.




iDeekz

Sniper Regiment

50 XP

15th February 2008

0 Uploads

1,052 Posts

0 Threads

#3 10 years ago

Well, thanks very much for the help. But, i still have a few questions. So when the maps created i create a SCAR file, then i edit it and place the code as well as the cordinates for the soliders to spawn and go to a destination?. Also, how can i found out about these markers that allow soliders to spawn, and then go to a location.




$_TEXAS_$

Don't Mess with Texas

50 XP

5th September 2007

0 Uploads

195 Posts

0 Threads

#4 10 years ago

everything about the scar file needs to be created (once you know your maps name). The markers are just an item in the worldbuilder, they are under the icon that looks like a red flag, in the marker menu just select the color you want your marker to be, (color has no meaning it is just the help you identify markers when you have a lot), I usually don't use the "basic" or "rectangle" markers (rectangle is a proximity marker). for the reinforcement units you need two markers, one were the units span, and one were they will go (usually enemy base). After you have the markers in the map you can go and code the map, you can look in the file "(your_map_name)_ID.scar" this file (you don't create) contains a list of all markers, entity groups, and squad groups. Markers are just a reference for the code, you could actually code in the locations on the map without marker, but it would be extreamly difficult. the following is the cut down code from my test map, all that remains is the display map title and a reinforcement function, this code is ment for a 2 player map, for more than 2 you would need to add (player# = World_GetPlayerAt(#)) for each player. you need this to tell the computer which player recives the reinforcements. finally for the reinf, function in this map to work you would need to name your markers marker#, (rename in the worldbuilder, at the marker menu) import("ScarUtil.scar") function OnGameSetup() player1 = World_GetPlayerAt(1) player2 = World_GetPlayerAt(2) end function OnInit() LOCSTRINGS = { TITLE = "Title", } for key, value in pairs(LOCSTRINGS) do LOCSTRINGS[key] = Util_CreateLocString(value) end SOUNDS = { BACKGROUND = "ambiences/ambiences_streamed/m01_ambience_ridge", } for key, value in pairs(SOUNDS) do Sound_PreCacheSound(value) end Sound_PlayStreamed(SOUNDS.BACKGROUND) Util_PlayMusic("SOUND/Music/sp/m14/m14_ob1_killace", 0, 0) status_intro = 1 timer = 1 dif_bonus_troops = {SBP.AXIS.PANZER, SBP.AXIS.PANZER} Rule_AddInterval(reinf, 60) Rule_AddInterval(timer1, 1) end Scar_AddInit(OnInit) function timer1() if timer == 5 then Util_GlobalMessage(LOCSTRINGS.TITLE, 3) Rule_RemoveMe() end timer = timer + 1 end function reinf() targetpos = Util_GetPosition(Marker_FromName("marker"..World_GetRand(3,7), "blue_marker")) local sg_reinf = SGroup_CreateIfNotFound("sg_reinf") SGroup_Clear(sg_reinf) target = marker1 Util_CreateSquads(player1, sg_reinf, SBP.AXIS.KING_TIGER, target, nil, 1) Cmd_Move(sg_reinf, Util_GetPosition(targetpos), 15) end function Util_CreateLocString(text) local tmpstr = LOC(text) tmpstr[1] = text return tmpstr end function Util_GlobalMessage(title, displaytime) local _ShowMsg = function() CTRL.Game_TextTitleFade(title, 0, displaytime, 2, "") CTRL.WAIT() end Util_StartIntel(_ShowMsg) end




iDeekz

Sniper Regiment

50 XP

15th February 2008

0 Uploads

1,052 Posts

0 Threads

#5 10 years ago

So from what i can gather, this code is were enemy units spawn from one marker and then go to another marker. Do you have MSN or any thing like that so i could speak to you alot quicker, because i really want to know more. Anyway thanks, and could i maybe borrow this code for testing?