Login

russian armor

Turn on Street Lights

11 Aug 2014, 16:24 PM
#1
avatar of Invictus
Donator 11

Posts: 138

It might already have been said, but how do you turn on the street lights and search lights etc.?
Saw something about adding them in a Entity group and then alter the .Scar document with notepad.
Can't seem to figure out how exacly.

Hope to hear from you guys!
11 Aug 2014, 16:26 PM
#2
avatar of Janne252
Admin Black Badge
Patrion 15

Posts: 3421 | Subs: 11

11 Aug 2014, 19:12 PM
#3
avatar of Invictus
Donator 11

Posts: 138

12 Aug 2014, 17:14 PM
#4
avatar of Havenco

Posts: 32

I tried following the tip of the week, and it's not working.

What I've done so far:
*Added an Entity Group (eg_lamps) consisting of 66 lamp objects
*Copy-pasted the code from the tip of the week into a new text document and saved it as "4p_lyon.scar" (same name as the .sgb)
*Tried with different atmospheres (e.g. silent night)

So far the lamps are only shining within the WorldBuilder.

Any advice would be much appreciated.
12 Aug 2014, 17:48 PM
#5
avatar of Srinidhalaya

Posts: 357

Put the code in 4p_lyon_ID.scar

The problem is, using the ID.scar, you have to re do the scar file every time you save the map, prior to exporting. This becomes repetitive. I just make a back up txt file. Using the mapname.scar way works, but there are some other things that have to be done, I think, to get it to work, but you don't have to remake the ID.scar document each time.

12 Aug 2014, 18:58 PM
#6
avatar of Invictus
Donator 11

Posts: 138

Yeah, I'm also having trouble.
When using the ID.scar do you have to copy/paste the same lines in there as it was in the other scar file?
12 Aug 2014, 19:31 PM
#7
avatar of Srinidhalaya

Posts: 357

Default ID.scar
Code
function OnInitID()

-- [[ Markers ]]

-- [[ Squad Groups ]]

-- [[ Entity Groups ]]

end


Make it look like this...
Code

function OnInit()
EGroup_SetAnimatorState(eg_lamps, "Light_State", "On")
end

Scar_AddInit(OnInit)


As I said, you will have to redo this ID.scar each time you save the map, before exporting. If I remember, there is a way to include mapname.scar into the exporting process, I'm not sure how, so I just use mapname_ID.scar, and redo it each time. I'm sure Janne will eventually see this, and might school me on it. :)
12 Aug 2014, 19:56 PM
#8
avatar of Invictus
Donator 11

Posts: 138

Alright, it will do for now. Thanks!
12 Aug 2014, 20:15 PM
#9
avatar of Janne252
Admin Black Badge
Patrion 15

Posts: 3421 | Subs: 11

Since the <mapname>.scar file has been working and pretty much freed us from using the <mapname>_ID.scar, you should not use the <mapname>_ID.scar for any scripting purposes at all. If for some reason your <mapname>.scar is not working, you should look for the issue somewhere else than "solving" it by using <mapname>_ID.scar. There's absolutely no reason to use <mapname>_ID.scar instead of <mapname>.scar
12 Aug 2014, 20:47 PM
#10
avatar of IronMedic

Posts: 318

This works for me in "mapname".scar, don't know if the "Time of Day" has to be set to night tho.(Scenario->Atmosphere Properties-> Sunlight)
Code

function OnInit()

EGroup_SetAnimatorState(eg_lamps, "Light_State", "On")
EGroup_SetAnimatorState(eg_lamps, "Light", "On")

--call custom functions here.
end

--add custom functions here.

Scar_AddInit(OnInit)




--this is a comment btw
12 Aug 2014, 22:03 PM
#11
avatar of Srinidhalaya

Posts: 357

Since the <mapname>.scar file has been working and pretty much freed us from using the <mapname>_ID.scar, you should not use the <mapname>_ID.scar for any scripting purposes at all. If for some reason your <mapname>.scar is not working, you should look for the issue somewhere else than "solving" it by using <mapname>_ID.scar. There's absolutely no reason to use <mapname>_ID.scar instead of <mapname>.scar


Good to know! I haven't used any custom scripts since they fixed it.
13 Aug 2014, 15:21 PM
#12
avatar of Havenco

Posts: 32

This works for me in "mapname".scar, don't know if the "Time of Day" has to be set to night tho.(Scenario->Atmosphere Properties-> Sunlight)
Code

function OnInit()

EGroup_SetAnimatorState(eg_lamps, "Light_State", "On")
EGroup_SetAnimatorState(eg_lamps, "Light", "On")

--call custom functions here.
end

--add custom functions here.

Scar_AddInit(OnInit)




--this is a comment btw


Thanks IronMedic, your post helped me solve this problem.

After doing some testing back and forth (using different maps, checking "Light" and "Light_State" individually and simultaneously), I've found that only the former is working as intended. On the contrary, "Light_State" had no effect at all.

The least complex code would look like this:

Code

function OnInit()

EGroup_SetAnimatorState(eg_lamps, "Light", "On")

end

Scar_AddInit(OnInit)


If anyone is able to reproduce the same results, then maybe the tip of the week should be updated in accordance with this information.
13 Aug 2014, 17:07 PM
#13
avatar of Sirlami
Donator 11

Posts: 422 | Subs: 3

I get my lights working by changing the lights from off to on from the transitions
13 Aug 2014, 20:48 PM
#14
avatar of WIKStealth

Posts: 5

I just don't know but my 8p_Schweinfurt has lights/searchlights in MP without any editing of files.
16 Aug 2014, 13:43 PM
#15
avatar of Invictus
Donator 11

Posts: 138

This works for me in "mapname".scar, don't know if the "Time of Day" has to be set to night tho.(Scenario->Atmosphere Properties-> Sunlight)
Code

function OnInit()

EGroup_SetAnimatorState(eg_lamps, "Light_State", "On")
EGroup_SetAnimatorState(eg_lamps, "Light", "On")

--call custom functions here.
end

--add custom functions here.

Scar_AddInit(OnInit)




--this is a comment btw


This one did it for me, thanks!
12 Sep 2014, 14:55 PM
#16
avatar of xxcompanyofcowardsxx

Posts: 27

Hi.I do it with an easiest way but i have to tell you that even if it is day the lights are on.

1-Open the coh 1 wb and open any map and just place all the lights you can find and set them on by choosing the object and pressing "edit state" on the right and "add" in next window.
2-Open now the same map with coh 2 wb.
3-use the stamp placement tool
4-now for each light create a different stamp
5-now the only you have to do is when you create a map to use the stamp placement tool and choose the light you want to place.
just make sure when you create the stamp to have this settings
-in acquire using check "selection"
-in filters check "only objects"

If you want to save your stamps and dont lose it (by mistake)here is where is the stamps
C:\Users\user\Documents\My Games\Company of Heroes 2\WorldBuilder\Stamps\Temporary
25 Feb 2016, 20:52 PM
#17
avatar of optical21

Posts: 95

Im getting fatal scar error after copying the code into the scar file, anyone know what im doing wrong?
26 Feb 2016, 11:19 AM
#18
avatar of ernesto-m

Posts: 42

Im getting fatal scar error after copying the code into the scar file, anyone know what im doing wrong?


Hi optical21,

lamp and search light Animation, with scar script, you can find in my map 4p_Harbour_fight in

the Steam Workshop.


greetings
-ernst-
1 Mar 2016, 00:45 AM
#19
avatar of optical21

Posts: 95

But how do i open your map in the world builder?
1 Mar 2016, 06:55 AM
#20
avatar of ernesto-m

Posts: 42

But how do i open your map in the world builder?


You can open the Map after converting the 4p_Harbour_fight.sga to 4p_Harbour_fight.sgb

A tool to do this you can find in the Forum ( Janne252 has written a very fine tool for this cases)

Or, you made your own script-File.

The solution are this two scar-script-lines:

EGroup_SetAnimatorState(eg_lamps, "Light_State", "On")
EGroup_SetAnimatorState(eg_lamps, "Light", "On")

Create a EGroup "eg_lamps" in WB, then collect all Lamp-objects to this EGroup and save your Map

Opean an Editor and write:

import("ScarUtil.scar")
function OnInit()

EGroup_SetAnimatorState(eg_lamps, "Light_State", "On")
EGroup_SetAnimatorState(eg_lamps, "Light", "On")

end
Scar_AddInit(OnInit)


Now export your Map from WB as <Map_Name.sgb> to find the your Map in CoH2.



1 user is browsing this thread: 1 guest

Livestreams

unknown 2
Canada 1
unknown 1

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

817 users are online: 2 members and 815 guests
violatemilky, Brick Top
0 post in the last 24h
0 post in the last week
28 posts in the last month
Registered members: 49399
Welcome our newest member, violatemilky
Most online: 2043 users on 29 Oct 2023, 01:04 AM