Jump to content
Sign in to follow this  
JOHNBELLO

Overwriting A3's scripts?

Recommended Posts

Hello.

I'd like to add a sound that's played when a player opens a door.

I found pretty easily the action that opens a door, that's basically a script located here: \A3\Structures_F\scripts\Door_open.sqf

Every building has a userActions section with a statement referring to that file, so there would be 2 ways to manage this - but i am not sure if either of these will work, so that's why i am asking here.

Either, and that one seems the most likely to work but also would mean a huge amount of work to add this for every building with a door:

Add every building to my config, overwrite the statement with a new script somewhere located in my mod, add a sound to the exisiting open_door code, done.

Or, and that is basically what i am trying to find out, since it is way easier and way more editable, to just overwrite the executed script that actually opens the door.

Is that somehow possible? Ofcourse i cannot "hook" into the arma3 pbo's and change them there, but something like creating the same path in our mod file or adding an own mod for this?

Would be cool if someone's able to help me out here on how to achieve this - thanks!

Share this post


Link to post
Share on other sites

Can't you set up a trigger that checks if a door has been opened and then plays the sound?

Share this post


Link to post
Share on other sites

How would that look like? I mean that would be an event handler, right? Is there something to check for used actions or something?

Share this post


Link to post
Share on other sites

Do you want this to be just a script?

With a replacement config you could replace current door sounds with your custom ones.

E: for your question about the EH, no there is no such EH...

You would need to check the animation state of the door, but this is dirty and performance heavy.

Edited by Lappihuan

Share this post


Link to post
Share on other sites

Well, there are no current door sounds so there is nothing to replace if i understood that correctly.

And i don't really care if it is a script or a config, in the end it's about the work - i mean, if i change the config it's easy to point it onto a script that i created but i'd have to do that for every single building in said custom config -that's what i want to prevent because it is 1. a lot of work and 2. afterwards a hell more of work to change something if needed.

That's why i thought it might be possible to overwrite that door_open.sqf script file so that the statement part of the UserAction opens my script that has basically kind of the same path as the original one.

Share this post


Link to post
Share on other sites

So, since nothing's happening in this thread i tried to manually add it the 'much work' way and add a sound to one house.

Since i don't know that much about configs i ran into some trouble and thought i just post it here in hopes of someone being able to help.

This is what i did in my CfgVehicles.hpp (thats obviously included in my config.cpp)

class CfgVehicles {
class Land_Cargo_House_V1_F {
	class UserActions {
		class OpenDoor_1 {
			condition = "((this animationPhase 'Door_1_rot') < 0.5) && ((this getVariable ['bis_disabled_Door_1',0]) != 1)";
			displayName = "Open door SOUND";
			displayNameDefault = "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
			onlyForPlayer = 0;
			position = "Door_1_trigger";
			priority = 0.4;
			radius = 1.5;
			statement = "([this, 'Door_1_rot'] execVM \modname\script\doorOpen.sqf)";
		};
	};
};
};

(What i did here is basically adding every line that exists in the config viewer under the "Land_cargo_House_V1_F > UserActions > OpenDoor_1" part)

The statement part is where i put my script to open the door, basically just copied the code from the original arma3 script file for it.

Was able to bake the mod without errors, but on starting arma it tells me "No entry 'bin\config.bin/CfgVehicles/Land_cargo_House_V1_F.simulation'."

Logfile spits basically the same: No simulation: Land_Cargo_House_V1_F

House exists ingame but i am obviously not able to access any doors now.

Any ideas on how to fix it? Something i've missed?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×