How do I add mines to engineer buildables?

I have been trying to add mines to the hammer in the entities.blk, I have gotten to the point where I can see it in the build menu and can see the preview for the mines, but when I build using the hammer nothing spawns.

ger_antipersonnel_mine_preview{
  _use:t="base_animchar_builder_preview"
  animchar__res:t="sprengmine_35_char"
  collres__res:t="sprengmine_35_collision"
  instantiateTemplate:t="ger_antipersonnel_mine"
  avaliableAngles:p2=-30.0, 30.0
  buildingSoundTag:t="cannon"
  building_menu__text:t="Sprengmine 35"
  building_menu__image:t="item_antitank_mine"
  building_builder__maxTimeToBuild:r=1.0
  building_builder__maxUnderwaterDistance:r=0.5
  requiredSpaceAboveObjectOffset:r=0.5
  requiredSpaceAboveObject:r=1.0
  buildingDistance:r=4.0
  buildingCost:r=1.0
  savePreviewTeam:b=yes
  team:i=3
}
1 Like

I tried this in the past and had issues. Namely the mines spawn but they’re invisible. That’s probably the same issue you’re having now.

I experimented with +item_in_world and +placeable_item_in_world, but they caused their own issues. The closest I could get to behaviour I wanted was using +placeable_item_in_world, but then they also activate when your team walks over them. I never overcame that issue and gave up lol.

jp_antitank_mine_preview{
  _use:t="base_animchar_builder_preview"
  _use:t="fortification_builder_info"
  animchar__res:t="type_93_mine_char"
  collres__res:t="type_93_mine_collision"
  instantiateTemplate:t="jp_antitank_mine"
  ri_preview__name:t="jp_antitank_mine"
  buildingSoundTag:t="fortification"
  building_builder__maxTimeToBuild:r=3.0
  building_menu__text:t="Anti-tank Mine"
  building_menu__image:t="item_antitank_mine"
  buildingCost:r=8.0
  building__requireUnlockId:i=-1
}

jp_antipersonnel_mine_preview{
  _use:t="base_animchar_builder_preview"
  _use:t="fortification_builder_info"
  animchar__res:t="type_3_mine_char"
  collres__res:t="type_3_mine_collision"
  instantiateTemplate:t="jp_antipersonnel_mine"
  ri_preview__name:t="jp_antipersonnel_mine"
  buildingSoundTag:t="fortification"
  building_builder__maxTimeToBuild:r=3.0
  building_menu__text:t="Anti-personnel Mine"
  building_menu__image:t="item_antipersonnel_mine"
  buildingCost:r=4.0
  building__requireUnlockId:i=-1
}
1 Like

@Scrotum_Totem you are missing this thing below i think

But it only works in editor, not online.
Also it damages teammates when it explodes, even though it doesn’t trigger on teammate



Maybe we are missing one line, which is this one below.

_use:t="base_fortification_build"

Never tested it but it is present on every buildable thing

1 Like

I’ll revisit it and see how it goes

_use:t="base_fortification_build"

no good

So you can make sure it doesn’t kill your own teammates with this fairly clumsy way. The concept is to make it a placeable_item_in_world, but I don’t know a way to impart your team or your character’s Eid onto the mine. So if you modify placeable_item_in_world this way:

placeable_item_team_1{
	_use:t="placeable_item_in_world"
	placeable_item__ownerTeam:i=1
}

and then in your preview, you add it to your landmine like this:

instantiateTemplate:t="ger_antipersonnel_mine+placeable_item_team_1"

you force the mine to be on one team. The downsides of this solution are: you need two separate previews, one for each team. The second downside is it doesn’t track the landmine kills as yours, they count as environmental kills (because they aren’t assigned to your current character). If anyone knows how to change that second part I’d love to know how :sweat:

Here is the finalised code:

gw_antipersonnel_mine_preview{
  _use:t="base_animchar_builder_preview"
  _use:t="fortification_builder_info"
  animchar__res:t="sprengmine_35_char"
  collres__res:t="sprengmine_35_collision"
  instantiateTemplate:t="ger_antipersonnel_mine+placeable_item_team_1"
  ri_preview__name:t="ger_antipersonnel_mine"
  avaliableAngles:p2=-30.0, 30.0
  buildingSoundTag:t="cannon"
  building_builder__maxTimeToBuild:r=3.0
  building_menu__text:t="Anti-personnel Mine"
  building_menu__image:t="item_antitank_mine"
  building_builder__maxTimeToBuild:r=1.0
  building_builder__maxUnderwaterDistance:r=0.5
  requiredSpaceAboveObjectOffset:r=0.5
  requiredSpaceAboveObject:r=1.0
  buildingDistance:r=4.0
  buildingCost:r=1.0
  building__requireUnlockId:i=-1
}

placeable_item_team_1{
	_use:t="placeable_item_in_world"
	placeable_item__ownerTeam:i=1
}

mines are still completely invisible but they still kill you and can be destroyed by grenades, the weird part is that there is no visible explosion when the mines are killed gonna mess with some things and see if i can get them to be visible. gonna post when i figure out how to make them visible

How annoying :sweat:
Maybe attatching a dummy mine to them might work

Here’s something which might work by creating a dummy mine, then connecting the mine with placeable_in_world and a team modifier attached. (i’m guessing you’re using germany so i’ll make it work for team 2.

placeable_mine_team_2{
	_use:t="placeable_item_in_world"
	placeable_item__ownerTeam:i=2
	building_menu__image:t="item_antipersonnel_mine"
}

gw_buildable_antipersonnel_mine_ger_base{
	_use:t="base_vehicle_decor"
	animchar__res:t="sprengmine_35_char"
	collres__res:t="sprengmine_35_collision"
	"additiveBuildings:array"{
		"item:object"{
			template:t="ger_antipersonnel_mine+placeable_mine_team_2"
			tm:m=[[1, 0, 0] [0, 1, 0] [0, 0, 1] [0, 0, 0]]
			additiveUp:p3=0.0, 1.0, 0.0
		}
	}
}

Then in your preview have it instantiate the template:

instantiateTemplate:t="gw_buildable_antipersonnel_mine_ger_base"

I admit, I haven’t tested it (it’s Australia Day today and I’m going to my mates house for some drinks shortly) and there may be an issue of the mine not being destroyed after the explosion goes off, but this might be one step closer to the right direction.

EDIT: I tested it. It doesn’t work :frowning:

1 Like