russian armor

Object Invincibility Issue

28 Dec 2019, 21:02 PM
avatar of kenney84

Posts: 2

I am creating a trench warfare map and have hundreds of instances of the mp_trench_01 and branch_trench_wall objects laid out already. Unfortunately, if any of these are destroyed, it screws up the trench system pretty badly. I have been looking for a way to make these objects invincible and have already tried a solution I found on this forum where you do the following:

1. Create an entity group called eg_invincible and add all the objects you want to be invincible to it.

2. Open the mapname_ID.scar file and add this line of code: EGroup_SetInvulnerable(eg_invincible, true)

3. Without saving in WorldBuilder, export the package.

I have tried this to no avail, as when I start up the map it states that there was a fatal scar error.

My scar file looks like this:

function OnInitID()

-- [[ Markers ]]

-- [[ Squad Groups ]]

-- [[ Entity Groups ]]
EGroup_SetInvulnerable(eg_invincible, true)


And my entity group looks like this:

Name: eg_invincible
ID: 4
Num Items: 924
Owner: Team 10001

I have no idea what is wrong as I am still fairly new to map creation. Any help is greatly appreciated!
29 Dec 2019, 13:27 PM
avatar of Janne252
Admin Black Badge
Patrion 15

Posts: 3421 | Subs: 10

Make a copy of the _ID.scar file and remove the _ID part from its name so that the new .scar file matches the name of your .sgb file.

Open the .scar file you just created and replace all of its content with this code:

function Map_OnInit()
EGroup_SetInvulnerable(eg_invincible, true)


Save the map in the World Builder and export package.

This way you don't have to re-add the code to the _ID.scar file as its automatically generated by World Builder and shouldn't be edited by hand anymore (this used to be a workaround a long time ago that is no longer necessary - <map name>.scar works now).

29 Dec 2019, 19:23 PM
avatar of kenney84

Posts: 2

This worked perfectly! Thank you very much!
1 user is browsing this thread: 1 guest

Ladders Top 10

  • #
    Steam Alias
Data provided by Relic Relic Entertainment

Replay highlight

  • Oberkommando West flag Oziligath
  • The British Forces flag T.R. Sidewinder
uploaded by Oziligath

Board Info

104 users are online: 1 member and 103 guests
37 posts in the last 24h
237 posts in the last week
776 posts in the last month
Registered members: 35113
Welcome our newest member, Butterfield11623
Most online: 1221 users on 25 Feb 2020, 12:03 PM