Jump to content

Haravikk

Members
  • Posts

    82
  • Joined

  • Last visited

Everything posted by Haravikk

  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?
  15. Title mostly covers this one; is it possible to create a condition (or set of conditions) that can prevent actors from being matched if they were summoned (or reanimated)? I know there are some keywords used for the related spells such as MagicSummonFire, MagicSummonUndead etc., but is testing for the absence of these the only way to determine if an actor is permanent? Basically I'm trying to match actors that are unlikely to disappear 10 seconds later ;)
  16. I have a script which needs to distinguish actors based on a size rating. Currently I'm doing this with form lists and putting races such as trolls, werewolfs etc. into one (large) and giants, dragons etc. into another (giant) but this feels like a really clunky and inflexible way to do this as the actors I'm processing could potentially be anything at all, so could include new creatures added by mods that I would have to add support for in patches and such. What I'd rather do is have some threshold by which something is considered large, giant etc. based upon its actual physical size, even if it requires a bit of fudging. My first thought was to just compare against Actor.GetHeight(), but this only works when the actor is standing normally, since it's based on the bounding box size (which can change). Height alone also isn't super useful, as werewolves and trolls aren't actually that tall compared to regular humanoids, but they are bulky. My next idea was to instead multiply Actor.GetHeight(), Actor.GetWidth() and Actor.GetLength() into a volume and do it that way, which would better reflect the full size of an actor. This feels better, though I'm wary about it involving three function calls to another script, as any of these three values could change during the calculation; probably a negligible risk but feels risky all the same. I've noticed that races do have a size property, which could be used to identify giant (extra large) creatures, but as far as I can tell this isn't accessible anywhere via script? Has anyone used any other tricks to detect a rough "size" for creatures or is calculating volume probably my best bet?
  17. Thanks so much for such an extensive answer! Definitely going to read up on this more, though at first glance I think it sadly might not be suitable, as part of my calculation is based on a faction rank (sorry, should have specified that) which doesn't look like an option, and it's probably going to be easier to just pull a value out of a script. Yeah I was initially thinking I might do a combination of the two; since the effect is only ever applied to the player I should be able to get away with just using a Conditional variable in my script for use with the get vm quest variable condition in the spell's effect conditions. The downside is I'm probably going to need to have quite a lot of effect entries in the spell to do it this way to get a decent range of values (e.g- increments of 5 or whatever), which is why I was interested in dynamic options. The thing that put me off using force actor value is that you can't predict what else might affect the value; for example, if my Speech was 60, and I apply a bonus of ten (Speech 70) but while the effect is applied I pass a persuasion check (Speech 71) then my Speech would still go back down to 60. I think you'd need to track both the original value and the upgraded value so you can compare that against the current before shifting down, which feels like it's asking for mistakes. Also what puts me off mod value and force actor value is player's changing their load order, adding mods etc., this is I think what caused problems for me with Invested Magic as the scripts modding my Magicka (and returning it to me again) were probably being interrupted somehow, or firing in an odd order, so even if the values involved were correct they were only being partially applied. Might not be an issue for me as I'm only doing one spell, but it seems like it could be dicey. Actually I hadn't noticed the persistence issue for SetNthEffectMagnitude, thanks for pointing that out! I wonder though if persistence is actually a problem? If the magnitude only matters when the spell is cast (in determining the magnitude of effect to apply) then maybe persistence wouldn't be an issue? In my case I would always be setting a new magnitude before each time the spell is cast, and the bonus will only be applied to the player, replacing any existing bonus, so maybe there wouldn't be any conflict there? Not sure how to go about testing that… though actually maybe it wouldn't matter? I only really need to apply the bonus when the player enters dialogue, which you can't save during anyway. Could still be an option? Anyway, thanks again for such a detailed answer, given me a lot to think about on the various options!
  18. I'm looking to create a magic effect in a mod that will apply a dynamic bonus to Speech depending upon a bunch of factors (including who the player is talking to), and I'm trying to decide what the best way to do it would be. For example, the obvious way to do this would be to apply a spell with a scripted magic effect, with an OnEffectStart event calling PlayerRef.ModActorValue("Speechcraft", foo) to increase the player's Speech, an an OnEffectEnd event to reverse it. However I'm a bit wary of using this function as there's potential for it to leave the player's Speech skill permanently modified. I've seen this happen in other mods, for example the Invested Magic mod (which makes spells like Oakflesh and such toggleable effects that reduce max Magicka, rather than having to re-cast all the time), where I noticed over time that my magicka was being permanently increased. What I'm wondering is whether there is another way that I might do this that I haven't thought off that would be safer? What I would really like to be able to do is cast a spell using a scripted magnitude, so that the strength of the effect applied is fully managed by Skyrim rather than requiring any further script intervention. The only other alternative I can think of is to have variations of the spell and just apply the bonus in increments of 5 or 10 or whatever, which would work, but feels a bit unwieldy, as with the range of factors I'm accounting for I could need quite a lot of different spells in total. So yeah, does anyone have any ideas for how else I might do this? Would SKSE's SetNthEffectMagnitude() method be safe to use for this purpose?
  19. On the CreationKit.com wiki page for FormList.AddForm() there are conflicting notes about whether the ordering of items added to a form list is stable or not, i.e- if I iterate through the FormList, I should receive the items in the same order in which I added them (assuming the base list isn't changed). Put another way; if I create a FormList in CK and add items A and B to it, then in game I run a script that adds items C, D and E, when I iterate over the list (Calling GetAt for indices 0 to 4) I expect to get the items back in the order A, B, C, D, E. If I remove item D, I expect to get A, B, C, E and so-on. In my own testing this appears to be the case, but the conflicting notes on the CreationKit.com page has me concerned that this isn't behaviour that can be relied upon. I realise that the separate of base vs. added means there are some novel ordering issues (i.e- if I add an item in the CK, it seems to appear before all added forms, which is consistent with the theory that FormLists always iterate over base forms first), but assuming base and added forms are stored separate, they should have consistent ordering otherwise, right? So anyway, does anybody know conclusively whether FormLists actually have stable ordering or not? I'm hoping to avoid having to use too many arrays for things that lists should be suitable for, but the ordering is going to be very important for my script.
  20. So I just wanted to bump this to report that I found a better way. Something was annoying me so much about this as I could have sworn it was possible, and then I remembered the Revenge, Hired Thugs quest; it uses the HasFamilyRelationship condition to fill an alias, based upon any relation to another alias, if it fills then there is one, otherwise the quest can't trigger. I also found there is a HasAssociation(AssociationType akAssociation, Actor akActor = None) function (and condition) that can do this with any relationship type; good old bethesda calling it something completely different so I didn't notice the first time I looked :dry: Since I need to define quests for what I actually want to do anyway, this is definitely the best way to do what I need. I suppose in theory this could be exploited to get a spouse/sibling etc. via a script function, by creating a hidden quest that does this, and then having it provide a function that forces an Actor into the first alias, and then tries to fill the second, either returning a value, or failing and returning nothing. Bit of a labour intensive way to do it, but it's possible at least, in case anyone does need it! I have a feeling some of the kidnap and similar quests may use this condition as well, kicking myself for not thinking of them sooner.
  21. That's a shame, but thanks! I think the performance shouldn't be a big problem for me as most of the time what I'll actually be doing is taking a random index and grabbing the same entry from two parallels lists to get two siblings, or a parent and a child etc. If I've understood how FormLists are implemented correctly, which I believe is two arrays (original values and added values) then grabbing items by index should actually be very fast. I should only need to iterate if I have other conditions (e.g- only adult or child with sibling). I guess now I just have to decide if I want exhaustive lists (I'll share these if I make them), though I think it may be more likely I just do some curated ones for what I need to do. Will see.
  22. What I'm looking to do is determine via script who an NPC's spouse, children, parents and/or siblings are, is such a thing possible? I know that NPCs have relationship information stored by the game, and have found two very basic functions for testing this via HasFamilyRelationship(Actor) and HasParentRelationship(Actor) and related conditions, but these don't give nearly as much information as I would like, and aren't terribly flexible. Are there any other options that I might be missing? The only alternative I've been able to think of would be to build massive parallel FormLists, e.g- one listing children and a parallel list listing their parents, but aside from being a lot of time to build, I don't think this would work since most children have multiple parents, some parents have multiple children etc., and FormLists don't seem to allow duplicate values. So anyway, is there a way to get this information dynamically, or am I stuck with just building lists of those that I want to use?
  23. Thanks so much for the link! Didn't realise gibbed actually did get a release version out, I found some old reddit threads and such about the planned save editor but never any links. Sadly this doesn't seem to have any quest editing capabilities, so it doesn't enable me to sort this issue; I can give myself more remnant cores (the crafting items), but won't let me increment the remnant data core (quest item) counter, which must be part of the quest itself.
  24. So I'm playing Mass Effect: Andromeda and generally loving it, I really wish there was a confirmed second game coming out (seemed like it made more than enough money, so silly not to). Anyway, one thing that's bugging me is the Task: Remnant Data Cores, as the counter is definitely broken as when I realised there were a finite number of cores I checked the list, and while sadly I know I've missed one (Elaaden vault) I've definitely got all the others except for the one on Meridian, but according to the journal entry I'm two cores short (as if I had missed three out of the full eleven, which I definitely haven't). So I'm wondering, is there a mod I can use to adjust the requirement, give myself an extra core, or a tool I can use to force the counter up to eight so I can get the Meridian one and feel like I didn't completely waste my time trying to do this mission? :D
×
×
  • Create New...