Hello, I'm a beginner mod maker. I've been doing this for almost a year now and have studied the game code well. But I just can't solve one problem: how to bind the placement of an object to another object. For example, a bomb in the middle of the fence. The code I wrote:
class ActionActivateBoomSystem: ActionDeployObject
{override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item ) { if ( !GetGame().IsMultiplayer() || GetGame().IsClient() ) { if ( player.IsPlacingLocal() ) { if ( !player.GetHologramLocal().IsColliding() ) { EntityAI targetEntity = EntityAI.Cast(target.GetObject()); if (targetEntity) { if (targetEntity.IsKindOf("Fence") { return true; } } } } return false; } return true; } override bool HasTarget() { return true; }}
I want the hologram of the placed object to automatically snap to the center of the fence the player is looking at, rather than being placed on the ground. My object inherits from landminetrap. I would add more code, but I tried to override so many functions that I ended up confused and erased everything.
P.S. for 2 days of wandering in action files, I got completely confused.
P.P.S Sorry for Google Translator.