theninjew Posted April 17, 2018 Share Posted April 17, 2018 Hey folks, Firstly, thanks for giving this a look.I've got a mod I'd like to make that I think is both useful and hilarious; Basically any non-robotic enemy that dies sh*ts itself, playing a nice fart-y sound and adding 1 fertilizer to their inventory. The idea being that you can take that and feed it into the Contraptions ammo plant and make yourself more bullets or explosives. Combined with a few popular mods that let you break down unwanted calibers of bullets for lead and copper, you can start filling up your favorite gun with bullets made of raider poop. Probably name it something tame like 'Bullets to Fertilizer" because I can't really put swears in the title as far as I know.Anyhow, the crux of the matter is this: for a first time modder, the task of just finding what it is you need to learn to do the mod is daunting. "You don't even know what you don't know" and all that. There's a whole lot of documentation out there, which is great, but has also been leading me on wild goose chases following wikis that turn out to have nothing to do with what I need. So I was hoping someone or someone(s) can look at what I'd need to do in order to get this mod working and kinda say: "Okay fella, you're gonna need to know X, Y and Z to pull this off". Not looking for a handout as I'd like to do the research by myself to learn, but some directions to where I'm going would be grand. Maybe a heads up or two if there's landmines en route.As far as I can figure, the way I'd do this mod would be to do a small script that plays a sound on NPC death and does an 'additem' to their inventory for 1 fertilizer. Seems kinda simple, though right away I know I'm going to have to find some way to vary the volume of the sound by how far away the player is, and find a way to exclude robotic NPCs from the sh*t list. Plus I don't know if there's a way to tie a script on just a generic death, since a lot of the on-death effects that I know seem to be keyed off of a weapon. Sooooo.... yeah. If this were you, where would you start? Link to comment Share on other sites More sharing options...
payl0ad Posted April 17, 2018 Share Posted April 17, 2018 NPCs have a so called Death-List, a leveled item that gets added to their inventory on death. I believe those are specific to races, so you can apply your things only to humanoids and probably super mutants. The sound can be played from a script but I'm not sure how I'd trigger that. Link to comment Share on other sites More sharing options...
FlashyJoer Posted April 18, 2018 Share Posted April 18, 2018 (edited) Easiest way I can think of that doesnt rely on reference aliases with attached scripts for OnDeath() would be to have a script running that checks combat state and then when it detects combat is ongoing, have a function run that gets the combat targets, runs an array check to add HitEvents to them. In this way, you could simply add the fertilizer when you first hit them. Because whether then or when they die, it doesnt matter - if you get killed, youll never see their inventory and if you kill them, well, the item is already in their inventory. The OnDeath() thing though, to play the sound when they die? Thats a little imprecise because you can only specific who the killer was and the sender of the event, but if its not a ref alias, I dont know that akSender will receive anything other than NONE - have never tested this on a normal spawned actor. But for sure, you can add the fertilizer to them quite easily. Like this: Actor[] AddpoopActor Property PlayerREF autoMiscItem Property Fertilizer auto Event OnCombatStateChanged(Actor akTarget, int aeCombatState)If aeCombatState == 1AddFertilizer()EndifEndEvent Function AddFertilizer()Addpoop = PlayerREF.GetAllCombatTargets()Int yy = 0While yy < Addpoop.lengthIf !Addpoop[yy].IsDead // Meaning, if the combat target is NOT deadRegisterForHitEvent(Addpoop[yy]) // or if you want it to be ONLY the player than can cause poop to be added you use RegisterForHitEvent(Addpoop[yy], PlayerREF)Endifyy+=1EndWhileEndFunction Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial)If akTarget != PlayerREF // Meaning, it can be anyone BUT the player(akTarget.GetReference() as Actor).AddItem(Fertilizer, 1, true) // Silently add 1 fertilizer to this person's inventoryEndifEndEvent Roughly, in a nutshell and obviously can be VERY refined. But you get the point... I hope. You can of course refine the parameters on who gets the hit event registration, typically by using a formlist of actor types, so you can say, I only want bipedal humanoid types to poop themselves, so exclude synths, exclude robots, exclude dogs, etc. if which case the Function AddFertilizer changes somewhat to look like this, if we want to limit it to say, just humans. Function AddFertilizer()Addpoop = PlayerREF.GetAllCombatTargets()Int yy = 0While yy < Addpoop.length If !Addpoop[yy].IsDead // Meaning, if the combat target is NOT dead If Addpoop[yy].GetRace() == HumanRace RegisterForHitEvent(Addpoop[yy]) // or if you want it to be ONLY the player than can cause poop to be added you use RegisterForHitEvent(Addpoop[yy], PlayerREF) Endif Endifyy+=1EndWhileEndFunction But I am sure now you get it :smile: Feel free to ask anything you need to... Edited April 18, 2018 by joerqc Link to comment Share on other sites More sharing options...
theninjew Posted April 18, 2018 Author Share Posted April 18, 2018 Alright thanks guys, that gives me a lot to look at. I'm not super duper familiar with papyrus, but I think I can follow what you have coded there. It gives me a good example to research and learn the function calls. I'm gonna try the death-list way first since it seems like the least intrusive way to do things, but we'll see how that goes. There's gotta be a way to tie in the sound though, even if it involves editing the death sounds themselves. I've got the software for that at least, though I don't know what voodoo would make that work without having to replace the BSAs. The sound is like 90% of the comedy in this mod for me, so hopefully I don't have to give it up. Appreciate the help, and yeah Joe, I may actually hit you up with some questions if you don't mind. Link to comment Share on other sites More sharing options...
dagobaking Posted April 18, 2018 Share Posted April 18, 2018 (edited) You should probably start by reading the CreationKit wiki pages for Fallout 4. There aren't really that many pages to go through there. It covers setting up the compiler and a text editor, basic CK work and all the scripts and form types. It helps a lot to know a bit about the purpose of all the major game scripts (Actor, Furniture, Quest, etc.). Can probably all be read/understood in a day or two. Edited April 18, 2018 by dagobaking Link to comment Share on other sites More sharing options...
Recommended Posts