Mktavish Posted June 13, 2018 Share Posted June 13, 2018 Well that is good enough ... trying to figure for needed swap. Which yes you need to model each one , and lock it to an object in the tree. So on the one being part of the weapon ... I think you will need a new weapon? But I digress to wait for EPDGaffney's opinion on that. Link to comment Share on other sites More sharing options...
Mktavish Posted June 13, 2018 Share Posted June 13, 2018 So if I'm understanding right, this would require two different nifs, and two different sets of textures, one adjusted for outdoor lighting, and one for indoor?The extend of my knowledge of GECK scripting is simply injecting my weapon IDs into vender, perk, repair, and other form lists. Yes you need to model the other version in different light which you already indicated you know how to do ... you said " but that would make it to bright in outdoors" ( err in other words) Also, this mod will technically be in the 2handHandle animation slot, since that's the only anim set that has free space to make new custom animations, or least that's how it was explained to me.And it will NOT be fully automatic. Animation restrictions force me to use semi auto. The Attack Loop anim simply doesn't have enough frames to fit this animation into it. Ya I'm not familiar with that , but I don't doubt your advice gleaned there. And it should be noted , what the animation does and the actual down range projectile does ... is 2 different things. Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 13, 2018 Share Posted June 13, 2018 So, I was in a big rush before, and still kind of am, but I've edited that script as I'd forgotten something. Also, I've never used the OnCellEnter event, so it's just a theoretical thing at the moment but test it and see what you get. You will need JIP LN, which means you'll need your GECK running with NVSE or this won't compile. And the 'automatic' in the file name was just an example. That whole thing there is the path to your model, so change it to whatever it actually is. So if I'm understanding right, this would require two different nifs, and two different sets of textures, one adjusted for outdoor lighting, and one for indoor?Yes, this will require precisely that. We may run into complications as I've never used most of what's in these scripts, but in theory, this should work. JIP didn't include this in the documentation, but the shell casing function for example may require Update3D afterwards, and we won't know till we've tried. It's possible to do texture swaps instead, but I'm not positive that will be enough and they are said to be unreliable (never used it myself). You may need to edit the emissive or specular settings on the NIF directly, which will mean that changing just the textures at run-time wouldn't help you. And there are a few NIF-altering scripts as well, but I think it's easiest just to swap the models, with everything already done on them. This kind of fix wouldn't work in YUP for two reasons: first, the main function here requires JIP LN as well as the event handler (though there may be less efficient ways that don't), which YUP doesn't do (vanilla game must be the only requirement) and second, you'd still need to do all the models in advance, which can become a problem with what texture mods people are using. Unless all we need to change is the NIF settings, leaving the textures the same, meaning people could use whatever texture mods they want, but I have my doubts on that. Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 13, 2018 Share Posted June 13, 2018 (edited) So on the one being part of the weapon ... I think you will need a new weapon?He would, but fortunately, the weapon itself is fine, including the shells it uses; it's just the spent ones that have the problem. So, I've edited the script again. It's just some print checks. If something doesn't work, delete the semi-colons in the two scripts. And if you didn't know, the first one will need to be attached to a quest that has Start Game Enabled ticked. You can set the quest delay lower than the default as well but it's probably not needed (default is displayed as 0 but defers to a variable that is set to 5 seconds if you or a mod never changed it). You won't need to do anything else with that quest. Just make it and attach the script. Make sure that you save that quest script as a quest script (click Object on the Script Type drop-down menu and select Quest) or it won't be available to choose when looking for the script to attach to the quest. Also, you need to save the script first, then make a new quest and give it an ID, then press OK, then open the quest form back up, and only then can you choose your script. And don't worry about performance. This script runs only at MenuMode 4, which is the main menu, and even if it didn't, it runs only when the game is first launched and then stops itself, as far as performance is concerned (that's the thing I forgot earlier, the If GetGameRestarted check). The other script is to be saved as an object script (which is the default) and as it is a function script, doesn't need to be attached to anything. The event just calls it whenever the event occurs. Edited June 13, 2018 by EPDGaffney Link to comment Share on other sites More sharing options...
Trentosaurus Posted June 13, 2018 Author Share Posted June 13, 2018 Alright, so this script will only work for this weapon mod, right? If I want these spent shells to work on all vanilla 12ga shotguns, each weapon would require its own script? And if I wanted them to work on other 12ga shotgun mods, I would have to make a patch for each one yes?What happens when I have 20 scripts running each time I enter an interior cell to check if I have a particular weapon equipped? And yeah I have the very basics of scripting down, it's just that if I ever wanted to actually script something besides injecting stuff into formlists I'd be lost. I'm more adept at the art side of modding and not the technical side. Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 13, 2018 Share Posted June 13, 2018 You would just edit this one script is all. If you didn't want to do it all individually, you could theoretically come up with some really cool naming convention that could be utilised with string variables, but if it's just a couple of weapons, you may as well just drop them into the script individually. I would expect no performance loss, but it's Gamebryo and life would be less exciting if we always got what we expected. Right? Link to comment Share on other sites More sharing options...
Mktavish Posted June 13, 2018 Share Posted June 13, 2018 Right ! But at the OP ... Testing will tell ... that is the slow and skinny.Cheeze and rice ... do you expect people to know the outcome from get go ? But hey ... you sound like you're ready to step to the next lvl on script understanding. And I'm not sure but ... most people cross that barrier understanding variables. So do you know , or want to know what those are ? But in short ... a variable is a memory slot to store something. Understanding variables and what you can do with them is key to scripting. like for example ...~~~~~~~~~~~~~~~~~~~~~SCN Myscript int numbcheck Begin OnActivate If numbcheck == 0 MyContainer.Activate Set numbcheck to 1 If numbcheck == 1 MyContainer.PlaceAtMe ThisExplosion Set numbcheck to 0 endif endifEnd~~~~~~~~~~~~~~~~~ The simple interger change from 0 to 1 or an on / off switch. And you could have switches within switches by simply changing a number of a variable. By the way ... the variable was declared above the Begin block.Which is standard for reading ... but they only need be declared before they are used as far as the engine reading them is concerned. But in this case numbcheck was used right away. But hmmm ... I feel I better shut up now ... so I'm going to say adieu. Link to comment Share on other sites More sharing options...
Trentosaurus Posted June 13, 2018 Author Share Posted June 13, 2018 Thanks a ton guys. The scripts work great, with the exception of the new shells don't eject if you load the game into an interior from the main menu or load menu. Instead it still ejects the "exterior" shells. It fixes itself once you leave the current interior and enter a new one. However, messing around with the textures a bit, and I can tell that this is not something that can be fixed by simply editing the textures. I think it has to be an engine/lighting problem. It's almost liike he ejected shells don't receive environment lighting from interior cells or something.It is interesting to note that the ejected shells look great when illuminated by muzzle flash. But they don't appear to be affected by interior light sources. Except maybe if the interior has some ambient light level, it receives that (not sure if that's possible or makes sense). It can't be anything in the nif because the material data is virtually the same as in the weapon nif. Some screenshots of the script-replaced shells with significantly brighter diffuse and spec maps: https://i.imgur.com/RLGxnqh.jpg https://i.imgur.com/crv6cCm.jpg https://i.imgur.com/wA1Sp8h.jpg Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 13, 2018 Share Posted June 13, 2018 Wow, glad the script works, cos that was 100% untested. We can fix the thing where the shells don't load correctly in an interior, but we'll do that after we know we can get the models themselves working. Try using emissive for the interior shells, so that they provide just a bit of their own 'lighting'. If you get it to work right, it would fake it fairly well. Don't do a full-on lightless model or anything, but just a slight amount of emissive so that it boosts the lighting the shells get. Interior cells do have a degree of ambient light (I think ILO removes this), but nothing like the exteriors. I'd be interested to see how your shells interact with a pitch-black interior and just your Pip-Boy light, as well as a few other tests (that the muzzle flash has an effect got me curious), and I'd like to see the results of the 'realistic' exterior lighting from some of the mods that handle that sort of thing. It can't be anything in the nif because the material data is virtually the same as in the weapon nif.Technically, this is true, as I think it's an engine problem with the way the engine handles shell casings, and potentially other form types that have something in common with shell casings. But that doesn't mean you can't compensate via a NIF, which is my suggestion with the emissive colour. You can use a map for it if you like, but to start, I would go into the NiMaterialProperty node, find the Emissive Colour entry, and set it to maybe 50% grey (hex code 7f7f7f), and then test in-game. You can add a red tint if you like, but I'd start with colourless values first. Link to comment Share on other sites More sharing options...
Trentosaurus Posted June 13, 2018 Author Share Posted June 13, 2018 Yeah, and to be sure it was working I changed the diffuse map to pure white, and I verified in game that outdoor has regular shells, and indoor had white shells. So the script is definitely working. Anyway, I got a much better result by changing the emit multiplier to 1.0505 and also adding in a 50% grey map in the glowmap slot in the nif. quick screen: https://i.imgur.com/JkidOig.jpg Something is still off though. The overall colors are pretty close to the same brightness but there is no light reflecting off the spent shell, besides whatever ambient light Goodsprings Saloon has. Also, a problem with changing the emit multiplier is that it will make the shells glow in very dark interiors.This is how the glowy dots on the ironsights work on guns like the hunting rifle. Although they are set to 4 or 5 on the emit multiplier. Link to comment Share on other sites More sharing options...
Recommended Posts