Author Topic: Help with spawning a object  (Read 996 times)

0 Members and 1 Guest are viewing this topic.

Jagfreeze

  • Intentional Cheater
  • **
  • Posts: 27
    • View Profile
Help with spawning a object
« on: June 06, 2012, 09:49:48 am »
So say I wanted to spawn a "object". Can I get any hints on how I would start the code? More specifically trying to spawn a M136 Rocket Launcher and a AmmoBoxSmall_762
« Last Edit: June 06, 2012, 12:04:41 pm by Jagfreeze »

daleeb

  • Intentional Cheater
  • **
  • Posts: 45
    • View Profile
Re: Help with spawning a object
« Reply #1 on: June 06, 2012, 12:00:59 pm »
This would do the trick

player addWeapon "RPG7V";
player addMagazine "PG7V";

Jagfreeze

  • Intentional Cheater
  • **
  • Posts: 27
    • View Profile
Re: Help with spawning a object
« Reply #2 on: June 06, 2012, 12:05:05 pm »
But that would spawn the RPG7, I want the AT4 to spawn in the weapon crate but I can't get it to work
« Last Edit: June 06, 2012, 12:20:17 pm by Jagfreeze »

DanDiDo

  • Cheater Apprentice
  • *
  • Posts: 19
    • View Profile
Re: Help with spawning a object
« Reply #3 on: June 06, 2012, 12:45:55 pm »

cairney

  • Relentless Teamkiller
  • **
  • Posts: 58
  • There's no certainty ? only opportunity.
    • View Profile
Re: Help with spawning a object
« Reply #4 on: June 06, 2012, 12:52:16 pm »
Use this code by buster to spawn an ammo box in Day Z:


ammo.sqf
Code: [Select]
_abox = "AmmoBoxBig" createVehicle (position player);

[_abox] execVM "\script\cargo.sqf";

cargo.sqf
Code: [Select]
_abox = _this select 0;
_dayz_wep =["M14_EP1","Remington870_lamp","M4A3_CCO_EP1","M4A1_AIM_SD_camo","BAF_L85A2_RIS_CWS","BAF_AS50_scoped","Winchester1866","LeeEnfield","revolver_EP1","FN_FAL","FN_FAL_ANPVS4","m107_DZ",
   "Mk_48_DZ","DMR","M16A2","M16A2GL","bizon_silenced","AK_74","M4A1_Aim","AKS_74_kobra","AKS_74_U","AK_47_M","M24","M1014","M4A1","MP5SD","MP5A5","huntingrifle","Crossbow","glock17_EP1","M9",
   "M9SD","Colt1911","UZI_EP1","Binocular","Binocular_Vector","NVGoggles","ItemGPS","ItemMap","ItemCompass","ItemWatch","ItemFlashlight","ItemFlashlightRed","ItemKnife","ItemHatchet","ItemMatchbox",
   "ItemEtool","ItemToolbox"];

_dayz_mag =["30Rnd_556x45_Stanag","30Rnd_556x45_StanagSD","20Rnd_762x51_DMR","30Rnd_762x39_AK47","5Rnd_762x51_M24","10Rnd_127x99_m107","8Rnd_B_Beneli_74Slug","1Rnd_HE_M203","FlareWhite_M203",
   "FlareGreen_M203","1Rnd_Smoke_M203","200Rnd_556x45_M249","8Rnd_B_Beneli_Pellets","30Rnd_9x19_MP5","30Rnd_9x19_MP5SD","100Rnd_762x51_M240","15Rnd_W1866_Slug","5x_22_LR_17_HMR",
   "10x_303","15Rnd_9x19_M9","15Rnd_9x19_M9SD","7Rnd_45ACP_1911","17Rnd_9x19_glock17","8Rnd_9x18_Makarov","6Rnd_45ACP","8Rnd_9x18_Makarov","BoltSteel","PipeBomb","HandGrenade_west",
   "FoodSteakRaw","FoodSteakCooked","FoodCanBakedBeans","FoodCanSardines","FoodCanPasta","ItemSodaCoke","ItemSodaPepsi","ItemWaterbottle","HandRoadFlare","HandChemGreen","HandChemBlue",
   "HandChemRed","ItemSandbag","ItemTankTrap","ItemWire","ItemBandage","ItemPainkiller","ItemMorphine","ItemEpinephrine","ItemAntibiotic","ItemBloodbag","ItemHeatPack","PartWoodPile","PartWheel",
   "PartFueltank","PartGlass","PartEngine","PartGeneric","PartVRotor","ItemJerrycan","ItemGenerator","ItemTent","Skin_Soldier1_DZ","Skin_Survivor2_DZ","Skin_Camo1_DZ","Skin_Sniper1_DZ"];

_dayz_bpk =["DZ_Patrol_Pack_EP1","DZ_Assault_Pack_EP1","DZ_CivilBackpack_EP1","DZ_ALICE_Pack_EP1","DZ_Backpack_EP1"];

{_abox addWeaponCargo [_x,100];} forEach _dayz_wep;
{_abox addMagazineCargo [_x,100];} forEach _dayz_mag;
{_abox addBackpackCargo [_x,2];} forEach _dayz_bpk;


Save each as what he wrote above the code and don't forget to save it as type all. Then to load it load ammo.sqf which will automatically call on cargo.sqf and spawn you an ammo box.
« Last Edit: June 06, 2012, 12:57:19 pm by cairney »

Jagfreeze

  • Intentional Cheater
  • **
  • Posts: 27
    • View Profile
Re: Help with spawning a object
« Reply #5 on: June 06, 2012, 12:53:46 pm »
If your interested in doing it in Day Z you can't really because the weapon isn't in Day Z, so you will be kicked.
It is in DayZ. It spawns at the military barracks.

Try this tutorial made by LongDong:
http://tkc-community.net/forum/index.php?topic=10943.0

Yeah I am using the code that LongDong posted and it works great, just that when I add the M136 (AT4) it wont show up in the crate.

cairney

  • Relentless Teamkiller
  • **
  • Posts: 58
  • There's no certainty ? only opportunity.
    • View Profile
Re: Help with spawning a object
« Reply #6 on: June 06, 2012, 12:57:50 pm »
If your interested in doing it in Day Z you can't really because the weapon isn't in Day Z, so you will be kicked.
It is in DayZ. It spawns at the military barracks.

Try this tutorial made by LongDong:
http://tkc-community.net/forum/index.php?topic=10943.0

Yeah I am using the code that LongDong posted and it works great, just that when I add the M136 (AT4) it wont show up in the crate.

Thanks amended my post didn't think it was, but look up the class name for the gun/magazine have a look at that code and you should be able to add it to the ammo box if it is in Day Z.

skylmt666

  • Relentless Teamkiller
  • **
  • Posts: 75
    • View Profile
Re: Help with spawning a object
« Reply #7 on: June 06, 2012, 03:18:28 pm »
If your interested in doing it in Day Z you can't really because the weapon isn't in Day Z, so you will be kicked.
It is in DayZ. It spawns at the military barracks.

Try this tutorial made by LongDong:
http://tkc-community.net/forum/index.php?topic=10943.0

Yeah I am using the code that LongDong posted and it works great, just that when I add the M136 (AT4) it wont show up in the crate.

Thanks amended my post didn't think it was, but look up the class name for the gun/magazine have a look at that code and you should be able to add it to the ammo box if it is in Day Z.


Did u create the crate with notepad? or another program?
LOLE'D

MrMedic

  • MasstKer
  • ********
  • Posts: 8900
  • programmer/dev/software engineer
    • View Profile
Re: Help with spawning a object
« Reply #8 on: June 06, 2012, 06:48:41 pm »
i dont like spoon feeding ......but your having problems and its obvious your not going to work it out on your own so heres a tutorial.

Blahhh = createvehicle ["USBasicAmmunitionBox", position player, [], 0, "NONE"];
Blahhh addweaponcargo ["M14_EP1", 99]
Blahhh addweaponcargo ["M4A1", 99];

it works like this.
Blahhh << gets the object linked to it

Blahhh ( is now the box ) addweaponcargo ( adds the next string defined in bi's wonderfully fantastic 'config' classes to the box ) "M14_EP1" , then the amount to add to the box ( 99 ).

check for the mistake ( if someone posts how to fix the error then they are not helping you they will be hindering you but whatever ).

good luck.  :smile
EnCoded Message: i3iy9yl8kr2xf3g2Txs3pr6ye3ya7jg5ty2z

https://www.youtube.com/watch?v=62_7-AYfdkQ
you need a paypal account for the private versions.

Website:
http://bit.ly/medic101

Teamspeak 3: 85.236.101.5:10157