-
Posts
14 -
Joined
-
Last visited
Nexus Mods Profile
About ignorantslave
Recent Profile Visitors
2763 profile views
ignorantslave's Achievements
Apprentice (3/14)
1
Reputation
-
Hey thanks for the reply! I decided to take a peak at another mod which uses similar scripts for special weapon behavior, and there were OnEquip checks to prevent the above leak from happening. So I wrote it like this scn LSTARechargeScript float timer int AmmoClip int CurAmmo int Equipped Ref dude begin OnEquip set Equipped to 1 end begin gamemode if Equipped == 1 set AmmoClip to 35 set dude to GetContainer if timer < 0.7 set timer to timer + GetSecondsPassed else if dude.GetItemCount AmmoMicroBreeder == 0 dude.AddItem AmmoMicroBreeder 1 1 endif set CurAmmo to dude.GetCurrentAmmoRounds if CurAmmo == 0 Return elseif CurAmmo < AmmoClip set CurAmmo to (CurAmmo + 1) dude.SetCurrentAmmoRounds CurAmmo endif set timer to 0 endif endif end begin OnUnequip set Equipped to 0 end begin OnDrop set Equipped to 0 end Seems to be working. Uhm but tomorrow I will update the code with the additional conditions you proposed, just to be sure.
-
Ok, so I tried to use another JIP function, PlayAnimSequence, and while it allowed me to pick the correct reload animation for the gun, it was somehow bugged and prevented me from actually firing the gun afterwards. So I decided to use another method. Instead of scripting a recharging weapon to play reload animations, I removed the ammo regen part and simulated it using this script scn LSTARechargeScript float timer int AmmoClip int CurAmmo begin gamemode set AmmoClip to 35 Ref dude set dude to GetContainer if timer < 0.7 set timer to timer + GetSecondsPassed else if dude.GetItemCount AmmoMicroBreeder == 0 dude.AddItem AmmoMicroBreeder 1 1 endif set CurAmmo to dude.GetCurrentAmmoRounds if CurAmmo == 0 Return elseif CurAmmo < AmmoClip set CurAmmo to (CurAmmo + 1) dude.SetCurrentAmmoRounds CurAmmo endif set timer to 0 endif end I'm not sure if it's in any way efficient, and it's definitely not elegant (the total ammo count goes in the negatives) but it's functional, and now I just need to test it with NPCs. This way, the gun handles like a powerful recharger rifle/plasma gun hybrid (complete with recolored red plasma effects), with reloading being a penalty for squeezing the trigger for too long.
-
Hello! I'm currently working on a custom weapon which is supposed to resemble the L-STAR light machine gun from Titanfall 2 both in looks and functionality. So you should be able to fire it forever as long as you don't let it overheat, that is, run out of ammo. Now, recharger rifles and pistols work basically the same, and my gun uses the same ammo regen function, but using said function disables reload and jam animations, and I would like for my gun to play both in sequence if the ammo count reaches 0. So I wrote a script, using a function from the JIP NVSE plugin to check for the actor's current ammo and play the animations when the clip is depleted, and it works technically. scn LSTARechargeScript int CurAmmo begin gamemode Ref dude set dude to GetContainer set CurAmmo to dude.GetCurrentAmmoRounds if CurAmmo < 1 dude.PlayGroup ReloadD 0 dude.PlayGroup JamD 0 dude.PlayGroup Idle 1 endif end The problem is, the PlayGroup function picks the one-handed versions of the reloadD and JamD animgroups instead of the two-handed versions which would work with my gun (I nif-bashed it around the gauss rifle mesh), and I don't know how to selectively pick the animations I want. Is there a better way to write the script, or a completely different approach to achieve the same results?
-
It turns out what I wanted material swaps to do could already be done by effect shaders. There's literally an "affect skin only" tick box that applies the shader to the human mesh part of an outfit while the rest stays normal. So ticking that box on the "gooify" plasma death effect shader makes the skin melt away from clothes. By having a script-based magic effect tied to a race ability constantly apply the shader to the character, and by setting the robot mesh armor addon to use the "facegen head" biped slot instead of the "BODY" one, I can make my metal man wear any outfit no matter how much skin it shows, without even needing F4SE! So, if you want to rig Liberty Prime to the human skeleton (essentially what I did) so he can wear a pretty dress, now you know how to do it.
- 6 replies
-
- 1
-
- material swap
- papyrus
-
(and 1 more)
Tagged with:
-
So the "setrace" method updates the material as expected, but causes various glitches and stuttering. "Sexchange" is not a papyrus function and "QueueUpdate" which should update the actor doesn't seem to do anything. The "reset" function is also not ideal. There has to be a better way to reload the actor.
- 6 replies
-
- material swap
- papyrus
-
(and 1 more)
Tagged with:
-
Hello, I need suggestions on how to make this F4SE script work again. Scriptname AggressorMaterialSwapEffectScript extends activemagiceffect int liltimer = 33 Actor guy Event OnInit() guy = GetCasterActor() MatSwap alphaMat = Game.GetFormFromFile(0x001735, "aggressor2.esp") as MatSwap guy.setMaterialSwap(alphaMat) guy.ApplyMaterialSwap(alphaMat) StartTimer(5, liltimer) EndEvent Event OnTimer(int aiTimerID) If aiTimerID == liltimer MatSwap alphaMat = Game.GetFormFromFile(0x001735, "aggressor2.esp") as MatSwap guy.setMaterialSwap(alphaMat) guy.ApplyMaterialSwap(alphaMat) if guy.GetMaterialSwap() == alphaMat Debug.Notification("Material applied!") EndIf StartTimer(5, liltimer) EndIf EndEvent I made it in 2023 to apply a transparent material swap of the human male mesh on an actor and any worn clothes, but it recently stopped working correctly, possibly due to the next gen update. It no longer periodically applies the material swap on the actor (despite the debug notifications working), and only reloading the actor makes the mesh turn transparent. The code is part of a magic effect meant for a custom robot race, with the objective of turning invisible the human mesh part of any outfit showing skin. So for example, if the actor equips a harness, the script should replace the flesh with a transparent material like so (this is how it worked before and when reloading the actor), leaving the robot mesh underneath. But now the setMaterialSwap function no longer applies the material swap during the events, and the actor looks like this. So if it only works on actor reloads, and the only commands that reload the actor that I know of are "setrace" and "sexchange", do I simply set the script to periodically switch between races so the skin part stays invisible, or is there a better way?
- 6 replies
-
- material swap
- papyrus
-
(and 1 more)
Tagged with:
-
issues with transparent material swap
ignorantslave replied to ignorantslave's topic in Fallout 4's Creation Kit and Modders
Hello again! After several attempts, I've managed to strike gold with the scripted approach. This actor script was the first to actually work. Scriptname NPCAggressorMatSwapScript extends Actor Event OnItemEquipped(Form akBaseObject, ObjectReference akReference) if akBaseObject as Armor MatSwap myMaterial = Game.GetFormFromFile(0x001735, "aggressor2.esp") as MatSwap setMaterialSwap(myMaterial) ApplyMaterialSwap(myMaterial) endIf EndEvent It detects when a piece of armor is equipped to apply the material swap. I'm surprised that using those matswap functions directly on the whole actor would also work on the armor being worn. It wasn't even necessary to access the matswap through formlists and to obtain the armor via GetWornItem. It was actually far simpler. Here's a guy wearing an outfit that's mostly skin. The humanmale mesh is completely invisible. Unfortunately the material swap doesn't persist when closing and reopening the game. I would need to make it periodically and automatically apply the material somehow, instead of having to open the inventory of the NPC and equip then unequip a piece of armor manually. Maybe using OnLoad() instead, or making it a magic effect. -
issues with transparent material swap
ignorantslave replied to ignorantslave's topic in Fallout 4's Creation Kit and Modders
Yeah I'm not familiar with scripting aswell, but your idea is good. Perhaps the script could be part of the Skin or implemented as a perk. I will check the Creation Kit and the wiki for snippets of code I can use. -
issues with transparent material swap
ignorantslave replied to ignorantslave's topic in Fallout 4's Creation Kit and Modders
I'm sorry, I didn't give enough context for what I'm trying to do. I've made what is essentially a gen1 synth remodel (here's a pic), which would be its own race, and as you say, it would not be able to wear outfits without the rest of the model disappearing, since it doesn't have separate head and hands meshes yet. However, by changing the biped slot from 33 (BODY) to 32 (FaceGen Head), I can make the character wear both his own skin and pretty much any outfit or hat with minor clipping (here's the guy wearing a greaser jacket). Of course outfits showing skin do not look good, and I thought I could make the human mesh part invisible by using the same process used in vanilla to make ghouls apply their own skin texture to any outfit. To do that I added a humantorso ARMA to the character's ARMO along with the robot model ARMA, then make it invisible with a material swap and have a textureset apply the material to any outfit. As I said, it works partially (here's the guy wearing a harness, the skin is painted gray), but the Alpha channel of the texture (which works fine as a material swap) simply doesn't register on the outfits. The TextureSet seems to ignore any transparency setting in the bgsm file. I thought I was being smart by using this stratagem, but I'm clearly missing something. Still, thanks for the help and patience. -
issues with transparent material swap
ignorantslave replied to ignorantslave's topic in Fallout 4's Creation Kit and Modders
You are right, there's nothing wrong with the material swap. The problem is in my approach. To avoid having to modify every outfit or creating copies with the material swap applied, I thought I could create a (transparent) skin texture set like the ones used to give raiders dirty skin or Ghouls their signature look, and apply it to an armoraddon for a my custom character skin. This way any outfit I would wear would use the same skin as the one applied to my modified torso armoraddon. And it partially works. I give the texture set a completely white diffuse, and wearing a raider harness makes the skin part of the outfit look white. The problem is, transparency is not carried over to the outfit, only colors. So the issue should be with the TextureSet. Despite using the same material with all alpha settings set for transparency, it doesn't register them. Only the RGB channels. Removing the Diffuse texture from the material causes the skin to turn purple. Replacing the original BaseMaleBody_d.dds with a version made transpararent with the Eraser tool in GIMP changes nothing, the alpha channel is simply ignored. Creating a new, completely empty texture turns the skin black, because the RGB channels are black when they are empty. Adding a NiAlphaProperty to the MaleBody.nif in Nifskope does nothing. In the TextureSet menu there are Alpha Test and Alpha blend options but only by checking "Decal" it lets me change them. They don't seem to work. -
issues with transparent material swap
ignorantslave replied to ignorantslave's topic in Fallout 4's Creation Kit and Modders
Tried what you suggested, every combination (Alpha test Reference can't be set to more than 255 tho) and still no transparency in the mesh, unfortunately. At least no more error messages. In fact, the method I use to apply material swaps, selecting them in the same menu where you choose the mesh for the armoraddon, doesn't even seem to work! Even if I use a vanilla material swap compatible with the mesh nothing changes in-game. Texture sets are the only things I can modify that actually make something happen in-game, but even using a completely blank one still colors the body purple. Transparency is simply not possible with an unmodified mesh. I guess tomorrow I will try with Nifskope. -
issues with transparent material swap
ignorantslave replied to ignorantslave's topic in Fallout 4's Creation Kit and Modders
Thanks for the help. I checked the Decal option, and lo and behold, it no longer shows that specific error message, but in-game my character still looks like a human marshmellow. I still receive more warnings though: TEXTURES: TEXTURE ERROR : Unable to load file 'actors/character/basehumanmale/basemalebody_msn.dds' TEXTURES: Warnings were encountered during material swap for model 'Actors\Character\CharacterAssets\MaleBody.nif'. Check warnings file for more details. The warning file doesn't really say anything different. But after reading yours and other similar comments, I may just have to bite the bullet and edit the nif itself to allow transparency. I was hoping to solve this with just material files but I guess not. -
Hello, I'm trying to make a material swap that would replace the basehumanskin.bgsm material with a completely transparent one, so that any outfit which uses part of the malebody.nif would only show clothing with no visible skin. But none of my attempts have fully worked so far. I've tried to make a material with a single empty BaseMaleBody_d.DDS texture in GIMP, and in Creation Kit preview the body mesh turns invisible, but in-game it takes the same color as the RGB channels of the texture with a glossy finish but no transparency. I've tried to mess with Alpha test and Alpha Test Reference in Material Editor but no setting changes a thing. So this is my problem. My material swap appears to work in Creation Kit but not in-game. Can anyone help? Creation Kit also gave me these warnings when I inspected the model of the armoraddon: SHADERS: MATERIALSWAP : preventing attempted swap to alpha blend for non-decal BaseMaleBody:0 SHADERS: Warnings were encountered during Material swap for reference: '' (010044D0)