Jump to content

A-SUICIDAL

Member
  • Content Count

    520
  • Joined

  • Last visited

  • Medals

Posts posted by A-SUICIDAL


  1. I am still unable to figure out how to get this working. I've tried creating a dialog specific to each player and it still doesn't seem to work correctly. Honestly I thought that somebody would have known how to make this work correctly and offered some help, but I guess either it's just not possible or nobody knows how to do it, or maybe nobody feels like helping me, :p heh. When it comes to dialogs that have buttons and other interaction, usually the player cannot move at all until the dialog is closed and in most cases the changes the player makes in the dialog only effect the player locally. The dialog/HUD that I created does not open from an action and there is no option to "close" the dialog and the player has no ability to interact with the dialog, but when the player takes damage - the dialog/HUD is then updated with the players current health value. Seems simple enough, but one of my teammates gets hurt and their health value is sent across all players, so suddenly my little health HUD shows my teammates damage, which is not what I want to have happen.

    I thought that maybe the problem might reside in how I use cutRsc to bring the hud up for each player. Is there a way to script cutRsc ["Health_Hud","PLAIN"]; so that it would appear for only 1 player? Then maybe I could try to make it so each player sees their own dialog.

    Around the time I started trying to figure out how to create a dialog, the OFPEC site was working fine and I was able to view the dialog tutorial that was written by HeliJunkie, but then later that same day the site was suddenly under construction and since then I have not been able to view any tutorials there. I've searched high and low for other tutorials, but everything I was able to find seemed to relate mostly to dialogs that use buttons and etc, which isn't really what I am trying to do. If anybody knows of a tutorial or a sample mission or any kind of mission that incorporates some kind of HUD that is similar to what I am trying to do, please help me out and throw me a link. Thanks.


  2. Why not just put this in the init of each player?

    removeBackpack this;
    removeAllItems this;
    removeallWeapons this;
    this addbackpack "US_Patrol_Pack_Specops_EP1";
    clearMagazineCargo (unitBackpack this);
    (unitBackpack this) addMagazineCargo ["20Rnd_762x51_SB_SCAR",4];
    (unitBackpack this) addMagazineCargo ["15Rnd_9x19_M9SD",4];
    {this addMagazine "20Rnd_762x51_SB_SCAR"} forEach [1,2,3,4,5,6,7,8];
    {this addMagazine "15Rnd_9x19_M9SD"} forEach [1,2,3,4,5,6,7,8];
    {this addMagazine "PipeBomb"} forEach [1,2];
    this addWeapon "SCAR_H_CQC_CCO_SD";
    this addWeapon "M9SD";
    this addWeapon "NVGoggles";
    this addweapon "Binocular_Vector";
    this addWeapon "ItemWatch";
    this addWeapon "ItemMap";
    this addWeapon "ItemCompass";
    this addWeapon "ItemGPS";
    this addWeapon "ItemRadio";
    

    Maybe use one of those large backpacks with 14 slots :)

    ArmA_2_OA:_Backpacks

    http://www.kylania.com/ex/?p=55


  3. I use attached lights in all my tents at base and some buildings.

    I add a baseball and setPos it into the ceiling of a tent, then name it "tent1_lamp" and then I use this script on it:

    _light1 = "#lightpoint" createVehicle getpos tent1_lamp; 
    _light1 setLightBrightness 0.0028; 
    _light1 setLightAmbient[37, 44, 41]; 
    _light1 setLightColor[37, 44, 41]; 
    _light1 lightAttachObject [tent1_lamp, [0,0,0]];
    

    I simply use Photoshop to get the exact color I want. I have greenish lights for the green tents, pinkish lights for the large hospital tent etc. It looks great.


  4. I created a health status HUD feature for a coop mission. It's currently working great for single player, but there is an issue in multiplayer where if a teammate gets hit, his or her current health status is updated across each players health HUD/dialog. I have been trying my best to figure out how to fix this.

    Basically it's a very simple dialog in design. It just shows "Health: 100" in the bottom right corner of the screen at mission start and remains there throughout the game. It gets recreated when the player respawns. There are few different things that will update the health status like, an addEventHandler "Hit" that detects when the player is hit and calculates and converts the damage and then updates the HUD, then there is a heal script that will also update the HUD, there is also a trigger that will detect if the players health == 0 and update the HUD, and finally there is a trigger that detects when the player is alive(after respawning) and recreates the HUD.

    I need to find out a way to update the status of each players health HUD locally without it updating every players HUD.

    2 basic things get updated. The color of the word "Health:" and the number value of their damage.

    Currently I am using the following code to do this:

    (_ui displayCtrl 1002) ctrlSetTextColor [0.25, 1, 0, 1];
    (_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
    

    Is there a way to update this info locally?

    My whole approach to making this health HUD possible might not have been the best route to take, but I am trying my best.

    I've discussed the HUD idea in other threads a little, but I wanted to create a new thread that relates specifically to what it is I am trying to accomplish.

    Here's an editor sample mission. It incorporates additional body armor, heal scripts, a vehicle to heal at, one invincible enemy rifleman, an ammo box so you can throw frags near yourself to test the updated health status. Oh, and a hide body script.

    health_hud_sample.Desert_E.zip

    I hope somebody can help. I care more about making this health HUD thing possible than anything else I've ever worked on for this game.

    =====================================================

    These are the scripts and stuff used in the sample mission:

    Trigger to create the HUD:

    null = [] execVM "dialog\health_status.sqf";

    description.ext:

    #include "dialog\dialog.cpp"

    dialog.cpp:

    #define CT_STATIC           0
    #define ST_LEFT           0x00
    
    class RscTitles
    {
    class Health_Hud
      	{
         	idd = 1000;
        	movingEnable=0;
         	duration=1e+011;
         	name = "Health_Hud_Name";
         	onLoad = "uiNamespace setVariable ['HUD', _this select 0];";
    onUnLoad = "uiNamespace setVariable ['HUD', nil]";
         	controlsBackground[] = {};
         	objects[] = {};
         	class controls
    	{
    		class bkgrnd
    		{
    			type = CT_STATIC;
    			idc = 1001;
    			style = ST_LEFT;
    			x = 0.911977 * safezoneW + safezoneX;
    			y = 0.949074 * safezoneH + safezoneY;
    			w = 0.0625 * safezoneW;
    			h = 0.025 * safezoneH;
    			font = "Zeppelin32";
    			sizeEx = 0.03;
    			colorBackground[] = {0,0,0,0.7843};
    			colorText[] = {1, 1, 1, 1};
    			text = "";
    		};
    		class health
    		{
    			type = CT_STATIC;
    			idc = 1002;
    			style = ST_LEFT;
    			x = 0.920836 * safezoneW + safezoneX;
    			y = 0.95 * safezoneH + safezoneY;
    			w = 0.03125 * safezoneW;
    			h = 0.025 * safezoneH;
    			font = "Zeppelin32";
    			sizeEx = 0.03;
    			colorBackground[] = {0, 0, 0, 0};
    			colorText[] = {0.25,1,0,1};
    			text = "Health: ";
    		};
    		class status
    		{
    			type = CT_STATIC;
    			idc = 1003;
    			style = ST_LEFT;
    			x = 0.951044 * safezoneW + safezoneX;
    			y = 0.95 * safezoneH + safezoneY;
    			w = 0.0166639 * safezoneW;
    			h = 0.0252316 * safezoneH;
    			font = "Zeppelin32";
    			sizeEx = 0.03;
    			colorBackground[] = {0, 0, 0, 0};
    			colorText[] = {1,1,1,1};
    			text = "100";
    		};
    	};
    };
    };
    

    dialog\health_status.sqf:

    disableSerialization;
    cutRsc ["Health_Hud","PLAIN"];
    _ui = uiNamespace getVariable "HUD";
    _bkgrnd = _ui displayCtrl 1001;
    _health = _ui displayCtrl 1002;
    _status = _ui displayCtrl 1003;
    _array_hud = [_bkgrnd,_health,_status];
    {_x ctrlShow true} foreach _array_hud;

    player init:

    this setVariable ["selections", []];
    this setVariable ["gethit", []];
    this addEventHandler 
    [
    "HandleDamage",
       	{
       		if (_this select 1 == "") then
       		{
       			_unit = _this select 0;
       			_selections = _unit getVariable ["selections", []];
       			_gethit = _unit getVariable ["gethit", []];
       			_selection = _this select 1;
       			if !(_selection in _selections) then
       			{
       				_selections set [count _selections, _selection];
       				_gethit set [count _gethit, 0];
       			};    
       			_i = _selections find _selection;
       			_olddamage = _gethit select _i;
       			_damage = _olddamage + ((_this select 2) - _olddamage) * 0.25;
       			_gethit set [_i, _damage];
       			_damage;
       		};
       	}
    ];
    this addEventHandler 
    [
       	"Hit",
       	{
    	_unit = _this select 0;
       		_dam = getDammage _unit;
       		_dif = 1 - _dam;
       		_total = _dif * 100;
       		_hp = round _total;
    	_ui = uiNamespace getVariable "HUD";
    
       		if ((_hp <=100) && (_hp >80)) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [0.25, 1, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
       			_unit setHit ["hands", 0.9];
       		};
       		if ((_hp <80) && (_hp >60)) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [0.75, 1, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
       			_unit setHit ["body", 0.9];
       		}; 
       		if ((_hp <60) && (_hp >40)) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [1, 1, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
       				_unit setHit ["legs", 0.9];
       		};
       		if ((_hp <40) && (_hp >20)) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [1, 0.5, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
       				_unit setHit ["head", 0.9];
       		};
       		if ((_hp <20) && (_hp >0)) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [1, 0, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
    		_unit setHit ["legs", 1];
       		};
    	if (!alive _unit) then 
    	{
    		(_ui displayCtrl 1002) ctrlSetTextColor [1, 0, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText "0";
       			_unit setHit ["hands", 1];
    		_unit setHit ["body", 1];
    		_unit setHit ["head", 1];
    	};
       	}
    ];
    this addEventHandler 
    [
    "killed",
    {
    	(_this select 0) execVM "scripts\removeWestBody.sqf"
    }
    ];
    


  5. That did the trick F2k Sel. That's the animation I was looking for. That's a pretty slick way to find it too.

    Thank you too cuel. I think the "Medic" action is the same as what I was using "ainvpknlmstpslaywrfldnon_medic", except I used to cut the animation duration shorter by using:

    _unit switchMove "ainvpknlmstpslaywrfldnon_medic";
    sleep 5;
    _unit switchMove "amovpknlmstpsraswrfldnon_gear";
    

    after 5 seconds into the medic action it would instantly switch the player to a crouched position with gun raised.

    I'll be using "ainvpknlmstpslaywrfldnon_healed2" from now on since it's quick and it keeps the players head down, but mostly because I want the heal script to stay consistent with the field hospital and med tent animations. I will still use my other method for repairing vehicles.


  6. Yeah, I was being funny. It's always funny when somebody takes the time to reply with, "You're doing it wrong" and then they don't bother to tell you the correct way to do it, lol. Actually, the funny part to me was the wiki link you posted, since the addScore wiki page does not offer a thorough explanation of how to use "addscore" correctly, yet it shows a "Global" icon at the top of the page and a script example that is identical to how I was doing it wrong, heh. That wiki addScore page seriously needs a user added comment from Xeno, like the one I posted(by Xeno) above.

    I knew the script was only a few lines long. It's just that... addScore is not something I use everyday, so at the time - I kind of forgot how to apply it. I'm hoping I got it working correctly now.


  7. Quoted from Xeno:

    Put the following into init.sqf:

    Code:

    if (isServer) then {
    "paddscore" addPublicVariableEventHandler {
    	((_this select 1) select 0) addScore ((_this select 1) select 1);
    };
    };
    

    And on the client:

    Code:

    if (isServer) then {
    player addScore _score_to_add; // for hosted environment
    } else {
    paddscore = [player, _score_to_add]; publicVariable "paddscore";
    };
    

    I then changed it a little to fit my scripts.

    I do appreciate you reminding me about this since I otherwise would have forgotten.


  8. Thanks seba. I had to change a few things, but it works perfect now. Well close enough anyway. Since it's for coop use, in case of an accidental TK would there be a way to script it to count how many "east" were killed in the radius only?

    Also, I wanted to ask Kylania. When testing the missile script... if I call the missile and then turn the laser "off" and then "on" right away, the missile sometimes never gets back on track. Would it be possible to make it so instead of the missile going ballistic to some far away place when the laser dot is lost, to maybe have it keep heading to the location where the laser dot was last targeting? Like maybe add something like an invisible H that does a setPos loop at the location of the laser dot target - and if the laser is turned off - the missile continues heading towards the invisible H. I know it would sort of defeat the whole purpose of a guided missile, but there's like a 10 minute wait in my mission before the player can call another missile strike, and almost everybody that calls a missile strike always seems to screw it up by turning their laser off and on like 5 times - and then they wonder why the missile never shows up. lol. I actually had to add a hint that appears when they turn their laser off telling them:

    hint composeText [parsetext format["<t size='1.2' align='center' color='#FF0000'>Laser target lost.</t><br/><t size='1' align='center' color='#FFFFFF'>Missile has gone ballistic!</t><br/><br/><t size='1' align='center' color='#FFFFFF'>You must keep your target painted with your Laser Marker at all times.</t>"]];

    I use separate missile scripts for each player, which I guess works out well as far as the add addScore stuff goes.


  9. I thought so Kylania, but I didn't want to feel stupid and ask, heh.

    I'll try that now seba. Thanks

    ---------- Post added at 10:19 PM ---------- Previous post was at 09:40 PM ----------

    Wow, it worked. I placed a few enemy groups on the hill and called a missile strike on them and after it exploded I had 23 kills and I counted 23 dead. I tested a bit further and at one point I turned my laser marker on and called the missile strike and then for a split second I turned my laser marker off and back on again and it gave me an error, and then missile never arrived either, so it might need a little tweaking to get it error free. I used a radius of 2000.


  10. It's a laser designated bomb. The player must keep the target painted the entire time. I wouldn't know how to get the radius of the target before the bomb explodes. It's a modified version of a missile script originally created by Venori. I had problems where his missile sometimes took a long time to arrive depending on where you were located, also the missile would sometimes hit trees or mountains that were in the way, so I made the missile spawn 1000 meters up and 1000 meters behind the player that calls the missile. There is no jet, but it plays a jet sound. A timer and some hints added so you cannot call another missile for 10 minutes. Action to call missile gets added back after player respawns. Other than that it's pretty much the same missile script.

    _missile is the name of the missile.

    _target is the name of the target.

    It doesn't take long for the missile to arrive.


  11. I figured it out and fixed it.

    This is my new player init:

    this setVariable ["selections", []];
    this setVariable ["gethit", []];
    this addEventHandler 
    [
    "HandleDamage",
       	{
       		if (_this select 1 == "") then
       		{
       			_unit = _this select 0;
       			_selections = _unit getVariable ["selections", []];
       			_gethit = _unit getVariable ["gethit", []];
       			_selection = _this select 1;
       			if !(_selection in _selections) then
       			{
       				_selections set [count _selections, _selection];
       				_gethit set [count _gethit, 0];
       			};    
       			_i = _selections find _selection;
       			_olddamage = _gethit select _i;
       			_damage = _olddamage + ((_this select 2) - _olddamage) * 0.25;
       			_gethit set [_i, _damage];
       			_damage;
       		};
       	}
    ];
    this addEventHandler 
    [
       	"Hit",
       	{
    	_unit = _this select 0;
       		_dam = getDammage _unit;
       		_dif = 1 - _dam;
       		_total = _dif * 100;
       		_hp = round _total;
    	_ui = uiNamespace getVariable "HUD";
    
       		if ((_hp <=100) && (_hp >80)) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [0.25, 1, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
       			_unit setHit ["hands", 0.9];
       		};
       		if ((_hp <80) && (_hp >60)) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [0.75, 1, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
       			_unit setHit ["body", 0.9];
       		}; 
       		if ((_hp <60) && (_hp >40)) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [1, 1, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
       				_unit setHit ["legs", 0.9];
       		};
       		if ((_hp <40) && (_hp >20)) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [1, 0.5, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
       				_unit setHit ["head", 0.9];
       		};
       		if ((_hp <20) && (_hp >0)) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [1, 0, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
    		_unit setHit ["legs", 1];
       		};
       		if (!alive _unit) then 
       		{
    		(_ui displayCtrl 1002) ctrlSetTextColor [1, 0, 0, 1];
    		(_ui displayCtrl 1003) ctrlSetText format ["%1", _hp];
       			_unit setHit ["hands", 1];
    		_unit setHit ["body", 1];
    		_unit setHit ["head", 1];
       		};
       	}
    ];
    


  12. Yeah, I never look at the score much either, but I have friends that do. They actually think that they are getting points when they kill a bunch of enemy using the "call missile" script.

    It would be cool if I could some how detect how many enemy were killed by the missile and then at least addScore to the player that called the missile, like 1 point per each enemy killed by the missile.


  13. Now that I think about it, I think I may have been running ace sounds at the time. Sometimes I use just the ACE sounds even if I'm not running any other ACE mods at all. Maybe that was conflicting with Enigmas weather script. I never would have thought that any sound mod would even have its own weather sound effects, but I'll keep that in mind the next time I test it - without any sound mods running. Enigma's script is actually really good as far as I could tell, but I am going to try the other weather scripts that were mentioned here. I'm pretty familiar with your abilities Carl, so I can only imagine that your weather and dust storms script is awesome.

    Here's the link to Enigmas Dynamic Weather Effects http://www.armaholic.com/page.php?id=16096


  14. I finally learned how to create a dialog to use instead of hints that display the players current health in the bottom right corner, but I'm having problems with it where I use ctrlSetText and ctrlSetTextColor within the players init EH "hit". It's probably very simple to fix, I'm just not sure how. I didn't want to hijack this thread with it, so I posted about it here:

    http://forums.bistudio.com/showthread.php?140559-ctrlSetText-problem&p=2230338&viewfull=1#post2230338

    Any help getting this to work would be great. Thanks.

    ==============

    Edited

    Resolved :)


  15. I think my main problem is when I use disableSerialization; I then get errors where I use _unit or anything with an underscore. I'm not sure how to work around this.

    Below are the scripts that relate to everything that I am trying to do. Basically I have create a dialog that shows your health status on the screen. It appears in the bottom right corner of the screen and sits there the entire mission like it's an additional HUD feature. It simply says Health: 100 and the word "Health:" changes from green, to yellowgreen, yellow, orange and red as you take more damage and the number "100" changes in value and always appears in white text.

    I have event damage handlers that disables all body part damage that a player would normally take and I base the player damage on "overall" damage only. This allows me to give the player additional body armor and insures me that my health calculations are exact, but it disables the player from looking bloody. Then I have another event handle for when the player is "Hit" that then calculates the damage taken and it is supposed to then update the dialog with the current health value and change the color of the word "Health:". It will also "setHit" at certain health levels to make the player appear bloody, starting with the hands, then body, legs and lastly face.

    My problem comes in when I use addEventHandler ["Hit",... in the players init. For some reason it doesn't want to update my dialog when I use ctrlSetText or ctrlSetTextColor.

    It is the very last thing I need to do to get everything working correctly. I could really use some help with this. It's a great script if I could just get it working correctly. I had everything working great when I was using simple hint messages instead of a dialog/hud, but I do not want to use hints, especially after I finally figured out how to create a dialog for this.

    init.sqf:

    _health_stats = execVM "dialog\health_status.sqf";

    description.ext:

    #include "dialog\dialog.cpp"

    dialog.cpp:

    #define CT_STATIC           0
    #define ST_LEFT           0x00
    
    class RscPicture
    {
    access = 0;
    type = 0;
    idc = -1;
    style = 48;
    colorBackground[] = {0,0,0,0};
    colorText[] = {1,1,1,1};
    font = "TahomaB";
    sizeEx = 0;
    lineSpacing = 0;
    text = "";
    fixedWidth = 0;
    shadow = 0;
    x = 0;
    y = 0;
    w = 0.2;
    h = 0.15;
    };
    
    class RscTitles
    {
    class Health_Hud
      	{
         	idd = 1000;
        	movingEnable=0;
         	duration=1e+011;
         	name = "Health_Hud_Name";
         	onLoad = "uiNamespace setVariable ['HUD', _this select 0];";
    onUnLoad = "uiNamespace setVariable ['HUD', nil]";
         	controlsBackground[] = {};
         	objects[] = {};
         	class controls
    	{
    		class bkgrnd
    		{
    			type = CT_STATIC;
    			idc = 1001;
    			style = ST_LEFT;
    			x = 0.911977 * safezoneW + safezoneX;
    			y = 0.949074 * safezoneH + safezoneY;
    			w = 0.0625 * safezoneW;
    			h = 0.025 * safezoneH;
    			font = "Zeppelin32";
    			sizeEx = 0.03;
    			colorBackground[] = {0,0,0,0.7843};
    			colorText[] = {1, 1, 1, 1};
    			text = "";
    		};
    		class health
    		{
    			type = CT_STATIC;
    			idc = 1002;
    			style = ST_LEFT;
    			x = 0.920836 * safezoneW + safezoneX;
    			y = 0.95 * safezoneH + safezoneY;
    			w = 0.03125 * safezoneW;
    			h = 0.025 * safezoneH;
    			font = "Zeppelin32";
    			sizeEx = 0.03;
    			colorBackground[] = {0, 0, 0, 0};
    			colorText[] = {0.25,1,0,1};
    			text = "Health: ";
    		};
    		class status
    		{
    			type = CT_STATIC;
    			idc = 1003;
    			style = ST_LEFT;
    			x = 0.951044 * safezoneW + safezoneX;
    			y = 0.95 * safezoneH + safezoneY;
    			w = 0.0166639 * safezoneW;
    			h = 0.0252316 * safezoneH;
    			font = "Zeppelin32";
    			sizeEx = 0.03;
    			colorBackground[] = {0, 0, 0, 0};
    			colorText[] = {1,1,1,1};
    			text = "100";
    		};
    	};
    };
    titles[] = {introImage};
    class introImage
    {	
    	idd = -1;	
    	movingEnable = 0;
    	fadein = 2;
    	duration = 12;
    	name = "IntroImage"; 
    	controls[] = {"image1"};
    
    	class image1: RscPicture
    	{	
    		x = -0.5;
    		y = -0.35;
    		w = 2;
    		h = 1.8;
    		text = "pictures\receiving_001.paa";
    	};	
    };
    };
    

    dialog\health_status.sqf:

    disableSerialization;
    
    health_hud_Shown = false;
    
    cutRsc ["Health_Hud","PLAIN"];
    _ui       = uiNamespace getVariable "HUD";
    _bkgrnd   = _ui displayCtrl 1001;
    _health   = _ui displayCtrl 1002;
    _status   = _ui displayCtrl 1003;
    _array_hud = [_bkgrnd,_health,_status];
    {_x ctrlShow false} foreach _array_hud;
    
    if !(health_hud_Shown) then {{_x ctrlShow true} foreach _array_hud; health_hud_Shown = true;};
    

    player init:

    this setVariable ["selections", []];
    this setVariable ["gethit", []];
    this addEventHandler 
    [
    "HandleDamage",
       	{
       		if (_this select 1 == "") then
       		{
       			_unit = _this select 0;
       			_selections = _unit getVariable ["selections", []];
       			_gethit = _unit getVariable ["gethit", []];
       			_selection = _this select 1;
       			if !(_selection in _selections) then
       			{
       				_selections set [count _selections, _selection];
       				_gethit set [count _gethit, 0];
       			};    
       			_i = _selections find _selection;
       			_olddamage = _gethit select _i;
       			_damage = _olddamage + ((_this select 2) - _olddamage) * 0.5;
       			_gethit set [_i, _damage];
       			_damage;
       		};
       	}
    ];
    this addEventHandler 
    [
       	"Hit",
       	{
    	_unit = _this select 0;
       		_dam = getDammage _unit;
       		_dif = 1 - _dam;
       		_total = _dif * 100;
       		_hp = round _total;
    
       		if ((_hp <=100) && (_hp >80)) then 
       		{
    		_health ctrlSetTextColor [0.25, 1, 0, 1];
    		ctrlSetText [_status, format["%1", _hp]];
       			_unit setHit ["hands", 0.9];
       		};
       		if ((_hp <80) && (_hp >60)) then 
       		{
    		_health ctrlSetTextColor [0.75, 1, 0, 1];
    		ctrlSetText [_status, format["%1", _hp]];
    		_unit setHit ["body", 0.9];
       		}; 
       		if ((_hp <60) && (_hp >40)) then 
       		{
    		_health ctrlSetTextColor [1, 1, 0, 1];
    		ctrlSetText [_status, format["%1", _hp]];
       			_unit setHit ["legs", 0.9];
       		};
       		if ((_hp <40) && (_hp >20)) then 
       		{
    		_health ctrlSetTextColor [1, 0.5, 0, 1];
    		ctrlSetText [_status, format["%1", _hp]];
    			_unit setHit ["head", 0.9];
       		};
       		if ((_hp <20) && (_hp >0)) then 
       		{
    		_health ctrlSetTextColor [1, 0, 0, 1];
    		ctrlSetText [_status, format["%1", _hp]];
    		_unit setHit ["legs", 1];
       		};
       		if (!alive _unit) then 
       		{
    		_health ctrlSetTextColor [1, 0, 0, 1];
    		ctrlSetText [_status, format["%1", _hp]];
       			_unit setHit ["hands", 1];
    		_unit setHit ["body", 1];
    		_unit setHit ["head", 1];
       		};
       	}
    ];
    

    So the last part player init is where I use ctrlSetText and ctrlSetTextColor, but it's not working. Can somebody please help me with this?


  16. I was just using an example above. The real script is pretty long and deals with a players(_unit) remaining health that gets shown in a dialog/hud. I think the reason why it won't work is because I am trying to use ctrlSetText within an addEventHandler script, because ctrlSetText seems to test fine outside the EH, but I need it to be within the EH for it to work correctly. There is something else I need to do to get it to work within an EH.


  17. I'm trying to get a dialog text to show the current damage number value, but it gives me problems when I try to use %1

    this is a more simple version of the script, just to give you an idea what I am trying to do:

    _dam = getDammage _object;
    _status ctrlSetText format ["%1",_dam];
    

    Instead of the damage value being displayed, it instead displays the word "scalar".

    If I try testing it using...

    _status ctrlSetText "hi";

    ... it does work correctly.

    I also tried doing this...

    _dam = getDammage _object;
    _text = format["%1",_dam];
    _status ctrlSetText _text;
    

    ...but that didn't work either.

    Does anybody know the correct way to do this?

    I spent 2 days just trying to learn how to create a dialog and I finally got everything exactly the way I want it and everything works, except this one thing - and it's now driving me nuts, lol.

    I read this thread: http://forums.bistudio.com/showthread.php?131515-ctrlSetText-ctrlText-not-working

    and this thread: http://forums.bistudio.com/showthread.php?128910-Dialog-IDD-amp-IDC&p=2074703&viewfull=1#post2074703

    and I've been back and forth to the dialog wiki, but I can't seem to get this resolved.

    Even in this thread, a guy by the name of ManDay explains exactly what I tried to do. http://forums.bistudio.com/showthread.php?60788-CtrlSetText-in-Description-ext

    ...but it didn't work for me.

    ---------- Post added at 01:25 AM ---------- Previous post was at 01:03 AM ----------

    I just tried doing it this way...

    _dam = getDammage _object;
    _status ctrlSetText "hi";
    sleep 5;
    ctrlSetText [_status, format["%1", _dam]];
    

    The word "hi" appeared, but then 5 seconds later nothing happened. It still just showed "hi" on the screen. No errors were reported and the word "scalar" did not appear.


  18. I can't wait. Will there be any new villages added?

    Oh, there is a small problem with the west side of the Reya Gunde Bihar Bridge where it causes your vehicle to bounce into the air a little. This happens right as you vehicle makes contact with the bridge pavement. It's not so bad with large vehicles like tanks, but it can cause an ATV to flip over and possibly get the driver killed. I've seen the same problem with the bridge from Zargabad, so I'm not sure if it can be fixed, but I thought I would mention it just in case it can be fixed. Also, the red triangle markers on the map, will they be in the next release?


  19. This is from a different thread, but it could be useful. The triggers I use are activated based on the distance from the leader, but you could base it on the distance from something else, like an object or marker.

    When I make Coop or SP missions with AI on my team I, I often get annoyed that they just stand up all the time when most the time when they are near me I would prefer that they crouch without my having to constantly tell them to crouch. So I came up with a cool idea. I added to triggers to my mission for each AI teammate. So lets say I am the leader (s1) and I told an AI teammate (s2) to regroup, and I am crouched behind a short wall observing a bunch of enemy and I don't want my dumb AI teammate to run over to me and just stand there like "duh" and get spotted by the enemy and give my position away or start firing.

    The 1st trigger tells the AI to stand if he is over 25 meters away. This keeps him moving fast when I need him to keep up with me.

    Trigger 1:

    Radius: 0

    Activation: None, Repeatedly

    Condition: s2 distance s1>25

    OnAct: s2 setUnitPos "UP"

    The 2nd trigger tells the AI to crouch if he is within 25 meters of my position. Now I don't have to give him an order to keep low.

    Trigger 2:

    Radius: 0

    Activation: None, Repeatedly

    Condition: s2 distance s1<25

    OnAct: s2 setUnitPos "MIDDLE"

    So now my AI teammate runs fast to my position and when he gets within 25 meters he crouches and moves slower and then stops an kneels next to me and does not fire because he would have to stand in order to be able to shoot over the short wall. At anytime I can give him the order to stand up and he will. The triggers will make him crouch again later since they repeat.

    So in most of my missions where I have about 14 teammates, I add triggers that make all of my AI teammates crouch when they are close to my position. It actually makes them seem smarter and very stealth oriented, lol.


  20. I'm currently using a dynamic weather script by Engima, but there are no sounds as far as I can tell, like when it rains it's totally silent. I think I did hear some thunder and lightening, but no rain sounds. I also haven't been using it for that long to know if it is the best solution for adding weather to my mission, so I wanted to come here and ask others what they use in their missions and if they might no what the best random-dynamic weather script to use would be.


  21. After creating my own sqf Death Cam script recently, I've tweaked it to be a bit better and it will also now pan to the enemy that killed you. I feel pretty happy with it, so I wanted to share it with anybody who might be interested in using it.

    I use it in coop missions that have respawn, but do not use revive. Normally in coop missions that do not use revive, when you die the screen just goes black for for how ever long the respawnDelay time is set to in the missions description.ext file - so all you see is darkness, the score chart and the time remaining before you respawn. Black screens suck, especially if the respawn time is long.

    Wouldn't it be better to see yourself flop dead and hear some music, maybe have a couple of crows start to squawk as the camera moves up into the sky a little while looking down at you - then the camera pans to the enemy that killed you and stays on that enemy as the camera continues to move up into the sky even more - then everything fades to black - and all sounds come to a silence - suddenly the blackness turns back to light and you are now standing back at base in your spawn area.

    Yeah, it's not really meant to be used in conjunction with revive scripts, but then again I never tested it with a revive script either. Sometimes I use revive in my missions and sometimes I don't. For the most part I prefer not to use revive because I like using my medkit script, so this death cam script really makes dying a lot less annoying - and... it's also nice to see who killed you - for those many times when you have no clue what it was that killed you. It would definitely give away the position of the player that killed you in a verses match, which some hosts might prefer, especially for tea-bagging reasons, lol.

    Anyway, here's a sample mission, 1 for Utes and 1 for Takistan in the same zip - MP samples as well, but you can only preview it by hosting a MP mission since there is no respawn ability in single player at all. So if it's not working correctly, it's because you need to preview it in multiplayer and host your own session. In fact, if you do test it in single player it will definitely not work at all and it is likely to conflict with the single player engine's death camera when you die - and give harmless errors.

    This script was designed to work with a "respawnDelay=37". Don't ask why I chose 37 seconds, lol, it started out as 40 and I changed it to fit well with the music length. If you set the respawnDelay any shorter in your description.ext file it will cause the cameras to still be filming after you respawn. You could edit all of the camCommit times and black out time to match your desired respawnDelay time. I suggest you try it as is, but anybody with basic scripting skills can easily change the music and camera times to their liking or do whatever they wish.

    The camera always starts out on the dying player, but then it pans to the killer, but if the player suicided or killed him or herself somehow, then the camera will stay on the player. If the player dies from any other causes, like a secondary explosion from a burning vehicle, or a fall, the camera will still stay on the player. The sample mission has enemy soldiers, an enemy tank and an enemy chopper, so you you can try to get killed different ways to see how the camera will spectate different enemy vehicles. Works well on any enemy vehicle/soldier. There's also a flagpole that you can run up to that will spawn an explosion that will kill you, which I left in the sample mission for the purpose of testing other natural causes of death where no killer is involved.

    The music that plays is actually a short recording of a song that comes with Operation Arrowhead, so it is actually a sound file, though it does sound more Afgani than Russian, but should still work okay for any mission type. You can easily swap the sound file for one of your own sound files, just make sure the sound finishes playing before the respawnDelay time finishes. I actually recorded my sound file so it would play louder and louder since it had to compete against the part of the script that fades all sounds, so in the game it plays through smoothly.

    There is also a hideBody script that will hide and delete your dead body just before the respawnDelay finishes, so if you are already using a hide body script in your mission for your playable units, then you can either remove your hide body script, or remove the hide body scripts that is used in the sample mission.

    Death_Cam_Sample_Mission.zip


  22. Mortars are a bit weird. To get Mortars to fire at will is a little different, but still easy. I've used them in missions, but I much prefer using the D-30 artillery since it's more direct, fast and scary as hell.

    Just placing a D-30 in your mission with an Artillery module doesn't work as well as when you also force the artillery gun to scan. Without the scanning script, if the artillery gun has it's back to you, it won't ever see you and it's very easy to simply snipe and kill the gunner.

    If you're interested in using a D-30 that scans, Try this...

    Place 8 markers named N,NE,E,SE,S,SW,W,NW at the corresponding locations along the border of the map.

    Place a US marksmen and a hill(doesn't have to be that high up) with this in his init(to keep you from dying):

    this addEventHandler ["HandleDamage",{false}];

    Now place an empty HMMWV beside the US marksmen on a hill.

    Place a D-30 Artillery gun about 300 or 400 meters away at a lower altitude with its back to you and put this in D-30 init:

    null = [] execVM "arty1.sqf";

    Then copy the following and paste it into

    art1.sqf:

    arty1 setCombatMode "RED";
    
    while {alive arty1} do {
    arty1 commandWatch markerPos "N";
    sleep 1.8;
    arty1 commandWatch markerPos "NE";
    sleep 1.8;
    arty1 commandWatch markerPos "E";
    sleep 1.8;
    arty1 commandWatch markerPos "SE";
    sleep 1.8;
    arty1 commandWatch markerPos "S";
    sleep 1.8;
    arty1 commandWatch markerPos "SW";
    sleep 1.8;
    arty1 commandWatch markerPos "W";
    sleep 1.8;
    arty1 commandWatch markerPos "NW";
    sleep 1.8;
    };
    

    Now add an Artillery module. There is no reason to synchronize it to anything. Actually, you don't even need it at all, but I use it for other things in my mission.

    Now preview the mission and you will notice the artillery gun scanning around, but he probably won't see you since AI have brain tumors. Wait until he scans around and has his back to you, then hop into the HMMWV and drive a few feet and stop and leave the engine running, he will definitely spot you the next time he scans passed your position. Usually they spot vehicles very fast if they are moving or if the engine is still running, but you could also snipe near his position a few times with your rifle to get his attention just the same. His accuracy is another story, but that can be tweaked with other scripts. I actually prefer that he misses alot.

    Now if you try testing the mission without the scanning script and clear the init of the D-30 gun and when you start the preview, hop inside the HMMWV and start driving around and the D-30 will not see you or fire at you unless you drive way out directly in front of where his gun is pointing. Or if you start the preview and try to get the D-30 gunners attention by shooting at his gun, it usually takes about 10 or more shots before he finally turns around and looks for you, which is lame since if it was a real mission you would have just killed him before he ever knew you were in the area. So yeah, the scanning script really helps.

    In my latest mission I placed 3 empty D-30's at one end of the airstrip and another 3 at the other end. I tell all 6 D-30's to be hidden using arty_name hideObject true;. When the airstrip task is eventually assigned I then run a script that set all of the arty guns to arty_name hideObject false; and I then spawn the gunners and then use assignVehicle, orderGetIn and moveInGunner and then script the guns to scan all directions. I even spawn men that are moved into the cargo of the guns and if the gunner dies it will then eject the man that is in cargo and assign and move him to the gunner seat and he will then begin to scan too.

    With this method, the AI will fire their artillery guns at very close range, closer than they would normally be allowed to if they used the artillery computer. If you Kill the gunners and then get in the gun and choose the Artillery Computer on the actions menu, you will notice that there is no range circles and the "Fire" button cannot be used. The ammo count also shows as "--", which my guess means "unlimited" since I am able to keep firing the gun. The gun works well enough using just the scope lens.

    ---------- Post added at 11:19 AM ---------- Previous post was at 10:50 AM ----------

    For mortars, what you want to do is set up triggers in several areas that execute a script that force the mortars to fire at the area where the trigger was activated. Not very realistic. Or script it so the player that trips the trigger becomes the target.

×