MisterRADical Posted February 5, 2020 Share Posted February 5, 2020 I can't seem to get this to work, here's what I got: Scriptname placeholder extends ObjectReference Actor Property Actor1 Auto Auto State DoOnceState Event OnActivate(ObjectReference akActionRef) if (akActionRef == Game.GetPlayer()) if Game.GetPlayer().GetLevel() >= 30 Int Num = Utility.RandomInt(0, 1) If Num == 1 GoToState ("DoNothingState") Int Num2 = Utility.RandomInt(0, 1) If Num2 == 1 Game.GetPlayer().PlaceAtMe(Actor1) GoToState ("DoNothingState") endIf endIf endIf endIfendEvent EndState State DoNothingStateEndState Link to comment Share on other sites More sharing options...
thumbincubation Posted February 5, 2020 Share Posted February 5, 2020 I don't know if this will help, but if you have Skyrim, there's a chest in a small cave/nook, directly under Dragonsreach, where 3 bandits spawn as soon as you pick the lock. I think the scripts between FO4 and Skyrim work about the same way. Might be able to get what you need from it. Link to comment Share on other sites More sharing options...
thumbincubation Posted February 5, 2020 Share Posted February 5, 2020 I just went and took a look at it in the Skyrim SE creation kit. It looks like they have the 3 npcs linked to an x-marker as enable parent. The X marker has and L shaped marker (Trap Linker) next to it, and has a Link Ref to the Trap linker but no scripts of its own. The Trap Linker has a Linked Ref to the X marker, and also an Activate Parent from the treasure chest itself. It has two scripts. One is a Trap Trigger Base (inherited from parent) which seems to list different variables and things like the light foot perk, light hands perk, owning actor, owning faction, etc. The other is DefaultActivateToggleLinkedRefOnce (added locally) and none of its properties seem to have been modded. I don't know if any of this is helpful or not, but maybe. Link to comment Share on other sites More sharing options...
SKKmods Posted February 5, 2020 Share Posted February 5, 2020 Assuming this a a Fallout4 script; (1) you cant spawn an actor, only an ActorBase and that should use PlaceActorAtMe. (2) You also have an Else missing so true will never trigger. Rather than multiple functions, work your the probability you want and run a single call; (3) Game.GetPlayer() is a slow function call, if using multiple times assign a variable (4) Debug.Trace *every step* so you can see where stuff is going wrong. Use console command [reloadscript placeholderscript] to update in the same game session. Scriptname placeholderscript extends ObjectReference ActorBase Property lvlRaider Auto Const Mandatory Auto State DoOnceState Event OnActivate(ObjectReference akActionRef) Debug.Trace("placeholderscript.OnActivate " + Self) Actor PlayerREF = Game.GetPlayer() If (akActionRef == PlayerREF) && (PlayerREF.GetLevel() >= 30) Debug.Trace("placeholderscript.OnActivate " + Self + " player conditions met") If (Utility.RandomInt(0, 100) >= 75) Actor ThisActor = PlayerREF.PlaceActorAtMe(lvlRaider, aiLevelMod = 4, akZone = None) Debug.Trace("placeholderscript.OnActivate " + Self + " spawned " + ThisActor ) Else Debug.Trace("placeholderscript.OnActivate " + Self + " no spawn") EndIf GoToState ("DoNothingState") Else Debug.Trace("placeholderscript.OnActivate " + Self + " player conditions not met") EndIf EndEvent EndState State DoNothingState ;intentional blank EndState Link to comment Share on other sites More sharing options...
MisterRADical Posted February 5, 2020 Author Share Posted February 5, 2020 Assuming this a a Fallout4 script; (1) you cant spawn an actor, only an ActorBase and that should use PlaceActorAtMe. (2) You also have an Else missing so true will never trigger. Rather than multiple functions, work your the probability you want and run a single call; (3) Game.GetPlayer() is a slow function call, if using multiple times assign a variable (4) Debug.Trace *every step* so you can see where stuff is going wrong. Use console command [reloadscript placeholderscript] to update in the same game session. Scriptname placeholderscript extends ObjectReference ActorBase Property lvlRaider Auto Const Mandatory Auto State DoOnceState Event OnActivate(ObjectReference akActionRef) Debug.Trace("placeholderscript.OnActivate " + Self) Actor PlayerREF = Game.GetPlayer() If (akActionRef == PlayerREF) && (PlayerREF.GetLevel() >= 30) Debug.Trace("placeholderscript.OnActivate " + Self + " player conditions met") If (Utility.RandomInt(0, 100) >= 75) Actor ThisActor = PlayerREF.PlaceActorAtMe(lvlRaider, aiLevelMod = 4, akZone = None) Debug.Trace("placeholderscript.OnActivate " + Self + " spawned " + ThisActor ) Else Debug.Trace("placeholderscript.OnActivate " + Self + " no spawn") EndIf GoToState ("DoNothingState") Else Debug.Trace("placeholderscript.OnActivate " + Self + " player conditions not met") EndIf EndEvent EndState State DoNothingState ;intentional blank EndState Thanks SKK50! You're always so good with scripts. I'm still learning so this helps and will help with future scripts. Link to comment Share on other sites More sharing options...
Recommended Posts