Jump to content
Sign in to follow this  
Deg

adding money

Recommended Posts

lol i tried it again and it didnt work, before when i shot the guy in the car it worked but i couldnt salvage one of the 3 guys standing around and this time around i blew up the tank before the guys got out but i could still salvage the tank :) its all good, its like you cant always find stuff worth salvaging :)

Share this post


Link to post
Share on other sites

So i was tinkering around a bit and thought there would be alot of useful stuff to salvage on the empty side, like woodpiles, iron pipes and such, so to start off why not try and use some of the empty side Wrecks to salvage, so in the addsalvage.sqf i put, case (_salvagedItem isKindOf "UralWreck"): {_amount = 20;}; and in the init line of the wreck i put, UralWreck addAction ["Salvage","addSalvage.sqf"]; i named the wreck "UralWreck" i tried it out and sure enough it worked :). Now if i wanted to have a bunch of ural wrecks scattered around my map instead of naming them all wreck1,2 and so on, would i need to put an addaction for the ural wrecks in my init.sqf ?

Share this post


Link to post
Share on other sites

You shouldn't have to do anything with the init lines as long as UralWreck is the correct classType of that wreck object. (For OA it might be UralWrack_EP1 maybe?)

But yeah, try it with that extra line in the init.sqf like you have and see if it works. I'm stupid busy at work right now, so can't really test, but give it a shot and I'll take a look tonight. :)

Share this post


Link to post
Share on other sites

Great thanks, i just wasnt to sure if thats what i needed to do, ill give it a shot :)

Share this post


Link to post
Share on other sites

I got busy earlier, so i just tried it out now with the extra line but didnt work, did i put UralWreck addAction ["Salvage","addSalvage.sqf"];in the right place? im still trying to figure it out though :)

// START OF COIN SETTINGS
myMoney = 1000;

myCoin setvariable ["BIS_COIN_name","Base"];
myCoin setvariable ["BIS_COIN_rules",[player]];
myCoin setvariable ["BIS_COIN_areasize",[50,50]]; 
myCoin setvariable ["BIS_COIN_categories",["Base", "Defence"]]; 
myCoin setvariable ["BIS_COIN_items",
[
	//--- Class, Category, Cost or [fundsID,Cost], (display name)
	["US_WarfareBBarracks_Base_EP1","Base",200,"Barracks"],
	["US_WarfareBFieldhHospital_EP1","Base",400],
	["US_WarfareBHeavyFactory_EP1","Base",600],
	["WarfareBMGNest_M240_US_EP1","Defence",100]
]
];
myCoin setvariable ["BIS_COIN_funds",["myMoney"]];
myCoin setvariable ["BIS_COIN_fundsDescription",["$"]];
myCoin setvariable ["BIS_COIN_onPurchase",{sleep 2}];
// END OF COIN SETTINGS

_done = [];
{
if (side _x == east) then {
	if ((vehicle _x != _x) && !(vehicle _x in _done)) then {
		(vehicle _x) addAction ["Salvage","addSalvage.sqf",[],1,false,true,"","!alive _target"];
		_done = _done + [vehicle _x];
	};
	_x addEventHandler ["killed",{(vehicle (_this select 0)) addAction ["Salvage","addSalvage.sqf"];}];
	UralWreck addAction ["Salvage","addSalvage.sqf"];

};
sleep .01;
} forEach allUnits;

Share this post


Link to post
Share on other sites

You want to change it in addSalvage.sqf:

private["_amount"];

_salvagedItem = _this select 0;

switch (true) do {
case (_salvagedItem isKindOf "UralWreck"): {_amount = 10;};
case (_salvagedItem isKindOf "Tank"): {_amount = 200;};
case (_salvagedItem isKindOf "LandVehicle"): {_amount = 100;};
case (_salvagedItem isKindOf "Man"): {_amount = 15;};
default {_amount = 0};
};

deleteVehicle _salvagedItem;
myMoney = myMoney + _amount;
Call Compile Format["PublicVariable ""myMoney"";"];

_name = getText (configFile >> "cfgVehicles" >> typeOf _salvagedItem >> "displayName");
hint format["Earned: %1 for salvaging %2 - [%3]",_amount, _name, myMoney];

For the UralWrecks you'll probably want to do something like nearestObjects to assign the addAction to them.

Edited by kylania

Share this post


Link to post
Share on other sites

Yup thats how i had it in the addsalvage.sqf :),ok checking out nearestObjects on biki, thanks again.

Share this post


Link to post
Share on other sites

I made a bit of progress, i left the UralWreck addAction as it is in the init.sqf and put down a couple UralWrecks in the editor and put,

this addAction ["Salvage","addSalvage.sqf"];

in their init lines and i could salvage them all :yay: its a little victory but ill take it :)

Share this post


Link to post
Share on other sites

I actually didnt need that extra UralWreck addAction in my init.sqf,as long as i have ''this addAction ["Salvage","addSalvage.sqf"];'' in my Wrecks init lines and the ''case (_salvagedItem isKindOf "UralWreck"): {_amount = 10;};'' in my addSalvage.sqf im all good. :)

Share this post


Link to post
Share on other sites

I have another little question id like to ask. I was thinking its kind of unrealistic for the player to walk up to a wreck or whatever it is and salvage it, i happened to see the salvage truck in the editor and it made me think of this. Would it be possible to have it so the player can only salvage when he is in the truck or just out side it ? Would i need to do something along the lines of, if player is in truck x then salvage ? i hope this makes sense :)

Share this post


Link to post
Share on other sites

Put this as your URALWreck addAction. It will check that a salvage truck is within 50m of the wreck before letting it salvage.

this addAction ["Salvage","addSalvage.sqf",[],1,false,true,"","alive (nearestObject [_target, ""MtvrSalvage_DES_EP1""])"];

One thing to be aware of this though, the classnames for the US OA Salvage and Supply trucks are backwards. If you put down "Supply Truck [uS]" the class you're putting down is MtvrSalvage_DES_EP1. if you put down "Salvage Truck [uS]" the class you're putting down is MtvrSupply_DES_EP1. So if you wanted the truck with the covered back use "Salvage" and if you want the one with repair like stuff in it, use "Supply" even though those are backwards.

You only way to do it while the player is in the truck is to add the action to the salvage truck and check for Ural Wrecks near it.

Share this post


Link to post
Share on other sites

Thanks alot Kylania :) ya i noticed that while i was looking at armaHolic for the name of the supply truck also where i found Land_Misc_IronPipes_EP1 among other objects. Ill give it a try after i walk my Dog :) Thanks again

Deg

Edited by Deg

Share this post


Link to post
Share on other sites

Yup worked perfectly, i really appreciate all your help thanks :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×