Jump to content

NoCashNoExp

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by NoCashNoExp

  1. If this is about Travis Miles' quest Confidence Man, you have to go to the radio station and talk to Travis first. There won't be a conversation or anything. He will just stutter and say hi but after that go to Vadim and he should ask for help with Travis.
  2. According to this page from the creation kit wiki, an array is garbage collected, once it's no longer referenced. You can read about it in the "Assigning/Passing Arrays" section. The issue is that you're calling this function each second multiple times, I don't know if the garbage collector is fast enough to keep up. I have a bit of optimisation notes. TimerEventInterval and TimerEventID shouldn't be properties unless you intend to access them outside this script. If you're going to be accessing the player reference a lot, consider storing it as a script property instead.
  3. Thank you so much, I can finally clean up the messy workaround that I've wrote to get ammo count.
  4. Thank you so much, that helps quite a lot. I already resorted to using F4SE but if I ever decide to convert the mod to use papyrus only, this is definitely a step in the right direction.
  5. I also wanted to get the current amount of bullets in the player's magazine. I have done my research and flipped through the FO4 papyrus documentation multiple times. So, let me give you a summary and tell you what I've found. Problems (These are limitations of CK): 1 - There's no way to get the number of bullets in the player's magazine. 2 - There's no way to get the player's gun weapon ammo capacity (i.e the maximum number of bullets that the gun's chamber can hold). 3 - There's a way to get the type of ammo the weapon is using. The function is called GetAmmo() but it only returns the default ammo so if they player installed a mod that changes the ammo type, GetAmmo() will not work properly. Possible Workarounds: 1 - If we could somehow detect the player firing and update a virtual ammo counter in our script. When the player reloads their weapon, the ammo counter would be reset to the gun's max ammo capacity so it heavily relies on (2) to in order to work. We can successfully detect if the player reloaded by listening to the "reloadComplete" animation event. "weaponFire" animation event only works for semi automatic weapons, for automatic weapons the event is called multiple times for each shot. This means that for automatic weapons our ammo counter would be incorrect. Another solution, listen to player onItemRemoved event with the ammo type of the weapon as filter (again heavily relies on (3) in order to work). The premise is that if 1 bullet was removed from the player's inventory while their weapon is drawn then it MIGHT be a bullet that was shot. Huge emphasis on might because it also might be a single bullet that was sold, moved to a container, dropped from inventory or other edge cases that I am not aware of. 2,3 - You could maintain a list of weapons and their ammo capacity/type but there's mods that modify ammo count/ammo type. There's no way to get a list of mods attached to a weapon in CK Another solution (Requires F4SE), F4SE has a script called instance data which allows you to accurately get the weapon's ammo capacity and the ammo type even with mods attached that modify them. I could never get this working, if you manage to get it working kudos to you. TL;DR: There are even more edge cases that I am not going to discuss because this is already too much. Only test these things if you're invested in making this mod. But my personal advice is that it's not worth it in my opinion.
  6. Actually what you just said in theory just solved his problem. His rewards system constructs a message based on the reward formlist and it would look like this: Rewards: - 6 Stimpacks - 1 Military Grade Duct Tape His problem was that the last item got duplicated so it printed: Rewards: - 6 Stimpacks - 1 Military Grade Duct Tape - 1 Military Grade Duct Tape This is indeed because he was using while(iIndex < akChallenge.Reward.GetSize()) instead of while(iIndex < akChallenge.Reward.GetSize() - 1). What's confusing me is that he's accessing an element outside of the formlist index bounds yet it still somehow worked instead of returning an error or None.
  7. Not a mod solution but if you build the lower tier trader of the same type, they will have a different inventory. This is vanilla Fallout 4 I think.
  8. Could you send me the full script in private? This snippet looks fine honestly but I am not sure.
  9. Put it at Data/Scripts/Source/User/ This is where source code is stored.
  10. I am not sure from your question whether you don't know how to compile scripts or you have a syntax error in your modification. If your issue is compiling the script, open up CK, click on Gameplay menu -> Papyrus Script Manager then search for your script and right click compile.
  11. This is just my assumption but I think you don't quite understand how Fallout 4 does enemy randomisation. The question you're asking is too generic to be answered but I can give you a pointer in the right direction. Google "Fallout 4 Creation Kit levelled lists", watch a couple of videos and read the creation kit wiki entry about levelled lists. Edit: Apologies, the topics that you should read about are LeveledCharacter and Encounter Zones. Levelled lists are for items only.
  12. This really ties in what determines the current weather's temperature. Location, date or time of the day or maybe all of those combined? There's no way to do it without timers as your script has to be constantly checking for weather changes. You could get away with running your check code when the player enters a new cell but then the player might stay at the same cell for some time and invalidate those checks (ex: it's colder at night than at day time). You should probably take into account timescale. Each 20 minutes in FO4 = 1 minute in real life. The more your script waits between checks, the less computing it has to perform and this in turn should net better performance.
  13. Unfortunately, if that's the case then you're trying to edit the base carryweight when a different mod already edits the base carryweight because the intended usage for this ME in vanilla Fallout 4 is to reduce carry weight in survival mode.
  14. I am not an expert at this kind of thing because I don't even use VIS-G but I did some fiddling around and I think understand what they do. The fastest to go about this is to install FO4Edit, it will allow you to make a patch very easily. I have MO2 so I did some things differently but this is how you would go about it if you didn't have MO2: (Make sure to make a backup of your esp, just in case) - Copy ArmorKeywords.esm, VIS-G Item Sorting.esp, yourmod.esp to your fallout 4 data folder (Don't worry we'll remove them later) - Open FO4Edit, it should auto detect that FO4 is installed - Select fallout4.esm, all dlcs, awkcr, vis-g and your mod (Give it time to load, it's not hanging or anything) - The order of what's happening: VIS-G overrides vanilla FO4 obviously and your mod overrides VIS-G so you want to create a patch that overrides your mod or you could just save these changes in your mod. - Expand VIS-G esp and take a look at how they name misc items especially ones from your mod, I think you'll quickly start to understand how it works. The save changes into your mod route: - Expand your mod esp - Go over each item edit the record's FULL - Name row in the column that has your mod name, again look at how VIS-G does it and do the same. - In the top left there's a button the looks like 3 lines on top of each other (we call it a hamburger button) click on it and save The patch route: - Expand VIS-G esp - Ctrl + Click to select multiple items. Select all the items you want to patch and then right click -> copy as override into -> yes, I am sure - Select the first <newfile>.esp, it might tell you that your mod will depend on something, that's fine since it's a patch for it - Do the same steps at the save changes into your mod route - Take a copy of your new mod/patch from the data folder and enjoy - Remove all of the esps/esm that you copied to your data folder Edit: I found out that you've already done it. I'll leave it in case anyone is interested in patching their mod.
  15. I've actually dabbled in this matter because I wanted to create my own mod that increases carry weight as your character leveled up. Simply put, carry weight is a derived value that is calculated but there's a way to do it without scripting. The simplest way to do this without scripting, is to edit "fAVDCarryWeightBase" in the CK menus -> gameplay -> settings. This is a global setting but it will not work on survival because it adds a magic effect that reduces your carry weight by 125. If you'd like it to also work on survival, you will have to do it through scripting. Also, I'd like to note that player.SetValue() has never worked for me. Create a quest that runs on game startup and attach this script to it. Scriptname YourScript extends Quest ActorValue Property pCarryWeight Auto Const Mandatory Actor Property pPlayerRef Auto Const Mandatory Event OnInit() ; fAVD is a game global setting and some mods adjust this, so we read it to ensure compatability float baseCarryWeight = Game.GetGameSettingFloat("fAVDCarryWeightBase") If (Game.GetDifficulty() == 6) ; Take into account survival mode baseCarryWeight = baseCarryWeight - 125 EndIf ; Set it to 100, should also work for negative values float diffPoints = baseCarryWeight - 100 pPlayerRef.ModValue(pCarryWeight, -diffPoints) EndEvent You can change it, the setting is called "fAVDCarryWeightMult".
  16. Thank you so much, it worked perfectly. I'll make sure to credit you once I release it.
  17. Thank you so much dude that is actually 100% going to work, I am going to test it right now. F4SE already exports a registerforkey to papyrus so I don't have to write my own.
  18. Thank you, I actually did take a look at that mod, they have an article explaining how to use their system for external mods. They edit the animations files and add more events to the animations but my mod is honestly very simple, I would prefer to leave editing animations for other mods.
  19. Yeah, it works but it's also fired multiple times meaning I get refunded the ammo multiple times. I am starting to think listening to animation events was a bad idea.
  20. Just to give some context on what I am doing. I am trying to modify the scrounger perk so it works on reload instead of when firing the last bullet using scripting. Instead of refunding a full mag, it should refund maximum magazine capacity - current ammo left in magazine. There's no way to get the ammo count left in the player's magazine in papyrus so I tried to simulate the weapon magazine in my script. My first solution was listen to "weaponFire" animation but this quickly didn't work because the animation is fired multiple times for each shot from an automatic weapon. My second solution was to listen to "onItemAdded" and "onItemRemoved" events on the player with the premise that if one bullet was removed than it might be a bullet that was fired from their gun. There were so many edge cases and I had to listen to menus opening and closing to make sure whether the player dropped/sold/moved one bullet or actually fired it and in the end it didn't work quite well. Finally, I decided to take the value from the source literally. I made an F4SE plugin that reads the int value from the memory address where the actual magazine count is stored after quite an extensive research on reverse engineering completely forgetting that in my papyrus code I was listening to "reloadComplete" animation event and there's no reload start event. The problem with that is the value is updated before I can read the old value so it always refunds 0 ammo. I could just slap the update ammo count code on "weaponFire" event and call it a day but as I said it's fired multiple times so it's a bit inefficient but it should still be correct. I am not experienced enough with the game internals and F4SE to know if there's any performance penalties for continuously calling a function from a dll so I was honestly hoping for a better solution. Edit: Calling the update ammo code from "weaponFire" event works on semi auto weapons but not automatic ones (the return value from the C++ function is incorrect), I am assuming calling a function from F4SE multiple times within the span of milliseconds isn't a great of idea which is what I thought.
  21. Thank you both for your replies, I will test your code momentarily. I understand how to create quests and attach scripts but I didn't quite understand aliases. I will read aliases on the wiki again. This is the way I originally did it but for some reason it didn't work: Scriptname testScript extends Quest Actor Property pPlayerRef Auto Const Mandatory Event OnInit() Debug.Notification("Script Init") RegisterForRemoteEvent(pPlayerRef, "OnItemAdded") EndEvent Event ObjectReference.OnItemAdded(ObjectReference origin, Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) Debug.Notification("Item Added") EndEvent Edit: I managed to setup a player alias and tested your code and it works perfectly. Thanks again.
  22. I want to make a script that tracks the stack count of a specific item type in the player's inventory. Is there anyway to check if the player's inventory changed or even better if a specific item was added/removed?
  23. Oh my god, thank you so much. I was testing my script in survival difficulty and it seems that survival uses scripts to edit a lot of stuff including carry weight. The base carry weight in survival is 75 but the default base is 200 so that's why it was returning incorrect values.
  24. Unless I am missing something important here, I actually tried this function when I started and the compiler said that it doesn't exist so I assumed there are differences between Skyrim and Fallout 4 syntax.
×
×
  • Create New...