cervantes 330 Posted August 19, 2021 hi here i have not find on this forums how use hitpart event handler with config cpp. after one long search for working a script dammage by selection on static weapons i have encoutering the followed troubls. the arma3 engine do not implementing a basic hitpoints config for vehicle in static weapons config. and the config cpp with hitpoints defined not working for that reason. for this tutorial i use one search light static weapon. the config Reveal hidden contents #define TEast 0 #define TWest 1 #define TGuerrila 2 #define TCivilian 3 #define TSideUnknown 4 #define TEnemy 5 #define TFriendly 6 #define TLogic 7 #define true 1 #define false 0 #define private 0 #define protected 1 #define public 2 class CfgPatches { class ww2_searchlight { units[] ={"ww2_searchlight"}; weapons[] = {}; requiredVersion = 0.1; requiredAddons[] = {"A3_Static_F","A3_Static_F_Gamma"}; }; }; //------------------------------------------------------------------------------------ class CfgVehicleClasses { class MG_nest { displayName = Searchlight Nest; side = 3; }; }; //------------------------------------------------------------------------------------ class CfgSounds { class glass { name = "Search_light_glass"; sound[] = {"\searchlight\sounds\glass.wav", 2.000000, 2.000000,30}; titles[] = {}; }; }; //------------------------------------------------------------------------------------ class CfgVehicles { class Land; class LandVehicle: Land { class ViewPilot; class NewTurret; }; class StaticWeapon: LandVehicle { class Turrets { class MainTurret; }; }; class StaticSEARCHLight: StaticWeapon { accuracy=0.12; cost=1000; threat[]={0.1,0.1,0.1}; class HitPoints { class HitTurret; class HitGun; class HitGlass; }; class Turrets: Turrets { class MainTurret: MainTurret { class ViewOptics; turretInfoType="RscOptics_Offroad_01"; }; }; }; class ww2_searchlight: StaticSEARCHLight { armor = 90; destrType=DestructMan; Type=WeaponHardMounted; model = "\searchlight\searchlight"; vehicleClass = MG_nest; displayName = Searchlight Nest; accuracy = 1000; /// temporary WF solution collisionLight = true; pilotLight = true; side = 3; scope = 2; irScanRangeMin = 10; irScanRangeMax = 4000; irScanToEyeFactor = 5; driverIsCommander = true; picture="\searchlight\pic.paa"; icon= "\searchlight\pic.paa"; editorPreview = "\searchlight\pic.jpg"; mapSize = 7; class Reflectors { class Spot_Light { position = "light_point"; direction = "light_dir"; hitpoint = "light_point"; selection = "light_point"; color[] = {7000,7500,10000}; ambient[] = {70,75,100}; intensity = 1000; size = 1; innerAngle = 5; outerAngle = 35; coneFadeCoef = 10;//10 useFlare = 1; flareSize = 25; flareMaxDistance = 2500; blinking=0; dayLight = 0; class Attenuation { start = 0; constant = 0; linear = 0.1; quadratic = 0; hardLimitStart = 800; hardLimitEnd = 1000; }; }; }; aggregateReflectors[] = {{"Spot_Light"}}; class Turrets: Turrets { class MainTurret: MainTurret { primaryobserver = 1; commanding = 2; primarygunner = 1; hasDriver = 1; proxyIndex = 1; proxyType = "CPgunner"; gunnerType="O_Soldier_F"; gunBeg = "ws_muzzle"; gunEnd = "ws_end"; body = "ws_turret"; gun = "ws_Gun"; selectionFireAnim = "ws_end"; animationSourceBody = "ws_turret"; animationSourceGun = "ws_Gun"; ejectDeadGunner = 0; gunnerName = "Searchlight"; memoryPointGun = "ws_muzzle"; memoryPointGunnerOptics = "eye"; outGunnerMayFire = 1; inGunnerMayFire = 1; gunnerOpticsModel = "\A3\weapons_f\reticle\optics_empty"; startEngine = 0; minElev=0; maxElev=45; initElev=0; minTurn=-180; maxTurn=+180; initTurn=0; //weapons[]={"Binocular"}; weapons[]={"fakeweapon"}; magazines[]={}; gunnerAction = "Commander_APC_tracked_01_crv_out"; gunnerOpticsShowCursor = 1; lockSeekRadius = 1500; // gunnerForceOptics = true; hideWeaponsGunner = true; class ViewOptics: ViewOptics { initAngleX=0; minAngleX=-30; maxAngleX=30; initAngleY=0; minAngleY=-100; maxAngleY=100; initFov=0.75; minFov=0.25; maxFov=2.25; visionMode[]= { "Normal" }; }; //gunnerRightHandAnimName="hand_pos"; //gunnerLeftHandAnimName="hand_pos"; }; }; class EventHandlers { init = "[_this select 0] execvm ""\searchlight\scripts\init.sqf"";"; HitPart = "[(_this select 0 select 0),(_this select 0 select 5)] execvm ""\searchlight\scripts\hitpart.sqf"";"; }; class HitPoints : HitPoints { class HitTurret : HitTurret { armor = 0.3; material = -1; name = "ws_turret"; visual = ""; passThrough = 0; displayName = "ws_turret"; }; class HitGun : HitGun { armor = 0.3; material = -1; name = "ws_Gun"; visual = "ws_Gun"; passThrough = 0; }; class HitGlass : HitGlass { armor = 0; material = -1; name = "HitGlass"; visual = "HitGlass"; displayName = "HitGlass"; passThrough = 0; }; }; class AnimationSources { class lightflash{source="reload";weapon="fakeweapon";}; class HitGlass{source="HitGlass";weapon="fakeweapon";}; }; }; }; }; the model .cfg Reveal hidden contents class CfgSkeletons { class Default { isDiscrete = 1; skeletonInherit = ""; skeletonBones[] = {}; }; class searchlight : default { skeletonBones[]= { "Hand_pos","", "HitGlass","ws_Gun", "light_cone","ws_Gun", "ws_turret","", "ws_Gun","ws_turret" }; }; }; class CfgModels { class Default { sectionsInherit = ""; sections[] = {}; skeletonName = ""; }; class searchlight : Default { skeletonName="searchlight"; sections[] = {"zbytek","HitGlass","Hand_pos"}; class Animations { class ws_Gun { type="rotationX"; source="ws_Gun"; selection="ws_Gun"; axis="gun_axis"; animPeriod=0; memory=1; minValue="rad 0"; maxValue="rad +85"; angle0="rad 0"; angle1="rad +85"; }; class ws_turret { type="rotationY"; source="ws_turret"; selection="ws_turret"; axis="turret_axis"; minValue="rad -180"; maxValue="rad +180"; angle0="rad -180"; angle1="rad +180"; }; class lightflash { type="hide"; source="collisionLights"; selection="light_cone"; sourceAddress="loop"; minValue=0; maxValue=1; memory=0; hideValue=0; unHideValue=0.5; }; class HitGlass { type="hide"; source="HitGlass"; selection="HitGlass"; minValue=0; maxValue=1; hideValue=1; }; }; }; }; i fix this troubls with hitpart event handler in my config. now we can fix the attention on the hitpart event handler because that working perfectly for detecting a selection hit 😉 in script we need define if a selection hit is Hitglass. the selection is returned same to one array element for that we need return the selection array and the element in this array. the script Reveal hidden contents _spotlight = _this select 0; _sel = _this select 1; if (_sel select 0 == "HitGlass") exitwith { _spotlight animate ["hitglass", 1]; _ExplodeArray = ["searchlight\sounds\glass.wav"]; _Explode = selectRandom _ExplodeArray; playsound3d [format ["%1",_Explode], _spotlight,false, getPosASL _spotlight, 7, 1, 25]; }; if you use (_sel == "HitGlass") that return one error because the element is not corectly identified but with (_sel select 0 == "HitGlass") you identify coretly the selection hited by projectiles 😉 friendly Cervantes. Share this post Link to post Share on other sites