Dynamically Changing Agression to Player

Post » Tue Feb 15, 2011 5:42 am

I'd like to dynamically change a factions aggression towards the player based on player actions. For instance trespassing, sneaking, unholstering a weapon etc. in certain cells makes them hostile to the player. But gives the player a little forgiveness if he runs off they stand down. Is there any simply way to do this?
User avatar
Leanne Molloy
 
Posts: 3342
Joined: Sat Sep 02, 2006 1:09 am

Post » Tue Feb 15, 2011 11:59 am

I'd like to dynamically change a factions aggression towards the player based on player actions. For instance trespassing, sneaking, unholstering a weapon etc. in certain cells makes them hostile to the player. But gives the player a little forgiveness if he runs off they stand down. Is there any simply way to do this?


SetEnemy and setAlly. You could change the relation to the PlayerFaction to 'friend' instead of 'neutral', etc.

http://geck.gamesas.com/index.php/Category:Faction_Functions
User avatar
Sasha Brown
 
Posts: 3426
Joined: Sat Jan 20, 2007 4:46 pm

Post » Tue Feb 15, 2011 7:56 am

Setting from enemy back to neutral or friend or ally is not so easy. You will have to make sure that all combat is stopped against the player first. I had a similar setup with my mod, where the town turns hostile to the player if he enters their defence perimeter, but quickly forgets and forgives once he leaves it. I used the following code after a good deal of frustration. Some of that is likely superfluous now, but as it works I haven't gone back and tidied it up.

ModFactionReaction HightownFaction playerFaction 100playerRef.StopCombatAlarmOnActorsetAlly HightownFaction playerFactionsetEnemy HightownFaction playerFaction 1 1


Likely that first line is not necessary...
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am

Post » Tue Feb 15, 2011 3:28 am

Setting from enemy back to neutral or friend or ally is not so easy. You will have to make sure that all combat is stopped against the player first. I had a similar setup with my mod, where the town turns hostile to the player if he enters their defence perimeter, but quickly forgets and forgives once he leaves it. I used the following code after a good deal of frustration. Some of that is likely superfluous now, but as it works I haven't gone back and tidied it up.

ModFactionReaction HightownFaction playerFaction 100playerRef.StopCombatAlarmOnActorsetAlly HightownFaction playerFactionsetEnemy HightownFaction playerFaction 1 1


Likely that first line is not necessary...


Stopping combat is indeed not as easy as you would think. I'm surprised you didn't have to dump a resetai on the whole crew. hehe.
User avatar
Mark Hepworth
 
Posts: 3490
Joined: Wed Jul 11, 2007 1:51 pm

Post » Tue Feb 15, 2011 12:10 am

Stopping combat is indeed not as easy as you would think. I'm surprised you didn't have to dump a resetai on the whole crew. hehe.


Indeed. I have been using the above though for some time, and it works instantly and perfectly every time. It is part of a trigger that sets Hightown hostile to the player if he snoops around beneath it, and back to normal if he leaves that area. It is simulating that the town is not really hostile, but rather just fires upon anyone who enters the 'no go' zone.
User avatar
Melung Chan
 
Posts: 3340
Joined: Sun Jun 24, 2007 4:15 am

Post » Tue Feb 15, 2011 7:53 am

Indeed. I have been using the above though for some time, and it works instantly and perfectly every time.

I did something similar with the fight arena quest I did a while back, but went a different route. Instead of changing the ally/enemy status of the player, I simply removed the player from the PlayerFaction and added a custom faction already set to cause the reaction I needed.
User avatar
Lawrence Armijo
 
Posts: 3446
Joined: Thu Sep 27, 2007 7:12 pm


Return to Fallout 3