Favonias 0 Posted March 9 Hi, I'm interested in learning how to script in ARMA Reforger. How do I make a script that allows you to place a campfire by double clicking something in inventory? Share this post Link to post Share on other sites
thy_ 164 Posted April 29 On 3/8/2024 at 11:33 PM, Favonias said: How do I make a script that allows you to place a campfire by double clicking something in inventory? First, you are welcome here. Second, always set a more specific title for your topic. This will help us to help you faster and better. Do you have some snippets of your code to share? I presume you have some as you apparently know how to implement a code in Reforger. If you don't, here is a good start to help you describe better what you wanna do: https://community.bistudio.com/wiki/Arma_Reforger:From_SQF_to_Enforce_Script Share this post Link to post Share on other sites
Favonias 0 Posted November 27 Quote modded class SCR_BaseGameMode { private ref CustomInputManager m_InputManager; protected override void OnInit(IEntity owner) { super.OnInit(owner); // Initialize the custom input manager m_InputManager = new CustomInputManager(); m_InputManager.RegisterActions(); // Register the key press event for placing the campfire GetGame().GetInputManager().AddActionListener("PlaceCampfire", EActionType::ACTION_PRESSED, this, "OnPlaceCampfireKeyPress"); } void OnPlaceCampfireKeyPress() { // This method will call the logic to place the campfire OnPlaceCampfire(); } void OnPlaceCampfire() { // Path to the campfire prefab ResourceName campfirePrefab = "Assets\Campfire_burning.et"; // Replace with the actual path // Get the player's position IEntity player = GetGame().GetPlayerController().GetControlledEntity(); if (player) { vector playerPos = player.GetOrigin(); // Spawn the campfire at the player's position IEntity campfireEntity = GetGame().SpawnEntityPrefab(Resource.Load(campfirePrefab), playerPos, ETransformMode.WORLD); } } } Here's the main code I'm working with. I made a CustomBaseGameMode file and CustominputManager file. Everything compiles, but it doesn't work in game: the player presses 'F' and a campfire appears. Am I using the wrong asset? Share this post Link to post Share on other sites
Depechivo 0 Posted December 15 "Assets\Campfire_burning.et" very strange path, first once - slash is wrong, second one - prefab is Assets folder. All prefabs in "Prefabs" folder. Try this "{899360C930DA3EE3}Prefabs/Particles/Campfire_burning.et" On future: right mouse click -> "Copy resource name(s)" on prefab to get path to it Check logs and use checks in code: Resource resource = Resource.Load(prefabResourceName); if (!resource.IsValid()) { Print("Cant load prefab"); return; } And very strange design to use "modded" class. Create own component and attach it to GameMode or player. Share this post Link to post Share on other sites