Announcement

Collapse
No announcement yet.

you r gonna make it bro!

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • you r gonna make it bro!

    Hello!


    I have a question for script wizards here. With ACE2 enabled, would it be possible to stop a unit from getting damage after a certain point? Something like ; If damage reach .8 then allowdamage false. Then when damage reach .7 (being healed) then allowdamage true.


    Is there a simple way to do this? Im not very good with script :(




    Thanks!

    Cheers

    -Rat
    sigpic


    Dont be shy, add me on Steam by clicking the icon below.




  • #2
    Re: you r gonna make it bro!

    Run this for each individual unit. Name is damage.sqf and in init.sqf place:

    Code:
    execVM "damage.sqf";
    Code:
    while{true} do
    {
    	_damagelevel = player damage;
    	if(_damagelevel >=0.8) then
    	{
    		allowDamage = false;
    	}
    	else
    	{
    		allowDamage = true;
    	};
    	sleep 0.1;
    };
    To change the amount, just change the 0.8 number. That's the number the damage cuts off. You may want to remove the sleep 0.1 if you want infinite health. I'm not sure how this would work for stopping all death, it also might cause FPS issues. I'm not sure.

    If you have respawn (which I'm assuming you dont, if you want this script...), you will need to place the execVM on your respawn script aswell. An example of the respawn script would be:

    Code:
    while {true} do
    {
    	waitUntil {!alive player};
    	waitUntil {alive player};
    	execVM "damage.sqf";
    };
    Name that respawn.sqf, and then your init.sqf would be:

    Code:
    execVM "damage.sqf";
    execVM "respawn.sqf";

    I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

    Comment


    • #3
      Re: you r gonna make it bro!

      Thanks for your help! This looks good. I will try it and let you know what happen.
      sigpic


      Dont be shy, add me on Steam by clicking the icon below.



      Comment


      • #4
        Re: you r gonna make it bro!

        Originally posted by Ratatomik View Post
        Thanks for your help! This looks good. I will try it and let you know what happen.
        Alright! Make sure to have showScriptErrors on!

        I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

        Comment


        • #5
          Re: you r gonna make it bro!

          I totally just realized I used the wrong syntax on the damage command. Try this:

          Code:
          while{true} do
          {
          	_damagelevel = damage player;
          	if(_damagelevel >=0.8) then
          	{
          		allowDamage = false;
          	}
          	else
          	{
          		allowDamage = true;
          	};
          	sleep 0.1;
          };

          I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

          Comment


          • #6
            Re: you r gonna make it bro!

            I doesnt seem to work. But dont worry about it ill try to find a way around. Maybe with the PMR if i can figure it out lol

            Thanks for you help!



            -Rat
            sigpic


            Dont be shy, add me on Steam by clicking the icon below.



            Comment


            • #7
              Re: you r gonna make it bro!

              do you have showscripterros turned on? That'll tell you what is wrong. Assuming it's just not possible like this.

              I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

              Comment


              • #8
                Re: you r gonna make it bro!

                The reason it isn't working is because you're using "allowDammage false" (or rather allowDamage, but essentially same command).

                Since this is ACE2 we're talking about, the wounding system runs on eventhandlers detecting hits and then deals with the actual damage afterwards. Theres an api function you have to use which can be found here: http://wiki.ace-mod.net/Wounding_System+notes

                The command you need to set is:
                Code:
                 this setVariable ["ace_w_allow_dam", false];
                So going off of Butler's code,

                Code:
                /*
                Execution Code: (put into unit's init)
                nul = [this] execVM "aceAllowDamage.sqf";
                
                Put this script into a file called "aceAllowDamage.sqf".
                */
                
                
                _unit = _this select 0;
                while{true} do
                {
                	_damagelevel = damage _unit;
                	if(_damagelevel >=0.8) then
                	{
                		_unit setVariable ["ace_w_allow_dam", false];
                	}
                	else
                	{
                		_unit setVariable ["ace_w_allow_dam", true];
                	};
                	sleep 0.1;
                };
                The only thing is, I don't know exactly how ACE handles their wounding system, so this may still knock them unconcious. There is another variable that you can set that disables wounding affects, but I don't know.

                EDIT:

                Also, butler, you had the syntax for allowDamage command wrong as well, it's:
                Code:
                _object allowDamage _boolean;
                Blackpython / ZephyrDark
                Former 31st RECCE Member

                Comment


                • #9
                  Re: you r gonna make it bro!

                  Originally posted by ZephyrDark View Post
                  Also, butler, you had the syntax for allowDamage command wrong as well, it's:
                  Code:
                  _object allowDamage _boolean;

                  I don't know how I messed that one up twice...

                  EITHER WAY, I do know the allowDammage does work. I use it in one of my current missions and it works fine.

                  One thing I didn't think about is whether it removes the ability to receive damage or resets the damage back to zero, and without a doubt using the ace version is safer.

                  I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

                  Comment

                  Connect

                  Collapse

                  TeamSpeak 3 Server

                  Collapse

                  Advertisement

                  Collapse

                  Twitter Feed

                  Collapse

                  Working...
                  X