Forum Jump :

Author Message


Posts: 76
Rank:


Level: Member

Country: au
Location:
Occupation: Student/DIY minor scripter
Age: 23
In-game name: Drew

 
#1 Posted at 2012-11-09 16:06        
     
Heydey there. I am slapping up a zombie mod that I can play with my mates, and i'm gonna start from the ground up. See, what I want to have is be able to walk up to certain things i.e. wrecked cars, piles of stuff etc. and have a loot option. I have achieved this part, as it is the easiest. What I want is it to open the inventory interface when you press loot. Like a container or dead body. Any help would be much appreciated :D

=Foxhound]You can add 250.004 smileys to your post but not a proper title and proper info?[/quote]

Author Message


Posts: 175
Rank:


Level: Member

Country: us
Location: New jersey
Occupation: Flying
Age: 21
In-game name: Starsky396

 
#2 Posted at 2012-11-09 16:15        
     
Try this
:_veh = createVehicle ["Item You want to spawn",getMarkerPos "marker1",["marker2","marker3"], 0, "CAN_COLLIDE"] 
; Or
:_veh = createVehicle ["your new ammobox",getMarkerPos "marker1",["marker2","marker3"], 0, "CAN_COLLIDE"] 
For the second one create a mod that adds a new ammobox with a new classname and replace your new ammobox. Also CAN_COLLIDE makes it so it can collide for a car like you said. Or you can create a new ammobox and skin the ammobox as a object that you want the ammobox as. Then try this without your script and let me know how it went. BTW i'll test your new mod if you want :)

Added 1 minute later:

btw you need to create a trigger and set it as activated as ANYBODY and set both axis's as 0. and put the code in the on activation.

Added 21 minutes later:

I am uploading a demo on another way to spawn loot.

Added 9 seconds later:

Here you go! http://www.mediafire.com/?lbyamid1jel2acm

This post was edited by starsky396 (2012-11-09 16:38, ago)


Advertisement


Author Message


Posts: 76
Rank:


Level: Member

Country: au
Location:
Occupation: Student/DIY minor scripter
Age: 23
In-game name: Drew

 
#3 Posted at 2012-11-09 16:54        
     
Nice, I like that Idea, I'm just thinking if there is a way to make it invisble, but still be there. And change the *rearm at US crate* to loot, to make it less suspect? Also, a way to randomize the weapon drops would be cool. But I havn't had much luck with the *random* function myself... Cheers :)

=Foxhound]You can add 250.004 smileys to your post but not a proper title and proper info?[/quote]

Author Message


Posts: 175
Rank:


Level: Member

Country: us
Location: New jersey
Occupation: Flying
Age: 21
In-game name: Starsky396

 
#4 Posted at 2012-11-09 19:16        
     
Create a new ammobox and rename it?


Author Message


Posts: 20
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2012-11-09 19:17        
     
I found a loot script,not mine, that generates random loot around the map and you can choose what it spawns as it is pretty self explantory and very easy to use here it is (I may upload it to the scripts section of armaholice later) enjoy. P.S If you have trouble trying to use this script ill upload a loot test mission i made that uses it.

usage
copy and paste the script below into a sqf file lets call it weapons.sqf
place the script in the mission folder and place a game logic and
enter "call{[this] execvm "weapons.sqf"};" (without quotations on the ends) in its init

bug
sometimes the loot is there but you cant see it its mostly with ground floor buildings because they spawn under ground
//////////////////////////////////LOOT SCRIPT BY REDFOR-levi//////////////////////////////////////
 
_weapons = ["M16A2","DMR","M4A1_AIM_CAMO","M4A1_AIM","G36K","AK_47_M","M1014","bizon","AK_107_PSO","Bizon_Silenced","VSS_Vintorez","Saiga12K","Huntingrifle","m107","AKS_GOLD","SVD","SVD_Camo","LeeEnfield","","","",""];
 
_items = ["ItemMap","ItemGPS","NVGoggles","Binocular","Binocular_Vector","ItemWatch","ItemCompass","","","","","","","","","","","",""];
 
_med = ["","","","","","","",""];
 
_radio = ["","",""];
 
_pistol = ["Makarov","M9","Colt1911","M9SD","","","","","revolver_EP1",""];
 
_backpack = ["US_Patrol_Pack_EP1","US_Backpack_EP1","CZ_Backpack_EP1","CZ_VestPouch_EP1","US_Assault_Pack_EP1","","","",""];
 
_magazines = ["30Rnd_556x45_Stanag","30Rnd_556x45_G36","7Rnd_45ACP_1911","6Rnd_45ACP","8Rnd_9x18_Makarov","64Rnd_9x19_Bizon","30Rnd_545x39_AK","HandGrenade_East","8Rnd_B_Saiga12_74Slug","20Rnd_762x51_DMR","8Rnd_B_Saiga12_Pellets","10Rnd_762x54_SVD","5x_22_LR_17_HMR","30Rnd_762x39_AK47","8Rnd_B_Beneli_74Slug","8Rnd_B_Beneli_Pellets","10Rnd_9x39_SP5_VSS","20Rnd_9x39_SP5_VSS","15Rnd_9x19_M9","15Rnd_9x19_M9SD","10Rnd_127x99_M107","10Rnd_762x54_SVD","30Rnd_9x19_MP5","30Rnd_762x39_AK47","10x_303","100Rnd_556x45_BetaCMag","30Rnd_762x39_AK47","100Rnd_556x45_BetaCMag","30Rnd_556x45_G36","","","","","","17Rnd_9x19_glock17","","100Rnd_762x51_M240",""];
 
_buildings = nearestObjects [player, ["house"], 50000];
 _markernum = 0;
 {
 _building = _x;
 // search more positions
 _positions = 0;
 _i = 0;
 _loop = 1;
 while {_loop == 1} do
 {
 _next = _building buildingPos _i;
 if (((_next select 0) == 0) && ((_next select 1) == 0) && ((_next select 2) == 0)) then
 {
 _loop = 0;
 } else {
 _positions = _positions + 1;
 _i = _i + 1;
 };
 };
 _posnumber = floor (random _positions);
 _position = _building buildingpos _posnumber;
 if (random 100 > 80) then {
 _weapon = _weapons call BIS_fnc_SelectRandom;
 _mag=(getArray (configFile/"Cfgweapons"/_weapon/"magazines")) select 0;
 _weap = "weaponHolder" createVehicle [0,0];
 _weap addMagazineCargo [_mag,(round (random 2))];
 _weap addWeaponCargo [_weapon,1];
 _weap setPos [(_position select 0),(_position select 1),((_position select 2)-.14)];
 };
 
_posnumber = floor (random _positions);
 _position = _building buildingpos _posnumber;
 if (random 100 > 50) then {
 _weapon = _pistol call BIS_fnc_SelectRandom;
 _mag=(getArray (configFile/"Cfgweapons"/_weapon/"magazines")) select 0;
 _weap = "weaponHolder" createVehicle [0,0];
 _weap addMagazineCargo [_mag,(round (random 2))];
 _weap addWeaponCargo [_weapon,1];
 _weap setPos [(_position select 0),(_position select 1),((_position select 2)-.14)];
 };
 
_posnumber = floor (random _positions);
 _position = _building buildingpos _posnumber;
 if (random 100 > 70) then {
 _weapon = _items call BIS_fnc_SelectRandom;
 _weap = "weaponHolder" createVehicle [0,0];
 _weap addWeaponCargo [_weapon,1];
 _weap setPos [(_position select 0),(_position select 1),((_position select 2)-.14)];;
 };
 
_posnumber = floor (random _positions);
 _position = _building buildingpos _posnumber;
 if (random 100 > 70) then {
 _weapon = _radio call BIS_fnc_SelectRandom;
 _weap = "weaponHolder" createVehicle [0,0];
 _weap addWeaponCargo [_weapon,1];
 _weap setPos [(_position select 0),(_position select 1),((_position select 2)-.14)];;
 };
 
_posnumber = floor (random _positions);
 _position = _building buildingpos _posnumber;
 if (random 100 > 80) then {
 _weapon = _backpack call BIS_fnc_SelectRandom;
 _weap = "weaponHolder" createVehicle [0,0];
 _weap addWeaponCargo [_weapon,1];
 _weap setPos [(_position select 0),(_position select 1),((_position select 2)-.14)];;
 };
 _posnumber = floor (random _positions);
 _position = _building buildingpos _posnumber;
 if (random 100 > 60) then {
 _weapon = _med call BIS_fnc_SelectRandom;
 _weap = "weaponHolder" createVehicle [0,0];
 _weap addMagazineCargo [_weapon,1];
 _weap setPos [(_position select 0),(_position select 1),((_position select 2)-.14)];;
 };
 if (random 100 > 70) then {
 _weapon = _magazines call BIS_fnc_SelectRandom;
 _weap addMagazineCargo [_weapon,(round(random 3))];
 };
 
_posnumber = floor (random _positions);
 _position = _building buildingpos _posnumber;
 
if (random 100 > 70) then {
 _weapon = _magazines call BIS_fnc_SelectRandom;
 _weap = "weaponHolder" createVehicle [0,0];
 _weap addMagazineCargo [_weapon,(round(random 3))];
 _weap setPos [(_position select 0),(_position select 1),((_position select 2)-.14)];;
 };
 
_posnumber = floor (random _positions);
 _position = _building buildingpos _posnumber;
 
if (random 100 > 70) then {
 _weapon = _magazines call BIS_fnc_SelectRandom;
 _weap = "weaponHolder" createVehicle [0,0];
 _weap addMagazineCargo [_weapon,(round(random 3))];
 _weap setPos [(_position select 0),(_position select 1),((_position select 2)-.14)];;
 };
 
_posnumber = floor (random _positions);
 _position = _building buildingpos _posnumber;
 
if (random 100 > 70) then {
 _weapon = _magazines call BIS_fnc_SelectRandom;
 _weap = "weaponHolder" createVehicle [0,0];
 _weap addMagazineCargo [_weapon,(round(random 3))];
 _weap setPos [(_position select 0),(_position select 1),((_position select 2)-.14)];;
 };
 } foreach _buildings; hint "Finished! Unless it didn't work...";

This post was edited by Pirin (2012-11-09 21:14, ago)


Author Message


Posts: 175
Rank:


Level: Member

Country: us
Location: New jersey
Occupation: Flying
Age: 21
In-game name: Starsky396

 
#6 Posted at 2012-11-09 19:23        
     
Here I'll create you a ammobox, you can look at this thread in bistudio for the random loot chance. I'll upload the ammobox in about an hour of so for you. Just put me in the credits.
Thread: http://forums.bistudio.com/showthread.php?139726-Random-weapon-ammo-with-Gamelogic-Using-Weaponholder

Added 1 hour 14 minutes later:

APOtheo, please put the text of the script into a code format so its easier to read.

This post was edited by starsky396 (2012-11-09 20:38, ago)


Author Message


Posts: 76
Rank:


Level: Member

Country: au
Location:
Occupation: Student/DIY minor scripter
Age: 23
In-game name: Drew

 
#7 Posted at 2012-11-10 03:40        
     
Thanks for the link, it was perfect. And yeah, if you have spare time to make that ammobox, that'd be great. If not, that's fine, i'll sort something out :)

=Foxhound]You can add 250.004 smileys to your post but not a proper title and proper info?[/quote]