Page 1 of 1

Placing damaged units on maps?

Posted: Fri Nov 09, 2012 5:37 pm
by GottaLove88s
Is there a way to place a unit, eg. a Sherman tank, on a user gen map... and then damage it... so that it's just interesting mapwork and doesn't count/work as an active unit?

I thought I'd seen this somewhere, but I can't find it now...

Re: Placing damaged units on maps?

Posted: Fri Nov 09, 2012 8:17 pm
by pipfromslitherine
It's a feature that has been asked for, but it's not quite as simple to implement as I had hoped. It's on the wishlist, but not done as yet. You can do it via scripting, but adding a unit then killing it, but that can mess up the kill tallies.

Cheers

Pip

Re: Placing damaged units on maps?

Posted: Fri Nov 09, 2012 9:01 pm
by GottaLove88s
Aw that's too bad... thanks anyhow Pip :-)

Re: Placing damaged units on maps?

Posted: Fri Nov 09, 2012 11:14 pm
by Richcat
GL88 As Pip said it can be done - Have a look here viewtopic.php?f=104&t=18658- about placing destroyed objects- Thanks again to Merr & J2d

Re: Placing damaged units on maps?

Posted: Sat Nov 10, 2012 7:22 am
by GottaLove88s
WOW, thanks Richcat. That's a clever way to do it. If I understand correctly, using Merr's technique we can place damaged objects directly from within the editor, without any scripting and it won't affect the KIAs (We need accurate KIAs for a campaign we're running). Nice! Will try out later today...

Re: Placing damaged units on maps?

Posted: Sat Nov 10, 2012 9:38 am
by kingt
But if you place damaged tanks on the map, they should be removable by players in order to clear a path, just as 'regular' tanks are when destroyed.

Re: Placing damaged units on maps?

Posted: Sat Nov 10, 2012 9:43 am
by GottaLove88s
I think Merr/Richcat's code includes a FADE command, which makes the Sherman automatically disappear once a unit moves into it...
Am not sure, but if we delete the FADE command, I assume another unit could be ordered to remove the damaged Sherman, as normal?

Re: Placing damaged units on maps?

Posted: Sat Nov 24, 2012 3:39 pm
by GottaLove88s
Guys, I'm using Merr's technique to add destroyed objects to a battle map.

See Merr's explanation of "how to", posted 30 Aug 2010 14:56, here -> viewtopic.php?f=104&t=18658
This works to add destroyed unit objects to a map. But it seems to add simple static 3d graphics. These don't interact with live units.
I can place damaged Shermans, Marders, pretty much anything solid (ie. not dead infantry).

My Objects.txt file has:
[SHERMAN_0]
BLOCKING
FADE
repeated for each of the destroyed unit objects that I want to include.

But when vehicles/infantry move into the space of a destroyed unit they just merge with its destroyed image, rather than fading it.
There is no extra cover, and no option to "remove" the destroyed unit... and if the unit moves out of that space, the destroyed unit image remains.

Any ideas anyone?
:?

Image

Re: Placing damaged units on maps?

Posted: Mon Nov 26, 2012 11:50 am
by Amaris
For this you need to put a valid (and living) unit to your map.
And kill it with script into FUNCTION PreBattleSetup().

the easiest way is to retrieve the coordinates of the tile:

Code: Select all

FUNCTION PreBattleSetup()
{
...
int id;

	id = GetUnitOnTile(TILEX, TILEY); //Remplace Tilex and Tiley by the coordinates of the tile.
	
	if (id != -11)
	{
		DestroyUnit(kill, 255) ;
	}
}

Re: Placing damaged units on maps?

Posted: Mon Nov 26, 2012 12:40 pm
by GottaLove88s
Thanks Amaris, that looks a slick way to do what I want.
Is the condition always set to look for if (id != -11)? Does the -11 signify anything I need to be aware of?

Will this code add that killed unit to the Killed in Action (KIA) summary? If yes, is there a way to reset the KIAs back to zero for both sides, so this unit won't show there?

Merci encore :-)

Re: Placing damaged units on maps?

Posted: Mon Nov 26, 2012 12:51 pm
by Amaris
-11 is wrong :shock:
Remplace it with only -1 :oops:

because the function GetUnitOnTile() work as :
//return an id for the unit on a tile, -1 for none

Re: Placing damaged units on maps?

Posted: Mon Nov 26, 2012 1:02 pm
by GottaLove88s
Thanks again Amaris...

Do you know if the code will add that killed unit to the Killed in Action (KIA) summary?
If yes, is there a way to reset the KIAs back to zero for both sides, so this unit won't show there?

Sorry to ask many foolish questions...

Re: Placing damaged units on maps?

Posted: Mon Nov 26, 2012 1:15 pm
by Amaris
I don't known but there is a good chance that yes it is counted...
And I don't have any idea how to reset the KIAs back to zero.

Beware, there's another error in the script:

Code: Select all

FUNCTION PreBattleSetup()
{
...
int id;

   id = GetUnitOnTile(TILEX, TILEY); //Remplace Tilex and Tiley by the coordinates of the tile.
   
   if (id != -1)
   {
    DestroyUnit(id, 255) ; 
   }
}

Re: Placing damaged units on maps?

Posted: Mon Nov 26, 2012 1:21 pm
by GottaLove88s
Merci Amaris, that's perfect! I'll ask about resetting KIAs on another post... to see if anyone knows how... :-)

Re: Placing damaged units on maps?

Posted: Mon Nov 26, 2012 1:22 pm
by Richcat
You can also add Terrain types to your damaged unit such as Wreak, LighFortifications, HeaveyFortifications, RoughGround, Water etc etc to get different types of cover . This overides the underlying tile type
Just add TERRAIN Wreak or whatever you choose could be HighVegetation from the Terrain.txt file to the Object Text file

The Terrain.TXT file types can be found in the most of the main campaign folders. Here's an example of a part of the Terrain.txt file with options that can be adjusted. I believe you can create your own, when you get the hang of it - haven't done it my self yet.
[LightFortifications]
INFANTRY 4
TRACKED 100
HALFTRACK 100
ARTILLERY 4
WHEELED 100
BOAT 100
AMPHIBIOUS 100
COVERFLAGS 1 // can infantry hide in this terrain
COVERVALUE0 25 // % damage inflicted if target is stationary
COVERVALUE1 40 // % damage inflicted if target is moving
COVERVALUE2 50 // % chance of getting bogged down when starting turn in this terrain * % chance of bogging so this /5 /10 is about the right amount.
COVERVALUE3 1 // is this a fortification?
// if covervalue0 is greater than 40 it means you cannot inflitrate. Roads & tracks should be less than 40.