Guest Posted April 12, 2014 Posted April 12, 2014 waffles if you dig few posts ago you can see the whole explanation and script I'm really curious now, tomorrow I'll do some tries to check if it makes the same issue to me and in which blocktypes
Guest luthienanarion Posted April 12, 2014 Posted April 12, 2014 I'm well aware of the AI bug triggered by adding items to an actor's inventory, and I'm thankfully also aware of its workarounds. One method involves adding and then removing an item from the actor's inventory after adding your item(s). The other involves unequipping and re-equipping the actor's weapon. In my experience it's best to do both. When you add your leveled item to an NPC, try also adding a "token" item with the following object script on it: scn AIFixTokenOS ref container ref weapon float timer begin onadd set container to getcontainer if container ; I've seen this fail if a sanity check isn't made. Not sure why. container.additem Pencil01 1 1 container.removeitem Pencil01 1 1 ; Removing an item usually fixes the bug caused by adding something. set weapon to container.geteqobj 5 container.unequipitem weapon 0 1 ; Re-equipping their weapon fixes it otherwise. endif end ; onadd begin gamemode if doOnce else if timer < 10 ; This counts 10 frames before re-equipping. set timer to timer + 1 ; You can substitute GetSecondsPassed for the increment here for a timed delay. return ; I've used a one-second delay in the past, but it can probably be shortened for a smoother effect. else container.equipitem weapon 0 1 removeme set doOnce to 1 ; A doOnce is used to prevent RemoveMe from being called twice and crashing the game. endif endif end ; gamemode That should fix the actor's AI and then remove the token. I wrote that from memory, so let me know if it needs refining.
ArgusSCCT Posted April 12, 2014 Posted April 12, 2014 Will do, and thanks. Some bug, that is requiring a whole other script to function. I guess I could add this in the same script but its getting a bit crowded. The one workaround no one talked about was equipping and unequipping weapons. Regardless, thanks. Hope this means I can go on with the rest of the mods, I've been stuck on this particular script far too long.
astymma Posted April 12, 2014 Posted April 12, 2014 Equipping/Unequipping is what I do in SmallerTalk. Since it does AddItem to add its conversation token I ran into the weapon bug too. So I have: scn SmallerTalkScript ref refTarget int intChecked ref refWeapon short doTimer float fTimer Begin GameMode if ((IsControlPressed 5) && (0 == doTimer)) set intChecked to 0 set refTarget to GetCrosshairRef if 1 == SmallerTalkVars.iVariable4 && 1 == Player.IsSneaking return endif if 0 == SmallerTalkVars.iVariable3 && 1 == refTarget.GetIsCreature return endif if 0 == reftarget.IsActor return endif if 0 == refTarget return endif if 1 == refTarget.GetDead || 1 == refTarget.IsInCombat return endif if refTarget.GetSleeping > 0 return endif if ListGetFormIndex SmallerTalkIgnoreList refTarget >= 0 return endif if refTarget.GetInFaction SmallerTalkIgnoreFaction == 1 return endif set intChecked to 1 set refWeapon to refTarget.GetEquippedObject 5 if refWeapon refTarget.UnequipItem refWeapon 0 1 set doTimer to 1 set fTimer to .2 endif refTarget.AddItem SmallerTalkResetAIToken 1 1 refTarget.AddItem SmallerTalkDialogueToken 1 1 if 1 == SmallerTalkVars.iVariable2 printtoconsole "SmallerTalk: Target under crosshair: %n", refTarget printtoconsole "SmallerTalk: FormID of Target: %i", refTarget printtoconsole "SmallerTalk: Value of intChecked: %.0f", intChecked endif if 0 == intChecked set refTarget to 0 endif endif if 1 == doTimer if fTimer > 0 set fTimer to fTimer - GetSecondsPassed else set doTimer to 0 set fTimer to 0 refTarget.EquipItem refWeapon 0 1 endif endif End ; GameMode Begin MenuMode 1075 if 1 == intChecked if 0 == SmallerTalkVars.iVariable6 set intChecked to 0 refTarget.RemoveItem SmallerTalkResetAIToken 1 1 refTarget.RemoveItem SmallerTalkDialogueToken 1 1 endif endif End ; MenuMode Checks if they have a weapon... unequips it, does the additems for the tokens, runs a .2sec timer, re-equips it...
ArgusSCCT Posted April 12, 2014 Posted April 12, 2014 Thanks, more examples are always useful. One thing I do have a question about this is about using it within a loop. I'm using a ForEach on an array, I don't suppose sticking that code in there will do anything out of place?
astymma Posted April 12, 2014 Posted April 12, 2014 Equipping and Unequipping take more than 1 frame to execute afaik. They update the 3d scene graph. You can do a bunch of equips in a row or unequips in a row, but anything else should probably be in a new frame after a short timer.
prideslayer Posted April 13, 2014 Posted April 13, 2014 Just a note, MCM is *extremely* sensitive to missing endif's and things like that. One screwed up bit of nesting in your MCM script(s) will break every other MCM using mod in your load order. If you don't ismodloaded + getmodindex + buildref your MCM reference in a game loaded/started block (if you use a generic init/stage block or quest stage instead), a change to the MCM position in your load order will blow up in your face as well. - Always make sure you get the proper buildrefs for MCM in ALL your MCM scripts before doing anything else. - Quadruple-check that you don't have any code nesting errors with if/elseif/else/end statements or other blocks and conditionals. FORMAT YOUR CODE.
ArgusSCCT Posted April 13, 2014 Posted April 13, 2014 Well it seems the equipping and unequipping work around seems to work, made my script a little larger than I would've liked but I doubt there's any other way to deal with AddItem, it's Bethesda's fault anyway. Gonna test it later with a higher level character and some mods that add Power Armor. Thanks for the help everyone. I may have just finished this damn thing. EDIT: Spoke too soon, everything works, at least now if you shoot the NPCs they take out their weapons, nonetheless, their weapons are not visible when they have them holstered, as I see it, that means that EquipItem function isn't doing its job. Basically, they don't act like morons anymore, but their weapons are not equipped on their back. or their legs or whatever. They only equip their weapons if I shoot them.
Guest tomm434 Posted April 16, 2014 Posted April 16, 2014 How can I force npc to use a terminal?(I need her to pretend that she is typying there - like Doctor Li when she hacks the terminal in Fallout 3 during escape scene).) I've got terminal itself and marker(marker is considered to be furniture). Then i add script package to the NPC but she just goes to terminal and stands in front of it.
nyaalich Posted April 16, 2014 Posted April 16, 2014 Pick a typing anim for the Idles tab of the package.
Guest tomm434 Posted April 16, 2014 Posted April 16, 2014 Pick a typing anim for the Idles tab of the package. Thanks, it worked. For some reason some idle animations don't play on NPC.The anims that start with "Loose" always play. "Use console" for example doesn't plays. "Use terminal" does.
nyaalich Posted April 16, 2014 Posted April 16, 2014 If you preview them, they're kind of funny sometimes. Very formal bows at a 90 degree angle.
Guest tomm434 Posted April 16, 2014 Posted April 16, 2014 If you preview them, they're kind of funny sometimes. Very formal bows at a 90 degree angle. yes, there is funny animation in Mothership Zeta where npc flyes away =) an you help me to find a log file? First time I encounter CTD in my mod and I don't know why. I added iFileLogging =1 to Fallout.ini but I can't find log file anywhere. Can you tell me where is it?
nyaalich Posted April 17, 2014 Posted April 17, 2014 @tomm434: It may be a myth? Scanner use feedback: I've mentioned it before, but the scanner is supposed to locate broc flowers and xander roots in a cell if she doesn't have 10 of each in her inventory. If the companion is within some believable distance to see or smell them (6-20 ft. / 2-7m?), she goes and executes activate packages. Usually scanners return the closest thing or processes stuff and then you're finished besides clearing out the list (or that's my current impression). Is there a way to get REFERENCES out of a form list? It looks to me like most fxns return the base form when performed on a form list. Due to the believable range and player running speed, it seems like I'd need to rerun the scanner every second or so until she finds some. This seems extremely inefficient. Do I need to look into arrays? I haven't read up on them yet. Would that make it plausible to fill it and then every second or so getdistance on the entries (which would indeed hopefully be returned as refs)?
Guest tomm434 Posted April 17, 2014 Posted April 17, 2014 @tomm434: It may be a myth? That's unfortunate. But print to console and ToggleDebugtext are not what I'm looking for. That's s shame I have to blindly edit scripts and packages to find a mistake.
nyaalich Posted April 17, 2014 Posted April 17, 2014 Look into running SCOF when you start the game. It writes console output to a file. Throw in some print to console commands for whatever needs to be tracked.
jaam Posted April 18, 2014 Posted April 18, 2014 There is a setting in nvse_config.ini (since v3 I think) that should reactivate runtime warnings. It is not heavily tested, and could generate hugue amount of data and script lag if used inconsedarably In short, use at your own risk. [RUNTIME DEBUG]Print=1
Guest tomm434 Posted April 20, 2014 Posted April 20, 2014 Print =1 doesnt work. I created "nvse_config.ini" in NVSE\Data folder and typed this and nothing happens ingame I don't know ho can I use ToggleDebugtext, SCOF commands. Nothing happens. Is there a guide how I can use this? I still can't figue out the source of problem.
Odessa Posted April 20, 2014 Posted April 20, 2014 When does the CTD happen, and what scripts do you have running then? Is it always in the same place, and does it always happen? To use scof: type scof "somefilename.txt" in the console; this will create an output file in your root folder by that name.
Guest tomm434 Posted April 20, 2014 Posted April 20, 2014 When does the CTD happen, and what scripts do you have running then? Is it always in the same place, and does it always happen? To use scof: type scof "somefilename.txt" in the console; this will create an output file in your root folder by that name. I still don't know the point of SCOF command - I can see console text even without it. I was looking for log like in Skyrim(where everything that happens is written) CTD happend randomly.There is the script for what its worth. if pdstage ==21 && pdtimer >=10 playercloneref.disable playercloneref.markfordelete player.imod BlacksexISFX set pdstage to 22 endif if pdstage ==22 && pdtimer >=11 player.showmessage aaalabmes28freed player.moveto aaalab28playermarker aaalabmanaref.evp aaalabmancref.evp set pdstage to 23 endif if pdstage ==23 && pdtimer >=14 aaalabmanbref.moveto aaalab26playermarker setstage aaalab 28 set pdstage to 24 stage 28 aaalabdoorexit2ref.setopenstate 0 player.rimod BlacksexISFX aaalabmanbref start dialogue with player(he has dialogue package with condition of queststage 28). He also has a lot of other packages for each stage of the quest and Sandbox package in which I added additional condition of quest stage !=28 (and some others stages). CTD can happen the moment aaalabmenbref starts dialogue or the moment I choose any dialogue topic(Literaly the moment I choose dialogue option). After dialogue is finished - stage is set to 29 and he picks his sandbox package again. And if CTD didn't happen during dialogue it doesn't happen at all. PS. And for some reason quest script stops working after dialogue. And I get CTD if I try to greet some NPC(even those who have constant greeting for all stages). update2: No, npc with their own greetings are fine.
DoctaSax Posted April 20, 2014 Posted April 20, 2014 Eh, dumping everything that happens to a log can create a bit of drag, especially when a lot's happening at the same time. That can already happen with scof let alone something that prints everything. So using scof in combination with well-placed formatted debugprints (only print to console when debugmode is on) lets you control that. You can also use con_scof to start a scof from script (if NVSE4+). ctd when picking dialog option, I dunno - any result scripts there?
Guest tomm434 Posted April 20, 2014 Posted April 20, 2014 Eh, dumping everything that happens to a log can create a bit of drag, especially when a lot's happening at the same time. That can already happen with scof let alone something that prints everything. So using scof in combination with well-placed formatted debugprints (only print to console when debugmode is on) lets you control that. You can also use con_scof to start a scof from script (if NVSE4+). ctd when picking dialog option, I dunno - any result scripts there? No begin\result scripts in greeting topic. So, you mean that after each line of code I should type a line (like showwarning "X") and then after CTD happens I see the log and see after what line of code CTD happened?
DoctaSax Posted April 20, 2014 Posted April 20, 2014 A dbp after each line is a bit overkill, but sometimes when you just can't find the source of a problem, you add a few more, to see just how far your script works without problems. Process of elimination.
Odessa Posted April 20, 2014 Posted April 20, 2014 Not ShowWarning, do console print like: PrintC "I will always appear in the console at this point" DebugPrint "I will appear only with debug mode enabled for the mod" SetDebugMode 1 ; this enables debug for the mod containing the script ; in the game console, you must specify the mod index in _Decimal_ not Hex, if you want to enable it like: SetDebugMode 1 75 ; I always add this to my main quests: int iIndex if GetGameLoaded || GetGameRestarted set iIndex to GetModIndex "MyModName.esp" PrintC "My mod version X loaded at index (hex): %x2 or (dec): %g" iIndex iIndex endif ; this tells you the definite index in both hex and dec in case you want to do console stuff. The quest not running suggests something crashed it, try adding console print at key sections to try and find where. Also, do you have any MenuMode blocks that may be running during dialogue?
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