Jump to content

scrivener07

Premium Member
  • Posts

    1416
  • Joined

  • Last visited

Everything posted by scrivener07

  1. Something seemed weird about your loop so I just went about it how I would. I faked the parts of the script I dont have with some guess work. Scriptname Example extends Quest Actor[] Pool int random_spawn = 0 ; whatever random thing ActorBase Property LvlFeralGhoul Auto Const Mandatory ObjectReference[] Property spawn_points Auto Const Mandatory Event OnInit() Pool = new Actor[0] ; Array.Add will auto-expand size EndEvent Event OnQuestInit() SpawnGhoul() SpawnGhoul() SpawnGhoul() SpawnGhoul() SpawnGhoul() EndEvent Event OnQuestShutdown() ResetActors(Pool) EndEvent Function SpawnGhoul() Actor Spawned = spawn_points[random_spawn].PlaceActorAtMe(LvlFeralGhoul, 1) Pool.Add(Spawned) EndFunction Function ResetActors(Actor[] actors) Global If (actors) int size = actors.Length int index = 0 Debug.MessageBox("Size:"+size+"\n\nDo not change the size of your array while perform iterations.") While (index < size) Actor element = actors[index] If (element) Debug.MessageBox("Found\n"+element+"\nSetting critical stage to disintegrate end.") element.SetCriticalStage(element.CritStage_DisintegrateEnd) Else Debug.MessageBox("The element at index "+index+" was none, skipping..") EndIf index += 1 ; move to the next index EndWhile actors.Clear() Debug.MessageBox("Iteration Complete\nClearing the actor pool.\nSize:"+actors.Length) Else Debug.MessageBox("The actor pool is empty or none, skipping reset.") EndIf EndFunction
  2. I think I mislead a little but my source will create a new furniture in front of the player with `PlaceAtMe`. I recommend placing the furniture in a remote cell and using `MoveTo` instead. Like you said, the exact position of the furniture that is moved/created in front of the player may not be 100% predicable without additional coding but I found that what you get looks good 95% of the time. Invisible furniture is something I have not tried but I know is possible. Removing the animation IS as simple as removing the keyword IIRC. Im not really sure what happens if the player activates a furniture in another cell remotely. I would honestly try the remote activate first before trying the more involved implementations.
  3. You should use the default activation provided by "sleep/wait" furniture. Create a bed or chair in a new inaccessible cell. Create a script to activate the bed/chair which will bring up the menu you want. Have a look at the source code for my field kits mod. https://github.com/Scrivener07/FO4_Wasteland/blob/f39f021e3785b35034f6ff397906936035f29a70/Data/Scripts/Source/FO4_FieldKits/Fallout/FieldKits/Equipment.psc https://youtu.be/_6YF03-4Cd8?list=PLdEgiq4kaju2LK40-csl89S91-Xb1lePp I created several furniture's with the correct keywords to display each of the workbench menus. You can replicate this method by doing the same with a bed or chair for the wait or sleep menu respectively. My take on it will spawn the furniture in front of the player and then tells the player to activate it through script. You can implement a chair or bed like this without the sitting animation or the furniture being visible depending on your preference.
  4. Oh yea, this project gets my blood pumping!
  5. Anything new with your project? Im very interested to see your take on card games.
  6. Like KingTobbe already said, TheWhiteCollarPlayers and myself are working on a gambling mod too. Our first game will feature Black jack. Since our projects are nearly the same we may be able to learn and contribute to each other if thats something your interested in. Im not saying to necessarily combine projects but I would be glad to have you within our circle for development discussions. The projects source is licensed under MIT and available online here https://github.com/Scrivener07/FO4_Games if you would like to study the direction we have taken so far. We started our project 3 weeks ago from today, this is our current progress. https://www.youtube.com/playlist?list=PLdEgiq4kaju0r1Zw4MTMmxLbc9ZQ1MOLJ Reach out and contact us on discord if you would like to talk development, kick around ideas, or get help if needed. I will be following this project regardless. Scrivener07#4154 TheWhiteCollarPlayers#7879
  7. Did it work? I dont even know if it compiles. I just pulled it out of my ass.
  8. Dont think, just do. The quest object is just used to create a long running instance of your script.
  9. Thats really cool stuff man. I really enjoyed seeing your progress.
  10. Just to get you started try attaching this to the slow time magic effect. ScriptName Derp extends ActiveMagicEffect ; http://www.creationkit.com/fallout4/index.php?title=Actor_Value float OriginalValue float EffectValue = 150.0 const ; Events ;--------------------------------------------- Event OnEffectStart(Actor akTarget, Actor akCaster) ; Gets the specified Actor Value from the Object Reference. OriginalValue = akTarget.GetValue(AnimationMult) ; Sets the base value specified Actor Value on the Object Reference to the passed-in value. Any modifiers are left intact. akTarget.SetValue(AnimationMult, EffectValue) Debug.MessageBox("Set the speed multi:"+EffectValue) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) ; restore the value to what it was before this effect started. akTarget.SetValue(AnimationMult, OriginalValue) Debug.MessageBox("Restored the original speed multi:"+OriginalValue) EndEvent ; Properties ;--------------------------------------------- Group Properties ActorValue Property AnimationMult Auto Const Mandatory EndGroup
  11. Papyrus has functions like these for people like you. http://www.creationkit.com/fallout4/index.php?title=GivePlayerCaps_-_Game http://www.creationkit.com/fallout4/index.php?title=RemovePlayerCaps_-_Game http://www.creationkit.com/fallout4/index.php?title=GetCaps_-_Game ; Give the player 100 caps for a job well done Game.GivePlayerCaps(100)
  12. The script extends QUEST and therefore must be attached to a quest.
  13. Scriptname aaadPlayerControls extends Quest int YourMenuItemIDThatIDontKnow = 0 const bool DoThing = false Event OnInit() RegisterForRemoteEvent(TheTerminal, "OnMenuItemRun") RegisterForMenuOpenCloseEvent("TerminalMenu") EndEvent ; this is exactly the same as the terminal fragment. Event Terminal.OnMenuItemRun(Terminal akSender, int auiMenuItemID, ObjectReference akTerminalRef) If (auiMenuItemID == YourMenuItemIDThatIDontKnow) ;............................................................................ DoThing = true Debug.MessageBox("Close this terminal to use the container.") ;............................................................................ EndIf EndEvent Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening) If (abOpening == false) If (DoThing) aaadAmmoContainer.Activate(Game.GetPlayer()) DoThing = false EndIf EndIf EndEvent Group Properties Terminal Property TheTerminal Auto Const Mandatory ObjectReference Property aaadAmmoContainer Auto Const Mandatory EndGroup
  14. Does your quest have the "Start Game Enabled" flag? Try adding Debug.MessageBox("FunctionName") to the first line of each event and function.
  15. The sites do have different mods. For example this one. https://bethesda.net/en/mods/fallout4/mod-detail/942407
  16. Theres so many things wrong with the script you posted above that I dont even know where to start. I dont think you can force close a terminal via script, this is done by pressing TAB on the terminals top level. Also "Force withdraw" is not a thing. In skyrim with SKSE you could fake the TAB key press but that IS NOT the case in Fallout 4. http://www.creationkit.com/index.php?title=TapKey_-_Input
  17. @Lisselli Thats an interesting while loop. So it counts down until the int "index" evaluates to a false bool. Ive never seen one setup like that, cool.
  18. Hmm I didnt mean to take so long but my CK is refusing to attach scripts to editor objects right now (any). Maybe something like this will work better? Scriptname MapWidget extends Quest HUDFramework HUD Actor Player ObjectReference[] Actors string WidgetID = "DivisionMap.swf" const string UserLog = " Iwantacookie2010" const string EmptyState = "" const string ScanningState = "Scanning" const int ScanTimer = 0 const float ScanInterval = 3.0 const float ScanRadius = 800.0 const ; Events ;--------------------------------------------- Event OnInit() Player = Game.GetPlayer() Debug.OpenUserLog(UserLog) EndEvent Event OnQuestInit() HUD = HUDFramework.GetInstance() if(HUD) StartScan() Else Log("HUDFramework is not installed!") StopScan() EndIf EndEvent Event OnQuestShutdown() StopScan() EndEvent Event OnTimer(int aiTimerID) {EMPTY} EndEvent ; Methods ;--------------------------------------------- State Scanning Event OnBeginState(string asOldState) StartTimer(ScanInterval, ScanTimer) EndEvent Event OnTimer(int aiTimerID) Actors = Player.FindAllReferencesWithKeyword(ActorTypeNPC, ScanRadius) If (Actors) Log("Scanning found '"+Actors.Length+"' actors.") Else Log("Scanning could not find any actors.") EndIf StartTimer(ScanInterval, ScanTimer) EndEvent Event OnEndState(string asNewState) CancelTimer(ScanTimer) Actors = none EndEvent EndState ; Functions ;--------------------------------------------- ; @HUDFramework Function HUD_WidgetLoaded(string myWidget) If (myWidget == WidgetID) Log("Map module updated survivor.") ;HUD.SendMessage(WidgetID, HUD_Initialize) EndIf EndFunction Function StartScan() If (GetState() != ScanningState) GotoState(ScanningState) EndIf EndFunction Function StopScan() If (GetState() != EmptyState) GotoState(EmptyState) EndIf EndFunction Function Log(string aText) Debug.TraceUser(UserLog, aText) EndFunction ; Properties ;--------------------------------------------- Group Properties Keyword Property ActorTypeNPC Auto Const Mandatory EndGroup
  19. Sorry, I dont think I can give useful advice without full source at this point.
  20. Opps I think I did forget to cast the Form into an Armor. Armor CurrentSuit Actor:WornItem worn = Game.GetPlayer().GetWornItem(3) If (worn.Item is Armor) CurrentSuit = worn.Item as Armor EndIf The item might be a weapon or an armor so you have to check its type. Armor MaybeArmor Weapon MaybeWeapon Actor:WornItem worn = Game.GetPlayer().GetWornItem(3) If (worn.Item is Armor) MaybeArmor = worn.Item as Armor ElseIf (worn.Item is Weapon) MaybeWeapon = worn.Item as Weapon Else Debug.Trace("unhandled type") EndIf
  21. The error is because `GetWornItem` returns a structure called `WornItem`. The `Item` property of WornItem is the weapon/armor form your looking for. http://www.creationkit.com/fallout4/index.php?title=WornItem_Struct_-_Actor Armor CurrentSuit Actor:WornItem worn = Game.GetPlayer().GetWornItem(3) If (worn.Item is Armor) CurrentSuit = worn.Item EndIf The Actor:WornItem structure is nested instead the Actor type.
  22. Try OnLoad instead of OnInit. http://www.creationkit.com/fallout4/index.php?title=OnLoad_-_ObjectReference
  23. Try this one as the above requires libraries you dont have. This one is attached to a Quest and then its properties should be filled. You need one potion for the inventory item, one message to tell the player to close the pipboy if needed, and then and invisible version of the bench furniture you want to open. The behavior of this one is simpler. When the potion item is consumed a workbench it created and activated immediately instead of a messagebox menu to choose the bench type. ScriptName Derp extends Quest Actor Player ObjectReference BenchReference Event OnInit() Player = Game.GetPlayer() EndEvent Event OnQuestInit() RegisterForRemoteEvent(Player, "OnItemEquipped") EndEvent Event OnQuestShutdown() DestroyBench() UnregisterForRemoteEvent(Player, "OnItemEquipped") EndEvent Event Actor.OnItemEquipped(Actor akSender, Form akBaseObject, ObjectReference akReference) If (akBaseObject == MyPotion) If (Utility.IsInMenuMode()) MyExitMessage.Show() EndIf Utility.Wait(0.1) Player.AddItem(MyPotion, 1, true) ; re-add for reusable items CreateBench(MyWorkBench) ; pass in the furniture to create/activate EndIf EndEvent Event Actor.OnGetUp(Actor akSender, ObjectReference akFurniture) DestroyBench() EndEvent Function CreateBench(Furniture aFurniture) DestroyBench() BenchReference = Player.PlaceAtMe(aFurniture) If (BenchReference) BenchReference.SetAngle(0.0, 0.0, BenchReference.GetAngleZ()) RegisterForRemoteEvent(Player, "OnGetUp") InputEnableLayer input = InputEnableLayer.Create() input.DisablePlayerControls() If (BenchReference.Activate(Player, true) == false) DestroyBench() EndIf input.EnablePlayerControls() Else DestroyBench() EndIf EndFunction Function DestroyBench() If (BenchReference) UnregisterForRemoteEvent(Player, "OnGetUp") BenchReference.Disable() BenchReference.Delete() BenchReference = none EndIf EndFunction Group Properties Potion Property MyPotion Auto Const Mandatory {The token activation item} Message Property MyExitMessage Auto Const Mandatory {Exit the menu to use the workbench} Furniture Property MyWorkBench Auto Const Mandatory {The workbench to activate} int Property Count Hidden int Function Get() return Player.GetItemCount(MyPotion) EndFunction EndProperty EndGroup Its untested as I just yanked it out of my larger project. Its up to you to tweak and make it work.
×
×
  • Create New...