Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* This is a sample of a house with two stage destruction (a damaged version and a ruin), two destructible parts, five doors and eight windows */
- #include "cfgPatches.hpp"
- class CfgVehicles
- {
- // Parent class declarations
- class House {};
- class House_F: House {};
- // Class of the house in good state
- class Hunters_Cabin: House_F
- {
- scope = 2; // 2 = public = shown in editor
- displayName = "Hunters Cabin"; // Name in editor
- model = \Builds\Hunters_Cabin.p3d; // Path to model
- icon = "iconStaticObject";
- vehicleClass = Structures; // category in editor; "Structures" value is a class defined in CfgVehicleClasses
- mapSize = 20.27; // Scale of icon in editor
- cost = 40000; // Score penalty for destroying the house
- class AnimationSources
- {
- // Animation sources for doors
- class Door_1_rot
- {
- source = user; // "user" = custom source = not controlled by some engine value
- initPhase = 0; // Initial value of animations based on this source
- animPeriod = 1; // Coefficient for duration of change of this animation
- sound = "GenericDoorsSound"; /// Selects sound class from CfgAnimationSourceSounds that is going to be used for sounds of doors
- };
- };
- // This section defined custom actions for action menu. Each class defined here represent one action. Here we have Open+Close pairs of action for each door (1-5)
- class UserActions
- {
- class OpenDoor_1
- {
- displayNameDefault = "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />"; // This is displayed in the center of the screen just below crosshair. In this case it's an icon, not a text.
- displayName = "Open Door"; // Label of the action used in the action menu itself.
- position = Door_1_trigger; // Point in Memory lod in p3d around which the action is available.
- priority = 0.4; // Priority coefficient used for sorting action in the action menu.
- radius = 1.5; // Range around the above defined point in which you need to be to access the action.
- onlyForPlayer = false; // Defines if the action is available only to players or AI as well.
- condition = ((this animationPhase 'Door_1_rot') < 0.5); // Condition for showing the action in action menu. In this case it checks if the door is closed and if the part of the house in which the door is located hasn't been destroyed yet).
- statement = ([this, 'Door_1_rot'] execVM "\Builds\scripts\fnc_DoorNoHandleOpen.sqf"); // Action taken when this action is selected in the action menu. In this case it calls a function that opens the door.
- };
- class CloseDoor_1: OpenDoor_1
- {
- displayName = "Close Door";
- priority = 0.2;
- condition = ((this animationPhase 'Door_1_rot') >= 0.5); // Checks if the door is currently open and not destroyed.
- statement = ([this, 'Door_1_rot'] execVM "\Builds\scripts\fnc_DoorNoHandleClose.sqf");
- };
- };
- // Here are references binding specific positions in Path lod in p3d to specific actions from "class UserActions" for AI to know when to use which doors. The actionBegin# and ActionEnd# is a hardcoded naming system.
- actionBegin1 = OpenDoor_1;
- actionEnd1 = OpenDoor_1;
- // Amount of doors of this house; a parameter for easy processing of all doors on different houses by scripts.
- numberOfDoors = 1;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement