Turn on Street Lights
Posts: 138
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!
Posts: 3421 | Subs: 11
Posts: 138
Posts: 32
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.
Posts: 357
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.
Posts: 138
When using the ID.scar do you have to copy/paste the same lines in there as it was in the other scar file?
Posts: 357
function OnInitID()
-- [[ Markers ]]
-- [[ Squad Groups ]]
-- [[ Entity Groups ]]
end
Make it look like this...
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.
Posts: 138
Posts: 3421 | Subs: 11
Posts: 318
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
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.
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:
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.
Posts: 422 | Subs: 3
Posts: 5
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!
Posts: 27
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
Posts: 95
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-
Posts: 95
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.
Livestreams
29 | |||||
15 | |||||
7 | |||||
6 | |||||
2 | |||||
1 | |||||
1 | |||||
1 |
Ladders Top 10
-
#Steam AliasWL%Streak
- 1.655231.739+15
- 2.842223.791+5
- 3.35157.860+16
- 4.599234.719+7
- 5.934410.695-1
- 6.278108.720+29
- 7.307114.729+3
- 8.645.928+5
- 9.10629.785+7
- 10.527.881+18
Replay highlight
- cblanco ★
- 보드카 중대
- VonManteuffel
- Heartless Jäger
Board Info
12 posts in the last week
24 posts in the last month
Welcome our newest member, Eovaldis
Most online: 2043 users on 29 Oct 2023, 01:04 AM