Jump to content
Sign in to follow this  
FriendlyIntentions

Very simple config problem

Recommended Posts

Hey, I'm about 10% into making Nogova into totally script driven open world fallout/dayz style. The mission could potentially take days to complete so I don't want it getting littered up with dropped weapons. I want to add timetolive to the weaponholder (I assume when player does 'drop weapon' action a weaponholder is created).

What do I need to do to the following config.cpp (packed into a pbo) to make it 'patch' the original object?

Thanks in advance :)


// 		Defines

// 		T & F
#define true  			1
#define false 			0
// 		Type scope, used for show entry
#define private 			0 	// Item is never visible
#define protected 			1 	//  switch must be activated to use 			
#define public 			2 	// Anyone can see/use it
// 		Type access
#define ReadAndWrite 		0 	// Any modifications enabled
#define ReadAndCreate 		1 	// Only adding new class members
#define ReadOnly 			2 	// No modifications enabled
#define ReadOnlyVerified 		3 	// No mod, CRC test applied
// 		Type Weapon Slots
#define WeaponNoSlot          	0     	// dummy weapons  
#define WeaponSlotPrimary     	1     	// primary weapons  
#define WeaponSlotSecondary     16     	// secondary weapons  
#define WeaponSlotHandGun     	2     	// HandGun  
#define WeaponSlotHandGunItem   32 		// HandGun magazines  
#define WeaponSlotItem          256     // items  
#define WeaponSlotBinocular     4096    // binocular  
#define WeaponHardMounted    	65536

#define LockNo		0
#define LockCadet	1
#define LockYes		2

//  		START CFG

class CfgVehicles
{

class All{};
class Static:All{};
class Building:Static{};
class Strategic:Building{};
class ReammoBox:Strategic{};
class WeaponHolder : ReammoBox
	{
	scope = protected;
	model = "\misc\dummyweapon.p3d";
	accuracy = 0.20;
	class TransportMagazines{};
	forceSupply = true;
	showWeaponCargo = true;
	transportMaxMagazines = 1e9;		// Unlimited
	transportMaxWeapons = 1e9;		// Unlimited
	displayName=;

	timetolive = 20;			// <- Added
	};
};

I am aware I could use NearestObject with a script to delete them but if possible I would like to do it this way. There is a few other things I wish to change aswell, and so far I can't get anything from the original configs to change by using an addon.

p.s. Had a good idea how to spawn random loot in houses only when player is near, happy to share. If anyone is interested I will be happy to upload some .sqs files when its done. Its so simple, theres only about 10 enterable houses on Nogova, Dum07 is the yellow house with the red roof :)

rdyloot = TRUE

#start
@rdyloot

? NearestObject [player,"Dum09"] distance player < 15 : _house = NearestObject [player,"Dum09"]; rdyloot = false; [_house] exec "Handlers\Loot\spawn1.sqs"; goto "start"
~0.2
? NearestObject [player,"Dum07"] distance player < 15 : _house = NearestObject [player,"Dum07"]; rdyloot = false; [_house] exec "Handlers\Loot\spawn1.sqs"; goto "start"
~0.2

goto "start"

Share this post


Link to post
Share on other sites

hi,

p.s. Had a good idea how to spawn random loot in houses only when player is near, happy to share. If anyone is interested I will be happy to upload some .sqs files when its done. Its so simple, theres only about 10 enterable houses on Nogova, Dum07 is the yellow house with the red roof :)

rdyloot = TRUE

#start
@rdyloot

? NearestObject [player,"Dum09"] distance player < 15 : _house = NearestObject [player,"Dum09"]; rdyloot = false; [_house] exec "Handlers\Loot\spawn1.sqs"; goto "start"
~0.2
? NearestObject [player,"Dum07"] distance player < 15 : _house = NearestObject [player,"Dum07"]; rdyloot = false; [_house] exec "Handlers\Loot\spawn1.sqs"; goto "start"
~0.2

goto "start"

IMHO, it would be better to use nearestBuilding command since nearestObject in a fast loop will kill your performances.

Your script with nearestBuilding (not tested):

#start
~0.2
? !(rdyloot): goto "start"

_building=nearestBuilding player

? player distance _building<15: rdyloot=false; [_building] exec "Handlers\Loot\spawn1.sqs"; goto "start"
~0.2

? (alive player): goto "start"

cya.

Nikiller.

Share this post


Link to post
Share on other sites

Thanks Nikiller, good idea. I must've been tired last night :) Any advice on how to 'patch' an existing class in cfgvehicles using an addon?

p.s. Found this, a list of all (I think) classes in ofp resistance with pictures for most. Very useful

http://www.ofpec.com/COMREF/index.php?action=read&id=69#Static

Edited by FriendlyIntentions

Share this post


Link to post
Share on other sites
What do I need to do to the following config.cpp (packed into a pbo) to make it 'patch' the original object?

I can't remember precisely, but OFP/CWA is fussy about what can be patched via addon pbos. This might be one of those things; it can be made to work as part of a whole Mod config.

I want to add timetolive to the weaponholder (I assume when player does 'drop weapon' action a weaponholder is created).

True. But I couldn't get TimeToLive to work that way - it seems to be more for ammo and effects.

However, since a weaponholder is a vehicle you can add an Init EventHandler to it

	class WeaponHolder:ReammoBox
	{
	scope=1;
	model="\misc\dummyweapon.p3d";
	accuracy=0.2;
	forceSupply=1;
	showWeaponCargo=1;
	transportMaxMagazines=1000000000.0;
	transportMaxWeapons=1000000000.0;
	displayName="";

	class TransportMagazines
		{
		};

	class EventHandlers
		{
		init="hint ""Weaponholder spawned""; (_this select 0) exec {\<pboname>\delete_me.sqs} ";
		};
	};

Hints are for debugging purposes. delete_me.sqs is pbo'd and the pbo put in your Addons folder:

;delete_me.sqs
~5
hint "Delete Weaponholder script run"
~5
hint format ["%1", _this]
~5

? (alive _this): deleteVehicle _this

p.s. Had a good idea how to spawn random loot in houses only when player is near, happy to share. If anyone is interested I will be happy to upload some .sqs files when its done. Its so simple, theres only about 10 enterable houses on Nogova, Dum07 is the yellow house with the red roof :)

If you know which houses they are, find out their ID numbers: in the Mission Editor, activate the "Show ID" button.

Then have a slowly looping script, every 12 seconds say, that checks if the player is nearer that 150 metres from one of them. Set a variable flag to true and launch another script for that building only, to do the close up work.

When the player moves more than 175 metres away, set the flag to false and the slow loop resumes.

This saves have to search through building types and the proximity of all of them to the player.

player distance object <object ID number> ...

Edited by -rageQuit-
Added Object command example & link

Share this post


Link to post
Share on other sites

Thanks heaps rageQuit.

OFP/CWA is fussy about what can be patched via addon pbos. This might be one of those things; it can be made to work as part of a whole Mod config.

You are correct, it wouldn't work. I have gone with a whole res\bin\config in mymod\bin folder. I am about to try your eventhandler suggestion on the mod config and I'm confident it will work. I just changed something small and it worked. Thanks again :)

This is what I've come to (with nkillers help) for my loot spawner. I'm going to do it like this so it can spawn different things in different buildings (e.g cars in garages) for the whole freaking map

rdyloot = true
#start
~5

@rdyloot

_house = nearestBuilding player
?_house == objnull : goto "start"

? player distance _house > 100 : goto "start"


? ("Dum07" counttype [_house] == 1) : rdyloot = false; [_house] exec "Handlers\Loot\spawn1.sqs"; goto "start"
~1
? ("Dum09" counttype [_house] == 1) : rdyloot = false; [_house] exec "Handlers\Loot\spawn1.sqs"; goto "start"
~1

goto "start"

It will be completely random what (if anything at all) is spawned. A script similar to this piece for randomly arming. Easy to change and update. I'm going to use mapfacts rucksack addon as the system for the inventory. I will most likely be back at some point asking Faguss how to resize the HTML notebook gear screen to make room for more pistol mags lol

_weapons =["CivAK47G","DesertEagle","FAL"]
_mags = ["CivAKMag12","DesertEagleMag","FALMag"]
_speshmag = ["CivAKMag30","DesertEagleMag","FALMag"]

_totalweps = (count _weapons) - 0.6
_rand =  random _totalweps

_wep = _weapons select _rand
_mag= _mags select _rand
_spesh = _speshmag select _rand

Welcoming any suggestions or point outs:)

Edited by FriendlyIntentions

Share this post


Link to post
Share on other sites

hi,

Your project sounds very promising.

Do you want include survival things (food, drink, medical...)?

Do you want to include zombies?

Do you have models for your weaponHolders?

cya.

Nikiller.

Edited by Nikiller

Share this post


Link to post
Share on other sites
Do you want include survival things (food, drink, medical...)?

Yes. A bleeding system with blood bags seems simple enough. Mapfact rucksack addon already has bandages. I could make it when the player uses a medkit it heals to -1 or something, then the player has to use morphine to get it back to zero. Mapfact rucksack comes with rations that heal by 0.1. This stops heavy breathing and restores steady aim.

In ofp setdammage to negative number makes shaky aim, so (in my knowledge) dehydration is hard to do without having bugs.

Do you want to include zombies?

No zombies, gimballs tossers instead lol. Check the following link they are awesome. Civilians that throw vodka bottles, rocks and tvs

http://operationflashpoint.filefront.com/file/Gimbals_Tossers;35331

Do you have models for your weaponHolders?

Havn't thought of that at all. I guess I will add a Mapfact rucksack first, then the item if I have no model for it.

Its starting to take shape.

For a short example, get 600m from Lippany and 48 tossers on 2 enemy sides are spawned randomly across the city. Lippany gets a RagnaRock club (from Max Payne) with enemy on the balconies inside. I turned off most of the city lights and made fire barrels with lighting effects to continue the max payne theme.

Most towns have something happen when the player approaches and alot of the quest systems are well underway.

The scripts are lightweight, with everything being deleted very simply without bugs and only when away from player (i.e. if an enemy from a town chases you, he wont delete with the rest of his townskin when you leave)

Unfortunately this version will be at best 2 player, one person tag along style. Eventually a full multiplayer version would be good but my skills arent up to it yet.

Thanks for the interest, any suggestions or questions fire away

p.s. just decided the next project is none explosive grenades and turn up the initspeed on the mm1. There is riot police is "TheHKPack" :)

Edited by FriendlyIntentions

Share this post


Link to post
Share on other sites

We're working with a similar project except for mine includes both survival aspect of dayz with random units and groups spawn in different location and each with random task. Still got allot of work to do with the script. But I already thought of using a whole map with random event needs to have a bit more organized coordinate system. For this I handle events base on marker coordinates placed on each town or part of the map. Example with my loot system. loop will find the nearest marker point like my own dummy object class. If my distance between the nearest marker point is less than 150m then a script is called to process the loots. It will scan for all the buildings inside it's radius then check each building object, if building have one or more index then decide if scrip should put a loot or not in one of the index and what type of loot. Then proceed to the next building until all buildings are processed. after that a timer is run before deleting each weapon holder in the area. Saving building ID in my script is never an option as there are allot of them to list and wanted to run my script in town base. It will also allow me to use my script in different map without to much editing. Same concept for my random units only with ai script running.

Edited by Capjerahya

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  

×