virginharvester Posted May 22, 2018 Share Posted May 22, 2018 hi, sorry for my bad english,i know is bad as it sounds,but i like to know if this feature is exist or not : Event OnPlayerEnterCombat() DisablePlayerInput() EnablePlayerAI()EndEvent Event OnPlayerLeaveCombat() EnablePlayerInput() DisablePlayerAI()EndEvent Link to comment Share on other sites More sharing options...
dagobaking Posted May 22, 2018 Share Posted May 22, 2018 Do you want the game AI to take over the player character? That is possible with this: Game.SetPlayerAIDriven()More info: https://www.creationkit.com/fallout4/index.php?title=SetPlayerAIDriven_-_Game Link to comment Share on other sites More sharing options...
virginharvester Posted May 22, 2018 Author Share Posted May 22, 2018 Do you want the game AI to take over the player character? That is possible with this: Game.SetPlayerAIDriven()More info: https://www.creationkit.com/fallout4/index.php?title=SetPlayerAIDriven_-_Gamethanks for reply,anyway i have test it using key triggerthis is the script : Scriptname HotKeyScript extends QuestEvent OnInit() RegisterForKey(161) ;R-Shift RegisterForKey(163) ;R-Ctrl RegisterForKey(165) ;R-AltendEvent Event OnKeyDown(Int KeyCode) If KeyCode == 161 Game.GivePlayerCaps(100) Endif If KeyCode == 163 Game.SetPlayerAIDriven() endif If KeyCode == 165 Game.SetPlayerAIDriven(false) endifendEvent and the player still do nothing?, even in combat,any clue or guide or missing step?,anyway the give 100 caps is working normal Link to comment Share on other sites More sharing options...
werr92 Posted May 22, 2018 Share Posted May 22, 2018 SetPlayerAIDriven() won't give you anything, it just tells Game, that your player character should from now on adhere to AI packages. Before you'll be able to force player do somkething, you need to take control from him. For that you must create an InputEnableLayer on which DisablePlayerControls() would be called. This should be created in something... persistent, such as Quest Script. Thus it should look something like this: Scriptname HotKeyScript extends Quest InputEnableLayer Property ielLayer01 auto Hidden Event OnQuestInit() RegisterForKey(161) RegisterForKey(163) RegisterForKey(165) endEvent Event OnKeyDown(Int KeyCode) If KeyCode == 161 Game.GivePlayerCaps(100) endif If KeyCode == 163 DisableControls() endif If KeyCode == 165 EnableControls() endif endEvent Function DisableControls() ielLayer01 = InputEnableLayer.Create() ielLayer01.DisablePlayerControls(true, true, true, true, true, true, true, true, true, true, true) Game.SetPlayerAIDriven() endfunction Function EnableControls() ielLayer01.EnablePlayerControls() ielLayer01.Delete() ielLayer01 = NONE Game.SetPlayerAIDriven(false) endfunction And if you want player to run some packages, participate in a scene - well, now you can use him. Don't forget to call EvaluatePackage() on player when scene starts, just to make sure he instantly starts running that. Link to comment Share on other sites More sharing options...
virginharvester Posted May 22, 2018 Author Share Posted May 22, 2018 SetPlayerAIDriven() won't give you anything, it just tells Game, that your player character should from now on adhere to AI packages. Before you'll be able to force player do somkething, you need to take control from him. For that you must create an InputEnableLayer on which DisablePlayerControls() would be called. This should be created in something... persistent, such as Quest Script. Thus it should look something like this: Scriptname HotKeyScript extends Quest InputEnableLayer Property ielLayer01 auto Hidden Event OnQuestInit() RegisterForKey(161) RegisterForKey(163) RegisterForKey(165) endEvent Event OnKeyDown(Int KeyCode) If KeyCode == 161 Game.GivePlayerCaps(100) endif If KeyCode == 163 DisableControls() endif If KeyCode == 165 EnableControls() endif endEvent Function DisableControls() ielLayer01 = InputEnableLayer.Create() ielLayer01.DisablePlayerControls(true, true, true, true, true, true, true, true, true, true, true) Game.SetPlayerAIDriven() endfunction Function EnableControls() ielLayer01.EnablePlayerControls() ielLayer01.Delete() ielLayer01 = NONE Game.SetPlayerAIDriven(false) endfunction And if you want player to run some packages, participate in a scene - well, now you can use him. Don't forget to call EvaluatePackage() on player when scene starts, just to make sure he instantly starts running that.hi, thanks a lot for reply,in simple way,if player in combat mode,the player control will taken by AI,then the player will do auto combat until all enemies died,now have i try your script, and it do nothing,maybe because i not put the packages before it,any clue or links where i put "combat packages" into player?once again thanks for reply. Link to comment Share on other sites More sharing options...
dagobaking Posted May 22, 2018 Share Posted May 22, 2018 hi, thanks a lot for reply,in simple way,if player in combat mode,the player control will taken by AI,then the player will do auto combat until all enemies died,now have i try your script, and it do nothing,maybe because i not put the packages before it,any clue or links where i put "combat packages" into player?once again thanks for reply. Yes. Turning off user inputs isn't going to cause the character to do anything. You do need to apply Packages to let the game know what you want them to do (just like any other NPC). There are multiple ways to do that. And unfortunately, all of them are cumbersome to work with (lots of setup, difficult to determine why they fail when they do, many ways for one Package to conflict with another). Probably the most reliable method is to use a Quest with a Scene that applies the Package you want to a Reference Alias (having fun yet?). You will need to ensure that the Quest is running, populate the Reference Alias and then start the Scene after SetPlayerAIDriven to True. Another possibility that might be amusing if it works (haven't tested) is this: Game.SetPlayerAIDriven() PlayerRef.StartFrenzyAttack()https://www.creationkit.com/fallout4/index.php?title=StartFrenzyAttack_-_Actor Or, you can make more targeted calls that might work with player in AI control: PlayerRef.StartCombat(AnEnemyActor)https://www.creationkit.com/fallout4/index.php?title=StartCombat_-_Actor Link to comment Share on other sites More sharing options...
virginharvester Posted May 22, 2018 Author Share Posted May 22, 2018 Another possibility that might be amusing if it works (haven't tested) is this: Game.SetPlayerAIDriven() PlayerRef.StartFrenzyAttack()https://www.creationkit.com/fallout4/index.php?title=StartFrenzyAttack_-_Actor Or, you can make more targeted calls that might work with player in AI control: PlayerRef.StartCombat(AnEnemyActor)https://www.creationkit.com/fallout4/index.php?title=StartCombat_-_Actor hi, thanks for reply,i have test the frenzy formula,and it not work,i will do some research about it today Link to comment Share on other sites More sharing options...
dagobaking Posted May 22, 2018 Share Posted May 22, 2018 Ok. Yeah. I wasn't sure if it would. Looks like you will need to work with Packages instead. Link to comment Share on other sites More sharing options...
werr92 Posted May 23, 2018 Share Posted May 23, 2018 In my opinion, the easiest and the most reliable way to force fight is to add NPCs to faction which is "Enemy" to PlayerFaction. Add with a script, 'f course. Link to comment Share on other sites More sharing options...
dagobaking Posted May 23, 2018 Share Posted May 23, 2018 True. Though, that just gets the enemies to fight the player. I think the OP is trying to get the AI to control the player character in the fight until the fight is over. Link to comment Share on other sites More sharing options...
Recommended Posts