Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
galzohar

Any way to disable *************** becomgin side enemy?

Recommended Posts

Currently I find myself often trying to work around certain scripts failing because a unit is no longer considered west/east/whatever once it TKs. Is there any better workaround than just having an array of all units that belonged to that side at the start of the mission? I know playerSide will keep the original side of the player, but that of course only works for the player himself...

Share this post


Link to post
Share on other sites

well. i think your friend is addrating.

when the rating becomes belove a sertan value the unit is considerd enemy.

a negative value that is.

so to make him friendly again you need to addrating to him,

example if i shoot 2 men i get a rating of -4900. i will become enemy for all. so to fix this you can use addrating 4900 to level the value.

Share this post


Link to post
Share on other sites

nuxil beat me to it. One way would be to spawn a script that adds rating to a unit so it's always a specific amount:

[] spawn {
  while {true} do {
    {
       if (_x == vehicle _x) then {
         _x addRating (5000-(rating _x));
         sleep 0.123;
       };
    } forEach allUnits;
    sleep 1.0;
 };
};

Or you could attach an event handler to each units.

Edited by Muzzleflash

Share this post


Link to post
Share on other sites

What else is rating used for? Is it actually translated to the score we see on the score screen or what?

And most importantly, how does addRating work in multiplayer (run only where unit is local, run only on the server, or run on all machines to get it to work)?

Share this post


Link to post
Share on other sites

A possibly more efficient example (untested):

while{true}do{
  if(sideEnemy countSide allUnits > 0)then{
     {
        if(side _X == sideEnemy)then{
           _X addRating (-(rating _X));
        };
     } forEach allUnits;
  };
};

Share this post


Link to post
Share on other sites
.... Is it actually translated to the score we see on the score screen or what?

no. it has nothing to do with the scoring afik.

the scoring table, uses score & addscore. altho the scoring system in arma is a bit messed up.

not sure about rating in mp. but i suspect it should be done by the server

Share this post


Link to post
Share on other sites
no. it has nothing to do with the scoring afik.

the scoring table, uses score & addscore. altho the scoring system in arma is a bit messed up.

not sure about rating in mp. but i suspect it should be done by the server

Yep. This is how I understand it too.

Share this post


Link to post
Share on other sites

Thanks Guys I was just having this same problem myself.

Big Dawg had the hook up with that script exactly what I needed.

Guess I'll go see if it works.

Worked perfect as far as I can tell. Still need to get more peeople on to see if it gives issues in MP and on dedi.

Thanks BD for the script and Demonized for bringing it up.

Edited by Rabble-Rouser

Share this post


Link to post
Share on other sites

Yeah still need to grab some people to help me test how this works in multiplayer (in terms of who needs to execute the addRating command).

Share this post


Link to post
Share on other sites

If I have a selection of playables in an MP. If I want to run that script for every player that enters, what's the correct form? Like "forEach vehicles" for every vehicle, I need that for every human player.

Share this post


Link to post
Share on other sites

From how it reads if fired from init.sqf, still need to test after death(may need to just have it in a respawn resync .sqf), any unit that has a rating of "ENEMY" will insatntly not be "ENEMY any more.

In my testing I have a trigger for West and East, if you team kill a chopper you would be considered an "ENEMY" do to your rating getting -7000 points, my triggers would not fire after a player had become "ENEMY".

When I added the script I loadded up a satchel, got in a chopper and landed near my trigger. Placed a satchel next to my chopper ran to my trigger waited for conformation of being in trigger and Touched Off 1 Bomb. My trigger didn't even have time to register that I had hit the "ENEMY state, trigger just kept right on firing.

Testing it in a vehicle dosn't fire the loop properly:(

I tried adding vehicle player instead of allunits as a new if statement in the loop, but no go.

I will mess with it today and keep an eye here see if something pops up

---------- Post added at 23:34 ---------- Previous post was at 21:53 ----------

OK so I messed it up this morning before testing had to go backwards a little.

WORKS while in vehicles as well and I think is MP compatible this way.

init.sqf

//reset friendly status
[] execVM "addrating.sqf";

addrating.sqf

//comment is for a param later on. 
_keep_friendly = true; // if (d_addratings == 1) then {_keep_friendly = true} else {if (d_addratings == 0) then {_keep_friendly = false}};
while {_keep_friendly} do 
{ 
if (sideEnemy countSide allUnits > 0) then
	{ 
	{if (side _X == sideEnemy) then
		{ 
		_X addRating (-(rating _X)); 
		}; 
	} forEach allUnits; 
	}; 
};

Just reminding that this will need to be fired again after respawn

Edited by Rabble-Rouser

Share this post


Link to post
Share on other sites

Instead of if you may want to use waitUntil, that way the loop won't run as much as the engine allows it but only check once every frame. Of course I'm still not sure whether this should be run on the server, on clients, or both.

Share this post


Link to post
Share on other sites
Instead of if you may want to use waitUntil, that way the loop won't run as much as the engine allows it but only check once every frame. Of course I'm still not sure whether this should be run on the server, on clients, or both.

A wait and an if inside of a while are essentially the same thing, I imagine they are pretty much the same in terms of performance.

Share this post


Link to post
Share on other sites

Does a while also wait for next frame before re-evaluating?

Share this post


Link to post
Share on other sites

Sorry got busy yesterday couldn't finish tetsing, but I think from testing that addrating is global and when run on a client it broadcasts to the server the addrating value. But I could be wrong that is how it worked in my file setup.

In my files triggers are created by each player and server and the addrating only worked when run by the client on a dedicated server.

Hope that helps some galzohar

Not sure about while waiting a frame

I use if in my while loops essentially to be able to time my loops with a sleep command. I am sure I could just as easily use waituntil also, but I would think that is dependent on what you are trying to accomplish in the script.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×