Jump to content

Haravikk

Members
  • Posts

    82
  • Joined

  • Last visited

Nexus Mods Profile

About Haravikk

Haravikk's Achievements

Collaborator

Collaborator (7/14)

  • First Post
  • Collaborator Rare
  • Conversation Starter
  • Week One Done
  • One Month Later

Recent Badges

0

Reputation

  1. So I was hoping to add the ability for the player to give an NPC any item they wish as a "gift" (they're actually trading for something, just not money), but Fallout 4 appears to lack the Actor.ShowGiftMenu() function from Skyrim, so I'm wondering what the alternatives are? Actor.OpenInventory(True) won't work on its own because this would allow the player to also take items which isn't what I want. The only alternative I've thought of so far is to use a hidden actor or container object and use OnItemAdded() to detect items and remove them (after calculating some score), would that be the best way to do this? A hidden actor would allow me to use .OpenInventory(True), but I'm assuming a container triggered using .Activate(Player) ought to work as well (and might be easier)? The downside is that this doesn't seem like it would allow me to do any filtering of what items can be given (unless I return "rejected" items)? Here's what I'm thinking of doing (probably contains typos, I write all my scripts outside of CK and haven't had a chance to test yet): ScriptName GenerositySimulator Extends Quest CustomEvent OnGiftsReceived {Event fired once gifts have been given with Var[] args of: [0]:Actor, [1]:Int=Total items, [2]:Int=Total value} ReferenceAlias Property GiftsContainer Auto Const Mandatory {Alias pointing at the container that the player will transfer gifts into for processing} Int Property TimerGifts = 1 AutoReadOnly Actor _GiftsActor = None Function ShowGiftMenu(Actor akActor) If akActor _GiftsActor = akActor StartTimer(0.5, TimerGifts) ; Inventory menu should pause game akGifts.Activate() EndIf EndFunction {Opens a menu to allow the player to give items that will be transferred to akActor} Event ObjectReference.OnItemAdded(ObjectReference akSender, Form akBaseItem, Int auiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If !_GiftsActor || (akSourceContainer != PlayerRef) ; No longer accepting gifts, return item(s) If akItemReference akSender.RemoveItem(akItemReference, 1, False, akSourceContainer) ElseIf akBaseItem && (auiItemCount > 0) akSender.RemoveItem(akBaseItem, auiItemCount, False, akSourceContainer) EndIf EndIf EndEvent Event OnQuestInit() RegisterRemoteEvent(GiftsContainer.GetReference(), "OnItemAdded") EndEvent Event OnTimerEvent(Int aiTimerID) ; If aiTimerID == TimerGifts ObjectReference akGiftsContainer = GiftsContainer.GetReference() If _GiftsActor Int auiCount = 0 Int auiValue = 0 ; Process the gift(s) given Int auiIndex = 0 Form[] akGifts = akGiftsContainer.GetInventoryItems() While auiIndex < akGifts.Length Form akGift = akGifts[auiIndex] Int auiItemValue = akGift.GetGoldValue() auiIndex += 1 ; If the item is a reference, use base object if needed for value ObjectReference akItemReference = akGift as ObjectReference If akItemReference && auiItemValue <= 0 auiItemValue = akItemReference.GetBaseObject().GetGoldValue() EndIf Int auiItemCount = akGiftsContainer.GetItemCount(akGift) If (auiItemCount > 0) && (auiItemValue > 0) akGiftsContainer.RemoveItem(akGift, auiItemCount, True, _GiftsActor) auiCount += auiItemCount auiValue += auiItemValue * auiItemCount EndIf EndWhile Var[] akArgs = new Var[3] akArgs[0] = akActor as Var akArgs[1] = auiCount as Var akArgs[2] = auiValue as Var SendCustomEvent("OnGiftsReceived", akArgs) EndIf ; Return anything left in the container akGiftsContainer.RemoveAllItems(PlayerRef, True) _GiftsActor = None ; EndIf EndEventBasically the idea is that ShowMenu() uses Activate() to bring up the container inventory (which should be empty), and starts a short timer (which should be frozen by the menu) and when the timer expires it uses the F4SE GetInventoryItems() function to process the entire contents, sending anything valuable to the target actor and returning everything else to the player and firing an event.
  2. Please see Assigning/Passing Arrays section at https://www.creationkit.com/fallout4/index.php?title=Arrays_(Papyrus) Must have missed that somehow! However it only specifically shows setting an existing index (Array1[0] = 10), does the same rule hold true when using Array1.Add(10)? My actual case is proving complex to debug, I really need to add some very basic scripts just to test what behaviours might be broken (or misunderstood in my case), been a busy week though, I'll see if I can find time over the weekend. If I understand your problem correctly then yes, elements added to akFound will be visible on the caller side. But in this particual case you could return newly created array instead of passing. I should have said but the example was very much simplified compared to what I'm actually doing (to try and give a clearer idea of my question); in my actual case I have multiple arrays that I need to add entries to, ideally without having to return them somehow, so arguments will be the best way if that does in fact work. You're right that that specific example could just return the array, though my intention was that filling the array at all in the example is optional (no array needs to be passed if all you need is the total), also the array being passed in might not be empty (it may be passed between functions, each adding their own entries), which is part of what I'm actually doing (multiple functions adding their data to a set of arrays), at least, what my scripts are supposed to be doing.
  3. Sorry to bump this, but I'm revisiting the mod where this became a sticking point, as I never figured out a way to detect if an NPC is "clean" or "dirty" as determined by this skin. I was trying to change the appearance and behaviour of something to reflect which skin the NPC has; the only hack I found was to just filter by known "clean" actors (i.e- anyone from the institute) but this won't work with mods that add actors that aren't covered by that hack. Are there any functions or conditions that I've missed (there's an awful lot of them, so seems likely) that I could use to tell apart actors with different specific skins? Or some other way I might do it?
  4. I just want to confirm, since it's not mentioned explicitly on any wiki that I've seen (or I've been looking in the wrong places or have gone crosseyed from looking) but are Arrays in Fallout 4's version of papyrus passed by value (copied) or by reference (any variable pointing at the same array can change it for all variables)? I'm used to scripting in Skyrim where you could never really do much with arrays without re-creating them (and usually with PapyrusUtils since vanilla Skyrim at least didn't support expressions for array length) so I never really had much need to manipulate arrays I was given, as I'd just be creating a new one and returning it. But in Fallout 4 we have dynamically sized arrays, along with methods like Array.Add(), Array.Insert() etc. So I just wanted to confirm to make sure I haven't made a mistake, but am I correct in thinking that Arrays are passed by reference, so if I receive an array as an argument in a function and then add to it (using Array.Add or Array.Insert), the calling script will be able to access it? As a silly example (forgive typos): Int Function CountEquipped(Actor akActor, Int[] aiIndices, Form[] akFound = None) Int aiCount = 0 Int aiIndex = 0 While aiIndex < aiIndices.Length WornItem akWorn = akActor.GetWornItem(aiIndices[aiIndex]) If akWorn && akWorn.Item aiCount += 1 If akFound akFound.Add(akWorn.Item) EndIf EndIf aiIndex += 1 EndWhile Return aiCount EndFunction {Counts the number of equipped items on akActor found in slots listed in aiIndices, optionally adding each found item to akFound} Basically I just want to confirm that a function such as the above (which puts found items into akFound) should work, or if I need to find a way to convert them to return multiple values as a Var[] array or similar?
  5. I've noticed that some workshop features and some mods in Fallout 4 are able to add a secondary prompt to interactive objects. For example, on a gamepad you would be able to interact normally with A, or trigger some other function using X when looking at the object. What I can't figure out is how this is achieved? Can it be done dynamically, and does it work with actors?
  6. As the title says, I'm curious whether it's possible to detect in a general way whether the player has failed a persuasion and/or intimidation check? In theory it seems like checking for success wouldn't be too hard as I could override the FavorDialogueScript to add behaviour to Persuade() and Intimidate() functions; not pretty, but it would work, I think. But as far as I can tell the only part in common for failure would be the GetActorValue [Persuasion] and GetIntimidateSuccess conditions that are used to determine success/failure; is it possible for me to hook into these somehow in order to detect failures? Is there some other way to detect possible persuasion failure? What I'm looking for doesn't need to be 100% accurate and reliable in the sense that it doesn't matter if it catches some checks that aren't actually "proper" persuasion/intimidation, however it does ideally need to work with generic persuasion/intimidation, as otherwise I'd have to go through all dialogue for every NPC modifying dialogue topics to make it work, which is not really an option (wouldn't work for NPCs added via mods etc.). So yeah, is there any way to detect it even just some of the time?
  7. Ack, I think I was thinking of Sibylla Draconis from Oblivion, so not Skyrim at all, sorry for the confusion, that's my bad! On a related theme then, does anyone know of any good, out of the way small caves in vanilla Skyrim that are either uninhabited or only inhabited by beasts?
  8. This has been bugging me for a little while, but I could have sworn there was an NPC living in a cave somewhere in Skyrim, most likely involved in a quest, but I can't for the life of me remember who, where or which quest. I've already trawled UESP's list of caves without any luck, but I could have missed it or it may not be listed as a cave on the Skyrim map. I believe but am not certain that the character was basically a female bandit, possibly hostile, and possibly had some animal allies, living in a small cave somewhere. I also could have sworn that they are involved in a quest (maybe has some quest item that needs to be obtained)? I had thought it was the Mehrunes' Razor quest (Pieces of the Past) but that's not it, maybe something similar? There are a couple of loners I'm aware that aren't the ones I'm thinking of; these include Hamelyn (the pied piper spoof living under the Honningbrew Meadery), Drelas (who lives alone in a cottage northwest of Whiterun) and Anise (who also lives alone in a cabin), however it's not one of these. I'm fairly confident the NPC is part of the base game (or one of the DLCs that add to the main Skyrim area) rather than being part of a mod, but I play with so many mods installed I can't be absolutely certain. Sorry for the weird request, but it's been bugging me like when I recognise an actor in a movie and can't figure out where from (or find them on IMDB etc.). I'm hoping some of these details sound familiar enough to someone and they might be able to think of some possible NPCs that might be the one I'm looking for!
  9. I'm trying to check a condition whenever the player consumes anything such as using a stimpack, food, water, alcohol etc. I know that it's possible to create individual items that can detect when they're consumed, but what I really need is to be able to detect any item being consumed, not specific items. I don't see any obvious event to listen for; only OnItemRemoved seems close, though I'm unclear whether it applies to consumed items, and it gives me no way to distinguish between items consumed versus dropped if even if does. Is there an event I can listen to in order to detect item consumption? If it isn't, a possible alternative would be for me to render the player unable to use consumable items somehow, is that possible instead?
  10. Yes to both. Neither worked at the time. But after posting I went away and had a coffee and… the problem seems to have resolved itself; I've no idea what (if anything) I might have done to fix it, or what caused it in the first place. I don't suppose anyone has any ideas? In case it happens again, or anyone else encounters the same issue?
  11. So this is a new one for me; I was happily modding away and suddenly when loading up a mod that was working fine only moments ago, Creation Kit gets past all the usual loading steps to where the warning window pops open (listing all the unresolved warnings from the base game/DLCs) but instead of showing anything it gives me an infinite number of popups saying "file contains truncated or invalid data" (no indication which file) before crashing. I've cleared out all temporary files I can think of for the Creation Kit, and tried opening various mods (or even just the base Fallout4.esm) and everything is afflicted by the same issue. There's clearly a file somewhere that is damaged, but Creation Kit won't tell me what it is, and uninstalling and reinstalling it hasn't fixed it. Fallout 4 itself runs just fine. Does anyone have any ideas what file might be the problem here? If I can't fix this then I basically cannot use the Creation Kit ever again, which is a pretty major problem. I'm running with Mod Organizer 2, but this has never been an issue in the past; I've been working on stuff for the past couple of weeks without any problems, and nothing else affected (game is fine, FO4Edit works etc.).
  12. So I'm trying to build an MCM menu for a mod, but I'm starting to wonder if there are some undocumented options. I'm trying to follow what's described on the mod's Github wiki but it only mentions the getting and setting of bool, float and int values. However, I've definitely seen mods that can fill text values for controls somehow, as they contain things like NPC or item names, so it must be possible to get these values somehow? Can anyone point me to a more up-to-date guide on creating an MCM menu that documents all of the available options, including text values?
  13. Is it possible to detect when an NPC is of the "dirty" variety rather than "clean", i.e- the actor has Skin set to "SkinNakedDirty" rather than the regular "SkinNaked"? I'm trying to apply an effect to arbitrary NPCs and would like to have it function differently based upon this difference. Ideally I'd do this with a condition if at all possible (i.e- two different effects under a single spell) but if a script is required that's fine as well. Neither of these skins have keywords associated with them, but I'm a bit unclear about whether skins count as worn for the purposes of WornHasKeyword and similar, or if the actor would need to be naked for it to count as worn? I really need to be able to do this regardless of how much armour an actor is wearing.
  14. I'm not sure I can use those unless I've missed a trick to handling the values they return? Scale seems to just be a percentage of the size of the model or some value set by the skeleton (a giant's scale for example is 1.0, same as an average sized humanoid), and mass appears to be arbitrary or also scaled to model size?
×
×
  • Create New...