Jump to content
Sign in to follow this  
quensi130

Passive Agressive AI

Recommended Posts

I would like to create a mission where the AI do not shoot at me enless I do something like shoot at them, throw a grenade or kill one like at the checkpoint at the start of the first chapter in the campaign.

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/setFriend

https://community.bistudio.com/wiki/getFriend

Add a 'Hit' or 'Killed' event handler to the units, and when triggered, use setFriend to adjust the diplomacy value.

Example:

QS_unit_checkpointGuard_1 addEventHandler [
'Killed',
{
	_killed = _this select 0;
	_killer = _this select 1;
	(side _killed) setFriend [(side _killer), (((side _killed) getFriend (side _killer)) - 0.1)];
}
];

That will adjust side diplomacy.

To have it affect only you, use rating and addRating.

https://community.bistudio.com/wiki/addRating

https://community.bistudio.com/wiki/rating

QS_unit_checkpointGuard_1 addEventHandler [
'Killed',
{
	_killed = _this select 0;
	_killer = _this select 1;
	//(side _killed) setFriend [(side _killer), (((side _killed) getFriend (side _killer)) - 0.1)];
	_killer addRating -2001;
}
];

Alternatively, start the player as a 'captive', using setCaptive

https://community.bistudio.com/wiki/setCaptive

https://community.bistudio.com/wiki/captive

QS_unit_checkpointGuard_1 addEventHandler [
'Killed',
{
	_killed = _this select 0;
	_killer = _this select 1;
	//(side _killed) setFriend [(side _killer), (((side _killed) getFriend (side _killer)) - 0.1)];
	//_killer addRating -2001;
	_killer setCaptive FALSE;
}
];

Edited by MDCCLXXVI

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  

×