Jump to content
Sign in to follow this  
anusmangler

Scripting to have Blufor and OPP want to kill CIVs

Recommended Posts

OK I have this awesome mission idea. Basically long story short, theres going to be points on the map that are controled by bluefor and OPP with their own war going on and whatever. You play as a civ that finds a gun and takes it upon yourself to help either side or just do your own thing (kinda like fallout.....but witha rouge civ's). Now I remember seeing in a Gameplay thing for ARMA 3 that it matters what uniform your wearing because you can disgiese yourself to get into bases without blowing up the front door....BUT.....it doesnt work. as a civ you can dress up as either side and they wont attack you. they do nothing nor can you have a blufor unit dress like a opp because you cant equip their uniform......So 1 how do I get uniforms of both sides into a box 2 how do I get the issue of units seeing my cloths and attacking or not attacking? also....on a side note I would like to be able to talk to other Civs on the map and have them join me and be able to trade equipment and cloths <- but at this time this is not important just something im working on. Iam told I design worlds really well, but I suck when it comes to scripting and stuff.

Any help would be greatly appreciated on any of these questions!

---------- Post added at 16:14 ---------- Previous post was at 15:52 ----------

video about uniforms if you think im crazy

Share this post


Link to post
Share on other sites

can I have alittle more detail please? Like I said I can build believable sets and worlds...... scripting makes my head hurt...

I used the setfriend but it makes both sides not attack each other....see im not good scripting

Edited by Anusmangler

Share this post


Link to post
Share on other sites

^ so your saying following those links, I'll be able to shoot say opp and the bluefor will like me and not shoot but if suddenly I start killing bluefor the OPP will start to like me again? I need it to change how diffrent people react to the missions they are given.

Share this post


Link to post
Share on other sites

You can also attach a game logic to the player and have enemies dotarget and dofire it.

Share this post


Link to post
Share on other sites
^ so your saying following those links, I'll be able to shoot say opp and the bluefor will like me and not shoot but if suddenly I start killing bluefor the OPP will start to like me again? I need it to change how diffrent people react to the missions they are given.

If you setFriend both sides against you they will be permanently hostile to you, if you want to dynamically change their hostility, will probably be better changing own rating back and forth.

Share this post


Link to post
Share on other sites

^how do I do that? It has to change dynamically depending on your "liked"-ness in the faction you will receive missions or be shot at. I guess I'll have roaming units of both sides you can kill to up your "liked"-ness on the opposite side.

Share this post


Link to post
Share on other sites

There is also a 'Module -Group Modifier - Switch Sides' in the editor.

Share this post


Link to post
Share on other sites

Please for the love of god can I get alittle "how to" cause I tried the "addRating" My script was "unit addrating 0" so you start with no rating. started up the editor and killed like 20 oppfor and each one watched me walk up to them and kill them execution style. I really have no idea how to script so just alittle help would be awesome on that end. Iam def willing to learn.

---------- Post added at 20:15 ---------- Previous post was at 20:14 ----------

Does the group modifier change dynamically .....i need it to change based on how much you help one side or the other.

---------- Post added at 20:22 ---------- Previous post was at 20:15 ----------

Ive been reading about setting a side for the civ you play as. should I set him to "Resistance"?

Share this post


Link to post
Share on other sites
Does the group modifier change dynamically .....i need it to change based on how much you help one side or the other.

Well you would need to set the Conditions of a Trigger that would then activate the Switch Side Module. Your asking for a variety of conditions that would activate Switch Sides ie..Dialogue/Killing a certain amount of enemies etc... Each one of those would require a certain script to activate. Best advice i can give is to look at other Trigger scripts and then try to replicate them -it's what I do :p

Share this post


Link to post
Share on other sites

doing a little more research I started a init.sqm and added

"EAST setFriend [CIVILIAN, 0];

WEST setFriend [CIVILIAN, 0];

CIVILIAN setfriend [WEST, 1];

CIVILIAN setfriend [EAST, 1];"

However 1 problem whenever I kill one side doesnt matter which one, they both kill me. ? am I at least close?

---------- Post added at 21:14 ---------- Previous post was at 21:09 ----------

froggyluv still not sure what you mean? for right now I to improve and decrease rating within a faction.... http://community.bistudio.com/wiki/addRating I need it to change not on exact numbers but by how many points killing units of the other faction are like this http://community.bistudio.com/wiki/ArmA:_Rating_Values I just dont know how to implement them....

---------- Post added at 21:52 ---------- Previous post was at 21:14 ----------

nothing seems to work, tried to link my self with independent units, kill on side/ they both kill you, set the rating, kill one side both kill you, Set the group switch kill one side they both kill you, set the init file with my script kill one side they both kill you.......AHHH this is driving me crazy! HELP PLEASE! details are nice if you know how.

Share this post


Link to post
Share on other sites

Dude seriously, did you even bother to read links CiforDayZServer posted? It is all there, everything you need to know. You need to give yourself negative rating below -2000.

Run this command in the debug console

player addRating -1000000

now walk up to any armed unit they will shoot you on sight

Share this post


Link to post
Share on other sites

HAHA no i got that part.....I want to improve my relations...if I have alow score with one side, Is there a way to kill the other side so the orginal side stops shooting you? thats the question. I can get myself killed easily...

---------- Post added at 22:06 ---------- Previous post was at 21:58 ----------

maybe if I explain better, I want both sides to either hate or like me depending if i attack their side or not....and if I want to change sides after playing a while I want to be able to start killing the side i started with and "defect" to the other side. thats what I'm going for. getting the units to just kill you is the easy part. I want to make friends. I tried to set the setrating to 0 and see if i can switch sides but it doesnt make one side or the other like me or not. they dont respond to me killing them or helping them kill the other side.

Edited by Anusmangler
clarification

Share this post


Link to post
Share on other sites

Then there is easy solution

Bluefor is west

Opfor is east

your player is civilian

when you want BF shoot you and OP be friendly

[player] join (createGroup east);

vice versa

[player] join (createGroup west);

both of them shoot you

player addrating -1000000;

both of them be friendly

player addrating 1000000;

[player] join (createGroup civilian);

Edited by Killzone_Kid
sorry you need to add opposite of negative rating to make it 0

Share this post


Link to post
Share on other sites
Then there is easy solution

Bluefor is west

Opfor is east

your player is civilian

when you want BF shoot you and OP be friendly

[player] join (createGroup east);

vice versa

[player] join (createGroup west);

both of them shoot you

player addrating -1000000;

both of them be friendly

player addrating 0;

[player] join (createGroup civilian);

just deal with my ignorance for 2 more mins. I need it to be dynamic. so will that ^ work? also do I stick that into the init file or the player unit script? thank you for clearing that up

Share this post


Link to post
Share on other sites
just deal with my ignorance for 2 more mins. I need it to be dynamic. so will that ^ work? also do I stick that into the init file or the player unit script? thank you for clearing that up

I edited my post above about addrating. it should work. takes some time for ai to realise you are on the wrong side though.

Share this post


Link to post
Share on other sites
I edited my post above about addrating. it should work. takes some time for ai to realise you are on the wrong side though.

where do I stick that script? in the init or player screen?

Share this post


Link to post
Share on other sites

press escape, paste it in debug console, LOCAL EXEC, press escape to hide console.

Share this post


Link to post
Share on other sites
press escape, paste it in debug console, LOCAL EXEC, press escape to hide console.

pasted "[player] join (createGroup east);

vice versa

[player] join (createGroup west);

both of them shoot you

player addrating -1000000;

both of them be friendly

player addrating 1000000;

[player] join (createGroup civilian);" in there? I'll try it now

---------- Post added at 22:51 ---------- Previous post was at 22:44 ----------

sry bro still not working....As soon as I kill a oppfor unit they shoot at me and so does bluefor. I need to kill oppfor and bluefor like me then if (While still playing without editing it from the editor) i start killing bluefor the oppfor will like me again and bluefor will start to shoot at me.....it has to be dynamic. While playing...not from the editor.

Share this post


Link to post
Share on other sites

yes it works i tested it before giving you example. pause and execute command one at a time depending on what you want happen. i am not goint to write the whole script for you sorry, maybe someone else will.

Share this post


Link to post
Share on other sites

what you want is kindof a reputation system with the factions.

i would go for:

- store bluefor and opfor kills on your character

- based on that information, set your player to east or west

the in-built rating system will not help you with what you want to achieve.

The above solution demands a couple of things though, like e.g. if you ARE east, and shoot an east AI, ARMA lowers your rating, and by that at some point you are switched over to side enemy automatically. afaik rating doesnt get reset when you switch sides via a group join (untested), so you might need to implement a logic for that as well.

Sarge

Share this post


Link to post
Share on other sites

The whole lowering rating might be solved either by having a script in the background that keeps resetting the rating every sec, or add killed eventhandlers to all units which reset the rating when you kill them.

Share this post


Link to post
Share on other sites

^ yes! FINALY someone that understands what Im talking about. Ok any suggestuions on how to do that? Im gunna hop over to the wiki and see if I can find anything. Im terrible at scripting so Like alitle how to or something would be awesome.

Share this post


Link to post
Share on other sites

Hey there! Try this script. Paste it into "init.sqf" in your mission folder.


_botArray = if (isMultiplayer) then {allUnits - playableUnits} else {allUnits - [player]};

{

_x addMPEventHandler ["MPkilled",{
		_victim = _this select 0;
		_killer = _this select 1;

		if (_killer in playableUnits or _killer == player) then {
			_killer addRating (- (rating _killer)); //prevent player from becoming hostile to both sides

			switch (side group _victim) do {
				case WEST:{_killer setVariable ["bluforKilled",(_killer getVariable "bluforKilled") + 1]};
				case EAST:{_killer setVariable ["opforKilled",(_killer getVariable "opforKilled") + 1]};
				default{};
			};

			if (local _killer and _killer == player) then {
				_killer spawn {//difference between opforkills and bluforkills. 
					_bluforKilled = _this getVariable "bluforKilled";
					_opforKilled = _this getVariable "opforKilled";

					_ratio = _bluforKilled - _opforKilled;

					if (_ratio > 1) then {_ratio = 1};
					if (_ratio < -1) then {_ratio = -1};

					if (_ratio == 1) then {
						[_this] joinSilent (creategroup east);
						hint "BLUFOR are now hostile!";

					};
					if (_ratio == -1) then {
						[_this] joinSilent (creategroup west);
						hint "OPFOR are now hostile!";
					};
				};
			};

		};
	}
];

}forEach _botArray;

if (!isDedicated) then {
//set initial kills of each side to zero
player setVariable ["opforKilled",0];
player setVariable ["bluforKilled",0];
};

Should work for multiplayer as well. Killing a blufor unit makes you join a opfor group, thus opfor are friendly, and vice versa. I made it so that if f.ex you are on OPFOR side, if you kill two OPFOR soldiers in a row, you change sides.

Edited by Tuliq

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  

×