Login

russian armor

Object Invincibility Issue

28 Dec 2019, 21:02 PM
#1
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)

end


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
#2
avatar of Janne252
Admin Black Badge
Patrion 15

Posts: 3421 | Subs: 11

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)
end

Scar_AddInit(Map_OnInit)


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
#3
avatar of kenney84

Posts: 2

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

Livestreams

Offline

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

486 users are online: 486 guests
4 posts in the last 24h
32 posts in the last week
85 posts in the last month
Registered members: 44630
Welcome our newest member, kajalfw8
Most online: 2043 users on 29 Oct 2023, 01:04 AM