Jump to content

Haymaker

Member
  • Content Count

    45
  • Joined

  • Last visited

  • Medals

Posts posted by Haymaker


  1.  Original code for random output (or flag):

    		// Set the marker to quadrant 1
    		_quadrantMarker = 'quadrant1';
    
    		// Randomize the relative position for the flag
    		_position = (getMarkerPos _quadrantMarker) getpos [random 2000, random 2000];
    
    		// Spawn a flag in a location relative to quadrant 1
    		_spawn = _flag createVehicle _position;
    

    So something like:

    
    // Find position for flag
    _position = selectBestPlaces [position _quadrantMarker, 2000, "meadow + forest + houses + 2*hills", 1, 5];
    
    // Spawn a flag in the location
    _spawn = _flag createVehicle _position;
    
    
    
    

    This can't be done in .sqf though, correct? isn't this a config? And won't this return an array? Wiki doesn't give much clarity.


  2. So I'm working on an insurgency type mission, I'm not ready to reveal my code quite yet, but I'm trying to make it very complex and unpredictable. 

     

    Right now with my system, I divide the map into 4 quadrants, each quadrant with a marker. Then, the script gets the position of those markers and creates a random amount of outposts in randoms locations within 3000m of the marker. Then a randomly sized squad with random units from a unit pool are spawned with a random patrol pattern at each flag. I like how things are working right now, and I'm ready to create new features (like caches, static weapons, garrisoned buildings, IED factories, random convoys, etc.), and even randomize the amount of groups to be spawned at each outpost, but before I do that, I want to refine the outpost spawning system. Things work okay right now, but I want flags to randomly spawn in respect to buildings. I still want outposts to spawn in random areas, even not by buildings, but I want buildings to become a factor and for these outposts to more likely spawn near them.

     

    So far things are pretty simplistic, I figure this will get rid of my pointless 4 quadrant system as well. I'd like to keep things as simplistic as possible.

     

    Thanks guys.


  3. Okay so I've been working on a script for cooking drugs... yeah...

     

    Meth specifically actually. I'm becoming a little more skilled with scripting but I'm having trouble with one thing I can't quite wrap my head around. 

     

    The script works mostly correctly, but when I try to stop the script from running in the else statement, I'm not having luck. I'm actually quite confused because it worked a few times, but then when I restarted my game it stopped working. I'm thinking I must have accidentally unsaved it or something.

     

    private ["_building","_stove","_chemicals","_chemicalsUsed","_meth","_smoke","_cooking"];
    
    
    _building = nearestObject [player, "house"];
    _stove = nearestObject [player,"CUP_Kitchenstove_Elec"];
    _storage = nearestObject [_stove,"Box_NATO_AmmoVeh_F"];
    _chemicals = nearestObject [_stove, "Land_MetalBarrel_F"];
    _meth = "arifle_Mk20_F";
    _cooking = _stove getVariable "_cooking";
    //* _smoke = "";
    
    
    
    
    if (_stove distance _building <= 8) then
    
    
    {
    if (_stove distance _chemicals <= 8) then {
    
    
    if (_cooking < 1) then {
    
    
    //* _smoke createVehicle (position _stove);
    Hint "Meth is cooking";
    _stove setVariable ["_cooking", 1, true];
    
    
    sleep 60;
    
    
    Hint "Meth has been cooked";
    //* deletevehicle nearestObject [_stove, _smoke];
    _storage addWeaponcargo [_meth,10];
    deleteVehicle _chemicals;
    _stove setVariable ["_cooking", 0, true];
    
    
    } else {
    Hint "Meth is already cooking!"
    };
    }
    
    
    else {
    Hint "You need to have chemicals and a stove in a building to cook meth!"
    }
    };

    What I'm confused about is setting up "_cooking" as boolean... I've tried a few methods. Also it's worthy to be noted that I have this in my init.sqf:

    _stove = nearestObject [player,"CUP_Kitchenstove_Elec"];
    _stove setVariable ["_cooking", 0, true]; 

    I don't plan on keeping this as my init.sqf I plan on moving it to an eventhandler init, where I will also give the stoves an addaction to execute this script. I'm pretty confused on how to set _cooking as a default 0 or false and then it would be changed accordingly during the script.


  4. Extended Init eventhandler from cba a3

    class Extended_Init_EventHandlers	{
    	 
    	class classname {
    	
    		init = "(_this select 0) call fnc_script";
    
    	};
    };
    
    

    Use base classname which all your objects belongs to.

     

    in function or script:

     

    +define _object in params

    +define _array contain your all object classnames.

    +create statement to exit if typeof _object is not in _array.

    +setvariable on _object

    +optional for different variables use switch (typeof _object) do {}

    Uh oh time to go read up on config :(


  5. So I'm trying to make a script execute for each classname. Essentially I want every one of these objects to have an addaction to execute a script which drops a specific object once every minute 10 times.

     

    I understand I can add an eventHandler for init, but that requires an object, and a classname isn't an object.

     

    The only thing I can think of is:

    nearestObjects [player, ["classname"], 999999999];

    but then I'd have to constantly execute that script, and I fear locality issues.

     

     

    A workaround I'm considering is somehow creating them into a gearbox, and making them into a 'put' eventhandler, where if you added a gear item, water let's say, to the box, it will delete the water and addItemCargo every 1 minute ten times. This sounds like a good idea but my main issue is I'm new to modding and I'd like to avoid config at all costs :D

     

    Any help would be appreciated, thanks guys.


  6. private["_goods","_cash","_price"];
    
    
    
    
    _goods = "Chemlight_yellow";
    _cash = player getVariable "myCash";
    _price = 10;
    _num = count "_goods" in magazines player;
    
    
    if ("Chemlight_yellow" in Magazines Player) then{
    
    
    _price = _price + _num; // is there a way to achieve (_price = _price * _num)
    _cash = _cash + _price;
    
    
    player removeMagazine ["Chemlight_yellow",999999999];
    ["sellgoods",[format[(localize 'STR_HG_DLG_MC'),[(player getVariable '_cash')] call BIS_fnc_numberText]]] call BIS_fnc_showNotification;
    player setVariable["myCash",_cash];
    Hint "You have sold all of your wheat!";
    
    
    }
    
    
    else{
    
    
    Hint "You don't have wheat!";
    };
    
    
    
    

    So I'm writing a script to sell items in the inventory of a player, but I've noticed you can't multiply numbers, or at least not with the characters I'm using. Help please?


  7. You could tie the script to an event handler instead. Have it be attached to the player and do a getin event handler. Check to see if it's the correct vehicle and launch that script.

    I think I'll try that, I've also implemented that over to fishing where if you're in a trawler and you come within a certain distance of a Tuna, it will add an item to your cargo :D

     

    As for the event Handler, I can't get one running for GetinMan for all vehicles. It will work for specific variables, but not for all of a specific classname. In the meantime as a workaround I used:

    player addEventHandler ["InventoryOpened", {_this execVM "Scripts\Functions\fn_HarvestWheat.sqf"}];

  8. Over the past 7 years, Arma has been my go-to game. I have accumulated thousands of hours of gameplay, and created a great deal of mission based content. Over these 7 years I've been a part of numerous variations of these game modes. I've seen what works and what doesn't. I've edited their mission files. I've even been a senior developer for many of these communities.

     

     

    In the past few weeks, I began working on my own variation, from scratch. It's focused on quality over quantity. And so far it's good. Now I could do this on my own, but I want help. I want to make this something great. So, basically...

     

    Help Wanted:
    1 Specialized Scripter
    1 Person Specialized in UI 
    1 Specialized Texturer 
    1 Specialize Modeler 

     

    The Mission:

    Create, from the ground up, the most immersive and fun Role Playing Mod out there.

     

     

    Features:

    There are a several key features that make this mod unique. One being ACE 3 implementation. ACE will be a huge part of this mod, whether it's EMS actually having to do something or if it's logistic.

     

    Another thing this allows us to get rid of it massive amounts of over-scripting. Most Life communities have massive amounts of scripts and mods for absolutely no reason, which causes performance to suffer. ACE mod comes with great functionality, including vehicle cargo, handcuffs, a medical system, vehicle keys, and much much more.

     

    A goal for persistence is to create actual physical garages in houses or in buildings, where vehicles will be persistent, as well as boxes in homes.

     

    Plus much more...

     

    PS:

    I lead a community and we have our own server, so hosting will not be an issue.

     

    Anybody has any questions please feel free to shoot me a message. Thanks guys!

     

    Haymaker

    • Like 1

  9. Over the past 7 years, Arma has been my go-to game. I have accumulated thousands of hours of gameplay, and created a great deal of mission based content. Over these 7 years I've been a part of numerous variations of these game modes. I've seen what works and what doesn't. I've edited their mission files. I've even been a senior developer for many of these communities.

     

     

    In the past few weeks, I began working on my own variation, from scratch. It's focused on quality over quantity. And so far it's good. Now I could do this on my own, but I want help. I want to make this something great. So, basically...

     

    Help Wanted:
    1 Specialized Scripter
    1 Person Specialized in UI 
    1 Specialized Texturer 
    1 Specialize Modeler 

     

    The Mission:

    Create, from the ground up, the most immersive and fun Role Playing Mod out there.

     

     

    Features:

    There are a several key features that make this mod unique. One being ACE 3 implementation. ACE will be a huge part of this mod, whether it's EMS actually having to do something or if it's logistic.

     

    Another thing this allows us to get rid of it massive amounts of over-scripting. Most Life communities have massive amounts of scripts and mods for absolutely no reason, which causes performance to suffer. ACE mod comes with great functionality, including vehicle cargo, handcuffs, a medical system, vehicle keys, and much much more.

     

    A goal for persistence is to create actual physical garages in houses or in buildings, where vehicles will be persistent, as well as boxes in homes.

     

    Plus much more...

     

    PS:

    I lead a community and we have our own server, so hosting will not be an issue.

     

    Anybody has any questions please feel free to shoot me a message. Thanks guys!

     

    Haymaker


  10. Over the past 7 years, Arma has been my go-to game. I have accumulated thousands of hours of gameplay, and created a great deal of mission based content. Over these 7 years I've been a part of numerous variations of these game modes. I've seen what works and what doesn't. I've edited their mission files. I've even been a senior developer for many of these communities.

     

     

    In the past few weeks, I began working on my own variation, from scratch. It's focused on quality over quantity. And so far it's good. Now I could do this on my own, but I want help. I want to make this something great. So, basically...

     

    Help Wanted:
    1 Specialized Scripter
    1 Person Specialized in UI 
    1 Specialized Texturer 
    1 Specialize Modeler 

     

    The Mission:

    Create, from the ground up, the most immersive and fun Role Playing Mod out there.

     

     

    Features:

    There are a several key features that make this mod unique. One being ACE 3 implementation. ACE will be a huge part of this mod, whether it's EMS actually having to do something or if it's logistic.

     

    Another thing this allows us to get rid of it massive amounts of over-scripting. Most Life communities have massive amounts of scripts and mods for absolutely no reason, which causes performance to suffer. ACE mod comes with great functionality, including vehicle cargo, handcuffs, a medical system, vehicle keys, and much much more.

     

    A goal for persistence is to create actual physical garages in houses or in buildings, where vehicles will be persistent, as well as boxes in homes.

     

    Plus much more...

     

    PS:

    I lead a community and we have our own server, so hosting will not be an issue.

     

    Anybody has any questions please feel free to shoot me a message. Thanks guys!

     

    Haymaker


  11. Okay I see. I supposed I should tell you what I'm doing here. I'm creating a multiplayer monetary economy with shops and ways to make money!

     

    This will be one of the many ways to make money.

     

    Also, I've found the issue with the harvesting. If you are out of the tractor when the script is executed it won't harvest. Then once you get into the tractor the script must be re-executed for it to work. Is there any way I could just make it initialize in the init.sqf and never have to be re-executed?


  12. Okay that works! Just changed the if do statement to if then and it works fine! I also added this 

    //add all wheat found (if there's space in your vehicle)
    
    			if (vehicle player canAdd "Binocular") then
    
    			{
    			vehicle player addItemCargo ["binocular",_num];
    			}
    
    			else
    
    			{
    			Hint "Your tractor can't hold any more wheat!"
    			};
    

    so that you can't infinitely fill the tractor.

     

    I have noticed there is one problem where after the first wheat plant is harvested the script stops working and wont harvest anymore until re-executed, I figure that'd be a problem with sleep?

     

    I've also started the plant script:

    while {player distance haystack < 50} do{
    
    if ("Chemlight_blue" in Magazines Player) then
    
    {
    		if (vehicle player == player) then
    		{
    			player addAction ["Plant Wheat",
    			{
    				"CUP_A2_p_wheat_ep1" createVehicle position player;
    				 player removeItem "Chemlight_blue";
    				 player playMove "Acts_TreatingWounded04";
    				 sleep 5;
    				 player switchmove "";
    				 removeAllActions player;
    
    			}];
    
    
    		}
    
    		else
    
    		{
    			removeAllActions player
    		};
    		sleep 6;
    };
    };
    

    Also, will I have any trouble running these scripts in multiplayer?


  13.  

    You're searching a 1m radius for the objects.

     

    nearestObjects [position, types, radius]

     

    Also, it may help to write your loop like this:

    while {_condition} do {
         //code
    };
    

    But, double also, if you run this script when the player is more than 10m from the object it'll go straight past the while loop and finish the script. At a guess (and I'm making some assumptions here about what you're doing), you'd be better off running this whole thing in a loop with a waitUntil, and executing it at any time before the player gets within 10m:

    private["_tractor","_crop","_item"];
    
    _tractor = "RDS_Zetor6945_Base";
    _item= binocular;
    
    while {true} do {
    
         waitUntil {(count (nearestObjects[getPos player,["CUP_A2_p_wheat_ep1"],10])) > 0};
    
         {deleteVehicle _x} forEach (nearestObjects[getPos player,["CUP_A2_p_wheat_ep1"],10]);
    };
    

    Okay so now I have 

    private["_tractor","_condition","_item"];
    
    _tractor = "RDS_Zetor6945_Base";
    _item= "binocular";
    
    while {((typeOf (vehicle player)) == _tractor)} do {
    
         waitUntil {(count (nearestObjects[getPos player,["CUP_A2_p_wheat_ep1"],5])) > 0};
    
         {deleteVehicle _x} forEach (nearestObjects[getPos player,["CUP_A2_p_wheat_ep1"],5]);
    
    	vehicle player addItemCargo ["binocular",1];
    };
    

    For some weird reason it adds 4-24 binoculars per wheat plant.

     

    PS thanks for the help guys! 


  14. Working on a little Arma 3 farm simulator action... fairly noob to scripting, don'n know why I can't seem to get it to work.

    
    private["_tractor","_crop","_item"];
    
    
    _tractor = "RDS_Zetor6945_Base";
    _crop = nearestObjects[getPos player,["CUP_A2_p_wheat_ep1"],1] select 0;
    _item= binocular;
    
    
    while
    {
    player in _tractor
    player distance _crop < 10
    }
    
    
    do
    {
    deleteVehicle _crop;
    _tractor addItemCargo binocular;
    };

    The binoculars serve as a placeholder for actual wheat, which I will be creating a gear item for. The idea is, if you're in a tractor and you run over a wheat plant, it adds wheat to the vehicle inventory.

     

    I call the script via:

    player execVM "Scripts\Functions\fn_HarvestWheat.sqf";

    ...and it doesn't work at all. I run right over the wheat and nothing happens. I'm working on several other similar scripts and none of them seem to work.

     

    Help would be greatly appreciated!

×