Guest Posted April 10, 2014 Posted April 10, 2014 ^ That. If it's a scene that you built properly it could work good, so for example after the hit you can script something else etc. When you start doing things like these, you can't trust the engine anymore and you should script the whole scene as you wish
ArgusSCCT Posted April 11, 2014 Posted April 11, 2014 I didn't understand the issue, but I found this just a couple of days ago about clothing re-evaluation, could help you? --- Force Actor Clothing Reevaluation This script causes actors to re-evaluate what items they should equip based on what is left in their inventory. Use this after adding armor to an actor from a leveled list to make the actor equip it. actor.AddItem ArmorLeather 1 ;Add a known armor to the actor actor.EquipItem ArmorLeather ;Equip the armor we added actor.RemoveItem ArmorLeather 1 ;Remove the armor we added I tried it, nothing. Tried all the other workarounds other people have mentioned and still nothing. This can't be impossible, I'm sure someone has done it and made it work before. Otherwise how would anyone go about adding things to NPCs through script without resorting to AddItemToLeveledList. Anyway, I don't know if anyone knows how to work around that AddItem bug, but what I could use is a reference, a script or someone else's mod that uses AddItem to add things to NPCs, I'd be able to figure out the rest on my own. I've tried everything, and it really pisses me off that this doesn't work because someone forgot to fix that bug in GECK, I don't believe adding items to NPCs should really be all this complex or require some huge work around to get it to work.
t3589 Posted April 11, 2014 Posted April 11, 2014 @Argus Where did you run those from? Did you try it in an OnEquip/OnUnEquip block? Just curious.
Guest Posted April 11, 2014 Posted April 11, 2014 Sorry I'm slow understanding. I mean I've read your previouses posts more and more but I still don't understand what's the real issue. I don't understand if they don't evaluate to put on them the new armor, or if they stop fighting with their gun. That script should really make them re-evaluate the armor. But if the problem is the weapon, there's a way to force them too. you can equipitem weapon 1, that 1 should stick the weapon to their hand and they must use them. ... ... ... I hope I understood something this time...
ArgusSCCT Posted April 11, 2014 Posted April 11, 2014 Ok I'm going to post my script again, I'll explain thoroughly what it is doing. I'm working on Powered Power Armor, if you're not familiar with it, it sort of does what the name says it does, it makes power armor actually require power sources, it adds armor mods to power armor that do a wide variety of things, EMPs, faster speeds, falling and not taking damage etc. The original mod, is buggy, no one's updating. So my partner got permission and I decided to fix its scripting issues, one of which was how it added items to NPCs and while it did a great job at that, it was very strange on how it did it. Here comes my part, I'm doing a script that adds the power armor mods to NPCs, I don't use AddItemToLeveledList because of how it does things and because it won't work anyway, these are misc items intended to be added to people with power armor if I added that there, it would be pointless as it would remove the armor. So what did I resort to using? A scanner that detects power armor and adds those armor mods to the NPCs, nonetheless while everything works, the AddItem bug is screwing everything up, because anyone who gets a mod ends up acting stupid. It's that issue that NPCs have when you use AddItem on them. Their weapons get glitched and become invisible and non playable which makes them act all stupid in combat. I'm not using OnAdd or OnEquip or OnUnEquip, its a quest script, not an object or an effect script. It uses GameMode instead, this is about the only thing that I need to finish it up, I've spent way too much time on it. Oh, yeah, and I'm not adding Armor Items, they're misc items, the mods mainly some of them are armor items, but they work differently and I'm not trying to make the NPCs wear those anyway. If the indentation looks weird its because I copied it from Notepad++, I don't edit things in GECK because they look too messy and I don't want to end up messing something up. Here's what I got, its even smaller than the last one: scn PPAModDistributionQuestScript ref rNPC ref rContainer ref rCurrentCell ref rArmor int iDoOnce array_var entry array_var NPCList Begin GameMode ;The script below scans for NPC references, if it finds any, it adds them to the array called NPCList IF (iDoOnce == 0) LET NPCList := ar_Construct Array LET rNPC := GetFirstRef 42 LET rCurrentCell := player.GetParentCell MessageEx "Quest Started" WHILE(IsFormValid rNPC) ;Loop that adds NPCs to the array when it detects a valid NPC reference LET rNPC := GetNextRef IF(IsFormValid rNPC) ar_Append NPCList rNPC ENDIF MessageEx "Added %n" rNPC LOOP ;---------------------------------------------------------------------------------- ;The following part checks every NPC in the array mentioned earlier, the first IF checks if the reference is valid, ;and if the NPC has any Power Armor, if he/she does it continues onto the next IF which checks if the NPC has an armor mods ;finally, if that check passes, then the next group of IFs check for a faction and add a specific leveled item depending on the faction FOREACH entry <- NPCList LET rContainer := entry["Value"] LET rArmor := rContainer.GetEquippedObject 2 MessageEx "Checking %n" rContainer MessageEx "Person is wearing %n" rArmor IF(IsPowerArmor rArmor && IsFormValid rArmor) rContainer.AddItem PPAModList 1 rContainer.RemoveItem PPAModList 1 MessageEx "It is Power Armor" ENDIF LOOP LET iDoOnce := 1 ENDIF ;--------------------------------------------------------------------------------------------------------------------------------------- ;The part below, reinitializes the script if it detects that the player has moved to another cell IF(player.GetParentCell != rCurrentCell) LET iDoOnce := 0 ENDIF END
Guest Posted April 11, 2014 Posted April 11, 2014 and what happens if you manually add that by console in game? if there's something with additem you should see that behaviour in game too EDIT: you know what, I really find strange that AddItem behaviour. If you want to make a try, just doing a fast single execution script, a gamemode under a doonce condition that adds that specific PA to a specific reference when you get close to him. I feel it would deserve a try.
ArgusSCCT Posted April 11, 2014 Posted April 11, 2014 and what happens if you manually add that by console in game? if there's something with additem you should see that behaviour in game too EDIT: you know what, I really find strange that AddItem behaviour. If you want to make a try, just doing a fast single execution script, a gamemode under a doonce condition that adds that specific PA to a specific reference when you get close to him. I feel it would deserve a try. It does work properly. I already checked that though. I removed the additem line in my script and everything was working ok, no one's weapons were disappearing. Even added Power Armor to some NPCs to check if the armor mods were the cause of it but it turns out they're not.
Guest Posted April 11, 2014 Posted April 11, 2014 I know this doesn't say a lot. But if on a doonce script in gamemode you can add it properly to a npc and not having the same behaviour, at least you know there's something else. By the way, what's this? rContainer.AddItem PPAModList 1 rContainer.RemoveItem PPAModList 1 and what is IsFormValid?
ArgusSCCT Posted April 11, 2014 Posted April 11, 2014 I know this doesn't say a lot. But if on a doonce script in gamemode you can add it properly to a npc and not having the same behaviour, at least you know there's something else. By the way, what's this? rContainer.AddItem PPAModList 1 rContainer.RemoveItem PPAModList 1 and what is IsFormValid? Precisely the part that needs to work. rContainer is an NPC since they're containers and all, maybe I should rename that variable though, the last guy used it too and it was not all that simple to understand. PPAModList is a leveled item. I was attempting to use the work around, hence the RemoveItem. IsFormValid makes sure that no invalid references are used, in the case that the player moves from a cell to another, but mainly because the scanner keeps detecting invalid references and references that have an invalid armor as well. Its to keep it from throwing null pointers and from making the script crash in the case it does detect something like that.
Guest Posted April 11, 2014 Posted April 11, 2014 yes I assumed it was the npc, I was trying to understand why removing the armor, didn't think about the workaround what I "feel", which doesn't mean it's true of course, it could be a big blasphemy, is if that reference goes inside the scanner more times, because the npc would require time to equip the armor, and I assume the scanner would evaluate it as "npc to add an armor" even if he has it but he still didn't equip it. I know you set the cell value and it should run only if you change cell, I'm just... trying to see where the problem. I really don't feel additem on a gamemode block gives issues if it really does it once, like inside a doonce block. on a side note, I tend to specify the depth. not specifying it means a depth of 0 by default? the documentation doesn't describe that and that confuses me
ArgusSCCT Posted April 11, 2014 Posted April 11, 2014 yes I assumed it was the npc, I was trying to understand why removing the armor, didn't think about the workaround what I "feel", which doesn't mean it's true of course, it could be a big blasphemy, is if that reference goes inside the scanner more times, because the npc would require time to equip the armor, and I assume the scanner would evaluate it as "npc to add an armor" even if he has it but he still didn't equip it. I know you set the cell value and it should run only if you change cell, I'm just... trying to see where the problem. I really don't feel additem on a gamemode block gives issues if it really does it once, like inside a doonce block. on a side note, I tend to specify the depth. not specifying it means a depth of 0 by default? the documentation doesn't describe that and that confuses me It shouldn't cause problems if it only happens once, I remember having that issue before when the script was a bigger mess, without the DoOnce and the bunch of ifs and elseifs lying around. It added the item multiple times, NPCs did strange stuff and it eventually crashed because of it being an infinite loop and likely causing an overflow. I didn't use anything on cell depth because there was really no reason to, by default it is zero, thought that was a given so I didn't add anything in the comments. Also I'm not adding armor, these are misc items that are armor mods. If it were armor, everything would be simpler, I wouldn't need a script to do it.
Guest Posted April 11, 2014 Posted April 11, 2014 oh god, yes it doesn't make any sense then! shame on me, I misunderstood from start... but... if PPAModList is a misc item, I assume there's some script piloting it, something like another gamemode block checking the getitemcount or an onadd blocktype. did you try to actually add another item instead that your custom misc item? just to see if the mess is caused by that
Guest tomm434 Posted April 11, 2014 Posted April 11, 2014 I'm having this bug again - sometimes quest script stops working. I don't know the reason it happens. 1.I have running quest(because quest dialogues appear) 2. I have quest script attached to quest 3.I have variable "playercheck" 4.After dialogue I type player.imod BlackSexISFX set aaquest.playercheck to 1 Then in quest I have begin gamemode if playercheck ==1 player.kill endif end So after a dialogue "player.imod BlackSexISFX" works but nothing happens I simplified everything but that's how things are. I have 668 script line in this quest. And everything worked. THis issue happened before but I just restarted my PC and script started working again. But now it doesn't solve the problem. I still use the old savegame just before dialogue (before this issue I loaded it and script ran as it should) I tried recompiling all scripts, copying existing scrips and making new one with the same lines, then adding it to quest - doesn't work either. Has anyone encountered that problem? I can't find any information on internet.
ArgusSCCT Posted April 11, 2014 Posted April 11, 2014 oh god, yes it doesn't make any sense then! shame on me, I misunderstood from start... but... if PPAModList is a misc item, I assume there's some script piloting it, something like another gamemode block checking the getitemcount or an onadd blocktype. did you try to actually add another item instead that your custom misc item? just to see if the mess is caused by that Don't worry, I get confused with it sometimes too. Too much scripting and I don't even know what the hell I thought was doing, and to add to the confusion, PPAModList is a leveled item which contains a bunch of misc items and some armor items(one of which is non playable), regardless those armor items should not cause any trouble, they have their own scripts that make them work as intended. They have their own scripts and they work fine, although I'd say just barely, the previous author was sort of messy and the mod doesn't exactly work well either, no disrespect intended though. I haven't tried another item, no, but that was my next move. Either way, I already added it to them through console and nothing happened, meaning that its likely that it isn't the items. Quite sure its that stupid bug, which has been around since Fallout 3, no less.
nyaalich Posted April 11, 2014 Posted April 11, 2014 MCM Issue: I moved my ludicrous amount of MCM variables to a submenu. I can select (i.e., switch to/display) that submenu, but when I click on the settings, nothing changes. Any idea what part of the script I should look at to figure out WTF is going on?
Guest Posted April 11, 2014 Posted April 11, 2014 oh god, yes it doesn't make any sense then! shame on me, I misunderstood from start... but... if PPAModList is a misc item, I assume there's some script piloting it, something like another gamemode block checking the getitemcount or an onadd blocktype. did you try to actually add another item instead that your custom misc item? just to see if the mess is caused by that Don't worry, I get confused with it sometimes too. Too much scripting and I don't even know what the hell I thought was doing, and to add to the confusion, PPAModList is a leveled item which contains a bunch of misc items and some armor items(one of which is non playable), regardless those armor items should not cause any trouble, they have their own scripts that make them work as intended. They have their own scripts and they work fine, although I'd say just barely, the previous author was sort of messy and the mod doesn't exactly work well either, no disrespect intended though. I haven't tried another item, no, but that was my next move. Either way, I already added it to them through console and nothing happened, meaning that its likely that it isn't the items. Quite sure its that stupid bug, which has been around since Fallout 3, no less. this leads to more infos: Executing AddItem function on NPCs will cause them to review their inventory and equip the best armor and weapon they have. If NPC already has an armor with Object Effects equipped adding an item will make them reequip it, not really unequipping it first. As a result Object Effects of the armor will stack after each use of the AddItem function. Unequipping the armor will revert everything back to normal removing all stacked Object Effects. PA has actually object effect. Could this leads to this? And also: You can use a FormList as the item parameter - in this case, the function adds the count for each item in the list. Depending on how you did the list, maybe this could create troubles.
Guest Posted April 11, 2014 Posted April 11, 2014 I'm having this bug again - sometimes quest script stops working. I don't know the reason it happens. Has anyone encountered that problem? I can't find any information on internet. Everytime I had that issue, it was because there was a mistake and the compiler wasn't seeing that (and me too) There are many examples of that. Like: if (some function) || (some function) || this breaks the script but compiles Only once it happened that I had a very long script that was breaking and it was correct. I solved creating a brand new script, but copy pasting everything was carrying this (not) mistake, so I had to copy paste single small blocks, every time saving it, and removing many comments to short it a little. At the end it worked as intended (it was correct, damn! )
Guest tomm434 Posted April 11, 2014 Posted April 11, 2014 I'm having this bug again - sometimes quest script stops working. I don't know the reason it happens. Has anyone encountered that problem? I can't find any information on internet. Everytime I had that issue, it was because there was a mistake and the compiler wasn't seeing that (and me too) There are many examples of that. Like: if (some function) || (some function) || this breaks the script but compiles Only once it happened that I had a very long script that was breaking and it was correct. I solved creating a brand new script, but copy pasting everything was carrying this (not) mistake, so I had to copy paste single small blocks, every time saving it, and removing many comments to short it a little. At the end it worked as intended (it was correct, damn! ) I tried copy-paste it. Maybe I should look for mistakes, try to delete some part of the code. thanks!
ArgusSCCT Posted April 11, 2014 Posted April 11, 2014 this leads to more infos: Executing AddItem function on NPCs will cause them to review their inventory and equip the best armor and weapon they have. If NPC already has an armor with Object Effects equipped adding an item will make them reequip it, not really unequipping it first. As a result Object Effects of the armor will stack after each use of the AddItem function. Unequipping the armor will revert everything back to normal removing all stacked Object Effects. PA has actually object effect. Could this leads to this? And also: You can use a FormList as the item parameter - in this case, the function adds the count for each item in the list. Depending on how you did the list, maybe this could create troubles. To be frank I'm not sure which of the two bugs is happening, I was thinking that it was this one: Calling AddItem in an Effect Script or in an OnEquip block in an Object Script will cause the target actor's weapon to toggle between being visible and usable and being invisible and unusable. The cause of this bug is unknown, but as a workaround, use something like this in the script of the item that is being added: Then again, that's only supposed to happen with OnAdd and Effect Scripts or something. There's that work around there, but I used it and nothing happened. Also I'm not sure about the formlist, each NPC can only have one item, the way that sounds it would mean that it would add everything to an NPC. I don't want to have to make a formlist for every item, that would be sort of counterproductive. Maybe I'm missing on how to use a formlist that way I don't know.
nyaalich Posted April 11, 2014 Posted April 11, 2014 If you can't change options in an MCM submenu, check for a misplaced endif. : P
Guest Posted April 11, 2014 Posted April 11, 2014 Me too I understood that from the formlist thing. Considering that a levelitem is used mainly dragging it inside the npc inventory inside the geck, I think this refers if you do it by script ingame as you are actually doing. replacing with a common item should give you the answer
Guest luthienanarion Posted April 11, 2014 Posted April 11, 2014 MCM Issue: I moved my ludicrous amount of MCM variables to a submenu. I can select (i.e., switch to/display) that submenu, but when I click on the settings, nothing changes. Any idea what part of the script I should look at to figure out WTF is going on? Don't forget to add a condtion check in the "new value" section for the right submenu as well as the option. ... elseif(getuifloat "startmenu/mcm/_newvalue") setuifloat "startmenu/mcm/_newvalue" 0 setuifloat "startmenu/mcm/_reset" 1 if(submenu == 1) if(option == 1) ; do stuff relating to option 1 of submenu 1 elseif(option == 2) ; do stuff relating to option 2 of submenu 1 endif elseif(submenu == 2) if(option == 1) ; do stuff relating to option 1 of submenu 2 elseif(option == 2) ; do stuff relating to option 2 of submenu 2 endif endif elseif(...) ... MCM is extremely frustrating to script for, as a single forgotten line or a typo in a UI function call can break the entire script without throwing compiler errors.
ArgusSCCT Posted April 11, 2014 Posted April 11, 2014 Me too I understood that from the formlist thing. Considering that a levelitem is used mainly dragging it inside the npc inventory inside the geck, I think this refers if you do it by script ingame as you are actually doing. replacing with a common item should give you the answer If that works, then there's only one other way I can think of doing this, which is by adding all those PA mods into an array, and then taking one randomly to add to an NPC. Hopefully, there's an easy way to do that, otherwise I'll have to do it myself to get it to pick randomly.
Guest luthienanarion Posted April 12, 2014 Posted April 12, 2014 Me too I understood that from the formlist thing. Considering that a levelitem is used mainly dragging it inside the npc inventory inside the geck, I think this refers if you do it by script ingame as you are actually doing. replacing with a common item should give you the answer If that works, then there's only one other way I can think of doing this, which is by adding all those PA mods into an array, and then taking one randomly to add to an NPC. Hopefully, there's an easy way to do that, otherwise I'll have to do it myself to get it to pick randomly. Okay, I'm tired of being confused here. What exactly are you trying to do, and how exactly is it not working?
ArgusSCCT Posted April 12, 2014 Posted April 12, 2014 Okay, I'm tired of being confused here. What exactly are you trying to do, and how exactly is it not working? Been explaining it forever. Regardless, I'm trying to use AddItem to add items to NPCs, however since there's a bug with that function has a bug it keeps making NPCs act like morons whenever it adds an item to them. I just tested it now with an item that isn't a leveled item like mine is, same thing happened, also tested AJ's other suggestion to do it with one NPC and it still did the same thing. Basically, I just have a script that adds NPCs into an array, any NPC doesn't matter how or why, it just adds them into that array, I run a ForEach loop on that array, check if they're using power armor, if they are an item gets added to them, if not then nothing happens. Every time the player switches cells this script is reinitialized. All that stuff works, this is not working: NPC.AddItem ItemX 1 It is not an effect script, nor does it use an OnAdd block which is where this problem manifests itself. It shouldn't happen but it does and it is pissing me off, if it weren't for that error this script would have been finished long ago. Worse part is that this isn't something I did, it's something Bethesda didn't care to fix. EDIT: As a matter of fact it doesn't matter what I add, whether its a misc item, a weapon or an armor it seems it always ends up making NPCs act stupid.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now