Odessa Posted February 14, 2015 Posted February 14, 2015 'C' style bit operators are permitted but only in NVSE aware contexts, such as a let or eval expression or with the compiler override. Eg: if eval ItemBitMask & (1 << 11); do stuff I updated the wiki page with the examples.
prideslayer Posted February 15, 2015 Posted February 15, 2015 Oh the damn eval, yes, forgot about that. In older versions of Sexout (pre-NX), the lock/unlock used bitmasks on Variable04 and I had to do some real bullshit to make that work right with the "LogicalAND" functions and soforth which do work fine without eval.
Guest tomm434 Posted February 17, 2015 Posted February 17, 2015 Has anybody ever used "Add Activate choice" for perks? It works fine on my PC but beta testers say that perk doesn't work (they activate object and additional menu should appear. Instead nothing appears - object gets activated in usual way).
Halstrom Posted February 20, 2015 Author Posted February 20, 2015 Anyone knw if there's a setting somewhere in GECK that hides all dialogues? They seem to be missing in any plugin I open but are still there in FNVEdit
Halstrom Posted February 21, 2015 Author Posted February 21, 2015 Hey anyone know how I could find the ref of an ARMOR object that a script is in, similar to GetContainer or GetSelf. Get Container returns the actor fine, but GetSelf returns <NoName>. I want to try use the same script on 12 objects with subtle variations as it finds out which which object it is in rather than have 12 different scripts or splitting the scripts or passing variabes around between other Tokens or Functions or arrays etc. Basically 12 suits of armor but different colors and I want them to cast a different effect on the actor depending on the color armor the script detects it's in, , I could use 12 scripts but I hate having to cut and past as I bug hunt them
prideslayer Posted February 21, 2015 Posted February 21, 2015 Put it in a UDF and call that? Won't something simple like this work? scn fnGetSelfOrContainer ref rRes Begin Function{} let rRes := GetSelf if (0 == rRes) let rRes := GetContainer endif SetFunctionValue rRes End Or.. I'm just not understanding the nuance.
Halstrom Posted February 21, 2015 Author Posted February 21, 2015 trouble with using a UDF or other token script is I need to pass about 10 variables & refs to that UDF and update them each time it runs, which I can do with NX's but I was hopping there was a simple GetSelf function somewhere that worked for this. I think I'd rather just cut, find/replace and paste the script 12 times instead to keep it simpler
Guest tomm434 Posted February 21, 2015 Posted February 21, 2015 Can you try http://geck.bethsoft.com/index.php?title=GetEquippedObject ref Self let Self := PlayerRef.GetEquippedObject 2 if Self == MyArmor1 ; form id ; do 1 elseif Self == MyArmor2 ; form id ; do 2 endif
Odessa Posted February 21, 2015 Posted February 21, 2015 I don't think there is a nice way, but I came up with this: float MyID ref MyBaseForm ref rItem let MyID := 666 ; # set some ID one way or another, we only need it once foreach rItem <- GetContainer ; # rItem is a temp inv ref to each item in container if rItem.GetVariable "MyID" == MyID ; # check if the ID of the inv ref is us let MyBaseForm := rItem.gbo ; # gbo should give us our base object endif loop let MyID := 0 ; # we know our base form so don't need it any more
Guest Posted February 21, 2015 Posted February 21, 2015 Basically 12 suits of armor but different colors and I want them to cast a different effect on the actor depending on the color armor the script detects it's in, , I could use 12 scripts but I hate having to cut and past as I bug hunt them This is how I handled it few days ago. I used different effects, all the effects had the classical (+whatever you want -some other stats) but all the effects also had the same script attached, which was identifying the source of the effect using IsSpellTarget, and eventually adds extra lines of code if it was necessary Concerning passing parameters on UDFs, when I have too many I usually prefer storing them inside a quest.script before calling the UDF i.e. SCN quest ... Let Var1 := somevalue Let Var2 := somevalue SomeRef.Call MyUDF and MyUDF contains: ; do some operations with quest.var1 and quest.var2
prideslayer Posted February 21, 2015 Posted February 21, 2015 The UDF is the "simple getself" Hal, at least that's what I intended to convey. It doesn't need/take any params, just as getself/getcontainer don't.
Odessa Posted February 21, 2015 Posted February 21, 2015 As I understand it: GetSelf, GetContainer and implicit referencing only works for world references, not inventory references. To get an inventory reference you need to use foreach, GetInvRefsForItem, GetFirstRefForItem or CreateTempRef. There is no easy way, which limits the usefulness of functions like IsEquipped.
prideslayer Posted February 21, 2015 Posted February 21, 2015 I'm not quite sure I understand what you mean -- GetContainer is the canonical way for scripted items to get the ref to their container (an actor if in inventory, or an object like a footlocker). Maybe I just don't understand what you mean when you say world vs. inventory items.
Odessa Posted February 21, 2015 Posted February 21, 2015 GetContainer will return the reference that contains the object which the calling script is attached to; returning the actual object which the calling script is attached to is difficult. So, an armor script can easily tell who's inventory it is in, but not what kind of armor it is.
prideslayer Posted February 21, 2015 Posted February 21, 2015 Ah ok, I see what you mean. In my cases, I only care about the 'container' meaning the actor that the script is running on or that is holding the object, the object takes care of itself. I misread Hals situation as the same. Getting the actual item ID from inventory is a pain, you're right, and not always possible if there are multiples in inventory. I think it will work for his ARMO items provided they don't all have the same condition. In my scripted MISC items, where it's impossible to determine exactly which one the script is on -- I let it take care of that itself. The script only starts running when there is only one item in inventory (itself) and it takes care of getting the count of others when they are present and removing them when appropriate. I don't actually need the ID for anything though. For those items, one is as good as any other.
Guest Posted February 21, 2015 Posted February 21, 2015 I don't actually need the ID for anything though. Reading what Halstrom wants to achieve, I say even he doesnt' need it
Halstrom Posted February 22, 2015 Author Posted February 22, 2015 Basically 12 suits of armor but different colors and I want them to cast a different effect on the actor depending on the color armor the script detects it's in, , I could use 12 scripts but I hate having to cut and past as I bug hunt them This is how I handled it few days ago. I used different effects, all the effects had the classical (+whatever you want -some other stats) but all the effects also had the same script attached, which was identifying the source of the effect using IsSpellTarget, and eventually adds extra lines of code if it was necessary Concerning passing parameters on UDFs, when I have too many I usually prefer storing them inside a quest.script before calling the UDF i.e. SCN quest ... Let Var1 := somevalue Let Var2 := somevalue SomeRef.Call MyUDFand MyUDF contains: ; do some operations with quest.var1 and quest.var2 Yeah I thought about using an effect except I know effect scripts on NPC can get reset when they leave the cell/sleep/fast travel or pass through doors etc and I want the armor to remember all it's battery level, modes variables etc which is why I wouldn't use a UDF. I don't actually need the ID for anything though. Reading what Halstrom wants to achieve, I say even he doesnt' need it Well all I need to know is if the script is in a green suit of armor it knows that and picks it's parameters from the green suit options, I'll give Odessa's idea a go and if that doesn't work I'll try splitting the script in 2 parts. It's one of those scripts that needs a lot of tuning for battery drain etc so I'd rather not have to adjust a dozen color versions of it everytime I tweak it
Guest Posted February 22, 2015 Posted February 22, 2015 Yeah I thought about using an effect except I know effect scripts on NPC can get reset when they leave the cell/sleep/fast travel or pass through doors etc and I want the armor to remember all it's battery level, modes variables etc which is why I wouldn't use a UDF. I never tested it explicitly, but I'm pretty sure that while an effec dispels on cell change, it will be reapplied when the actor re-enter inside the cell wearing that armor***. Or any object effect would be bugged on cell change *** of course I'm talking about an effect on a object effect
Halstrom Posted February 22, 2015 Author Posted February 22, 2015 Yeah I thought about using an effect except I know effect scripts on NPC can get reset when they leave the cell/sleep/fast travel or pass through doors etc and I want the armor to remember all it's battery level, modes variables etc which is why I wouldn't use a UDF. I never tested it explicitly, but I'm pretty sure that while an effec dispels on cell change, it will be reapplied when the actor re-enter inside the cell wearing that armor***. Or any object effect would be bugged on cell change *** of course I'm talking about an effect on a object effect I had problems when I used Actor Effects in early versions of pregnancy for NPC's the player was fine but NPC's effects dispelled and didn't reapply. Which even if it did reapply is still no good because the script resets anyway. So gone back to small parameter scripts in each outfit calling a UDF now passing the info by a bunch of NX variables on each actor.
prideslayer Posted February 22, 2015 Posted February 22, 2015 One thing that NX does pretty well is store things like that, so that (if you want) you can change most spells to just cast, run once, update the NX vars, and dispel. Having "per spell" vars that persist even when the spells (or items, or whatever) don't is handy.
Guest Posted February 22, 2015 Posted February 22, 2015 *** of course I'm talking about an effect on a object effectI had problems when I used Actor Effects in early versions of pregnancy for NPC's the player was fine but NPC's effects dispelled and didn't reapply. I think you are talking about CIOS-ing an effect on a NPC, while I'm talking about an effect inside an Object Effect (attached to your armors, but it could be on a weapon or in whatever equipped item).It wouldn't be a bad thing to check.
Halstrom Posted February 23, 2015 Author Posted February 23, 2015 Yeah it was only CIOS effects I tried.
Guest Posted February 26, 2015 Posted February 26, 2015 As often it happens, I did a huge conceptual mistake due to misunderstanding of documentation So it seems that GetGameRestarted works everytime you load new vegas, from the desktop. No matter if you are starting a new game or you load a previous game. I thought it was working everytime you click "Start a new game". So my question is: is there a way to reset variables when starting a new game?
prideslayer Posted February 26, 2015 Posted February 26, 2015 There's not a function that does that, but writing one is pretty easy. scn MyQuest int bInit Begin GameMode if (0 == bInit) let bInit := 1 ; do your new game things. endif End Not that this will not ONLY run on a new game -- it'll run on a loaded game too, if your mod isn't present in the savegame. Honestly I thought GetGameRestarted worked the way you did, but I already do checks like this bInit thing within the getgamerestarted/getgameloaded blocks so no harm done.
Guest Posted February 26, 2015 Posted February 26, 2015 Oh, thank you. Fortunally sometimes there are even easy things...
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