AustralianSpecialForces 0 Posted February 10, 2005 Does anyone have one they can paste here a Share this post Link to post Share on other sites
Scanger 0 Posted February 11, 2005 This works for me :) This basic config will add the weapon "JMG_HandGrenade" but not a soldier equipped with it. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// type scope #define private 0 #define protected 1 #define public 2 #define WeaponNoSlot 0// dummy weapons #define WeaponSlotPrimary 1// primary weapons #define WeaponSlotSecondary 16// secondary weapons #define WeaponSlotItem 256// items #define WeaponSlotBinocular 4096// binocular #define WeaponHardMounted 65536 class CfgPatches { class JMG_HandGrenade { units[] = {""}; weapons[] = {JMG_HandGrenade}; requiredVersion = 1.40; }; }; class CfgAmmo { class default {}; class Grenade: Default{}; class GrenadeHand: Grenade {}; class JMG_HandGrenade: GrenadeHand { model="\JMG_HandGrenade\JMG_HandGrenade"; //model=handgrenade.p3d; <-normal grenade model soundHit[]={Explosions\expl3,db20,1}; soundFly[]={objects\noise,db-90,1}; hit=20;indirectHit=18;indirectHitRange=7; minRange=40;minRangeProbab=0.10; midRange=45;midRangeProbab=0.30; maxRange=60;maxRangeProbab=0.5; visibleFire=2; // how much is visible when this weapon is fired audibleFire=0.25; visibleFireTime=1; }; }; class CfgWeapons { class Default {}; class MGun: Default {}; class GrenadeLauncher: Default {}; class JMG_HandGrenade: GrenadeLauncher { scopeWeapon = private; scopeMagazine = public; valueWeapon=0; valueMagazine=1; weaponType=0; magazineType=WeaponSlotItem; picture="HandGrenade"; ammo="JMG_HandGrenade"; sound[]={"",1,1}; displayName="JMG HandGrenade"; displayNameMagazine="$STR_MN_HAND_GRENADE"; shortNameMagazine="$STR_SN_HAND_GRENADE"; initSpeed=22; maxLeadSpeed=7; reloadTime=1.5; count=1; reloadSound[]={"",1,1}; autoReload=1; showEmpty=0; canDrop=0; enableAttack=0; aiDispersionCoefX=2.000000; aiDispersionCoefY=2.000000; magazines[]={"JMG_HandGrenade"}; }; }; }; Share this post Link to post Share on other sites
Scanger 0 Posted February 11, 2005 for those who want to add a unit too try this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// some basic defines #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 // type scope #define private 0 #define protected 1 #define public 2 #define WeaponNoSlot 0// dummy weapons #define WeaponSlotPrimary 1// primary weapons #define WeaponSlotSecondary 16// secondary weapons #define WeaponSlotItem 256// items #define WeaponSlotBinocular 4096// binocular #define WeaponHardMounted 65536 class CfgPatches { class JMG_HandGrenade { units[] = {JMG_HandGrenadeSoldier}; weapons[] = {JMG_HandGrenade}; requiredVersion = 1.40; }; }; class CfgAmmo { class default {}; class Grenade: Default{}; class GrenadeHand: Grenade {}; class JMG_HandGrenade: GrenadeHand { //model="\JMG_HandGrenade\JMG_HandGrenade"; model=handgrenade.p3d; //<-normal grenade model soundHit[]={Explosions\expl3,db20,1}; soundFly[]={objects\noise,db-90,1}; hit=20;indirectHit=18;indirectHitRange=7; minRange=40;minRangeProbab=0.10; midRange=45;midRangeProbab=0.30; maxRange=60;maxRangeProbab=0.5; visibleFire=2; // how much is visible when this weapon is fired audibleFire=0.25; visibleFireTime=1; }; }; class CfgWeapons { class Default {}; class MGun: Default {}; class GrenadeLauncher: Default {}; class JMG_HandGrenade: GrenadeLauncher { scopeWeapon = private; scopeMagazine = public; valueWeapon=0; valueMagazine=1; weaponType=0; magazineType=WeaponSlotItem; picture="HandGrenade"; ammo="JMG_HandGrenade"; sound[]={"",1,1}; displayName="JMG HandGrenade"; displayNameMagazine="$STR_MN_HAND_GRENADE"; shortNameMagazine="$STR_SN_HAND_GRENADE"; initSpeed=22; maxLeadSpeed=7; reloadTime=1.5; count=1; reloadSound[]={"",1,1}; autoReload=1; showEmpty=0; canDrop=0; enableAttack=0; aiDispersionCoefX=2.000000; aiDispersionCoefY=2.000000; magazines[]={"JMG_HandGrenade"}; }; }; class CfgVehicles { class All{}; class AllVehicles:All{}; class Land:AllVehicles{}; class Man:Land{}; class Soldier:Man{}; class SoldierWB : Soldier{}; class JMG_HandGrenadeSoldier:SoldierWB { displayName = "JMG HandGrenade Soldier"; weapons[]={"m16","NVGoggles","Binocular","JMG_HandGrenade","Put","StrokeGun","StrokeFist"}; magazines[]={"m16","m16","m16","m16",JMG_HandGrenade,JMG_HandGrenade,JMG_HandGrenade,JMG_HandGrenade, JMG_HandGrenade, JMG_HandGrenade}; }; }; }; Share this post Link to post Share on other sites
Rommel 2 Posted February 11, 2005 Now how do I make it so when it hits it doesnt hurt anyone, and when it hits it execs a script. Your really helpfull. Share this post Link to post Share on other sites
oyman 0 Posted February 12, 2005 see this code <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">hit=20;indirectHit=18;indirectHitRange=7; change it to <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">hit=.0000001;indirectHit=.001;indirectHitRange=.001; something like that Share this post Link to post Share on other sites
Scanger 0 Posted February 12, 2005 lol, now that script bit sounds interesting, slightly over my head though. i would assume that you could use eventhandlers with the init or fired commands to do it. i was in the middle of testing this earlier but the power went out, and i'm using the laptop now so still got no access to ofp stuff on my main comp, i'll try again tomorrow but it was tough...the fired eventhandler was registering for all weapons rather than just the grenade which would need to be sorted, i think eventhandlers have to be in the cfgvehicles section so the unit would exec the script rather than the weapon, but i'll see what happens. as far as the power of the grenade..what oyman suggested should be fine. ;) Share this post Link to post Share on other sites
Scanger 0 Posted February 15, 2005 ok, after i played around a bit I found a way to get a script to run when the grenade is thrown but not when it impacts yet...i'll give the code Eventhandlers(cfgVehicles) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class eventhandlers { fired ="[_this select 0, _this select 1, _this select 4] exec ""\JMG_HandGrenade\Scripts\test.sqs"""; }; the script itself <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_player    = _this Select 0 _weapon    = _this Select 1 _ammotype   = _this Select 2 ?((_weapon == "JMG_HandGrenade") && (_ammotype == "JMG_HandGrenade")): _player GroupChat "JMG_Handgrenade is current weapon and ammo type" i just use the chat to visibly see that my script is running. change according to what u need i modified the above cpps too cos i noticed that the actual pic in the gear page wasn't available Share this post Link to post Share on other sites
Scanger 0 Posted February 15, 2005 moving flashbang script to it's own thread so it gets more attention ;) Share this post Link to post Share on other sites