The forum has been set to read-only mode. For community discussion and questions, head over to our Discord: https://discord.taleoftwowastelands.com

Looking For Help Scripting A Diabetic Trait Mod

General help and troubleshooting.
Post Reply
Valentyne
Posts: 5
Joined: Tue Sep 29, 2015 11:56 pm

Looking For Help Scripting A Diabetic Trait Mod

Post by Valentyne » Thu Oct 29, 2015 6:49 am

So, I am generally pretty new to the whole modding thing and have very minimal experience in scripting and programming but (thanks in large part to the diligent and impressive work of this community) I've developed an interest in trying to do some modding myself. Of course, being the very amateur modder that I am, I have been struggling with a few issues and decided to come to the community to see if anyone would be willing to give me a hand or point me in the right direction.


I had installed the More Perks for TTW Mod uploaded by Deadboy and immediately fixated on the Diabetic Trait added by the mod. While I really liked the concept of a diabetic trait included in the mod, I didn't care as much for the implementation (especially since I use the Practice Makes Perfect Mod) and thought I'd try to figure out how to create a new Diabetic Trait in GECK that would increase the health modifier by 20% and apply a temporary 4 minute debuff to the player's stats whenever eating some type of food item.


I have done days worth of research trying to figure out what I thought would be a simple modification, looking for any examples or tutorials that would explain how to create the temporary debuff component of this trait (close to the point of obsession) and have not really found any conclusive answers. I had originally thought I might be able to get this to work by triggering the debuff effect when decreasing the starvation level through a script, but I really don't understand how to go about doing that.


Please let me know if I need to provide any additional information or if anyone could give me any pointers to making this trait operable - I would greatly appreciate it. :3



deadboy
Posts: 496
Joined: Fri Aug 16, 2013 11:18 pm

Why would you script it? Why

Post by deadboy » Thu Oct 29, 2015 11:31 am

Why would you script it? Why not just add the de-buff to the food(s) with the condition that the player has that perk?



User avatar
pintocat
Posts: 576
Joined: Sun Apr 07, 2013 12:50 am

If you don't want to edit

Post by pintocat » Thu Oct 29, 2015 11:16 pm

If you don't want to edit food forms, my suggestion would be to periodically poll the player's active effects with JIP's function, and if any of them are the effect for Restoring hunger, add a debuff. You might want to think through how you do it though, like maybe wait til they do have restore hunger, and do nothing til the food wears off. Otherwise you'd need to track each effect constantly to know if they ate something else etc. IDK. Depends what you want to do with it. 


http://geck.bethsoft.com/index.php?title=GetTempEffects



Valentyne
Posts: 5
Joined: Tue Sep 29, 2015 11:56 pm

Thank you for the quick

Post by Valentyne » Thu Oct 29, 2015 11:42 pm

Thank you for the quick response and input!


I had thought of possibly doing it that way if I couldn't figure out a way to attach the debuff to the use of a food item or a decrease in the starvation level. The primary reason for doing it the scripted method would be to increase the versatility of the mod with other mods that add or affect food ingestibles without having to create a new patch for every mod that does so. This would obviously constitute less of a problem if I only use the mod for personal use, but if I decide to release a mod with this content included, I'd like it to operate as easily and completely for everyone else despite what mods they are using (e.g., IMPs Complex Needs.) Not to mention I felt I'd learn a lot about GECK and scripting if I could get this to work.


Of course, I am very new and I could just be misunderstanding how such things work or this task may simply be far too daunting and complex to properly do. In that case, your suggestion would certainly be a good compromise.



Valentyne
Posts: 5
Joined: Tue Sep 29, 2015 11:56 pm

Thank you very much for your

Post by Valentyne » Thu Oct 29, 2015 11:48 pm

@PintoCat:


Thank you very much for your response, I'll take a look at that as well and see if I'll be able to make that work. I especially appreciate the link. I was at a complete loss at even which variables I'd use to check for the restore hunger effect in question.


I definitely appreciate all the input from you guys so far.



User avatar
pintocat
Posts: 576
Joined: Sun Apr 07, 2013 12:50 am

You could also use this:

Post by pintocat » Thu Oct 29, 2015 11:54 pm

You could also use this:


http://geck.bethsoft.com/index.php?title=AddNewEffect


Do that once to each food item on GameRestart, but then you'd still need to know which items are food... maybe use Lutana GetLoadedTypeArray of ingestibles then find the ones that have the restore hunger in their effects



Valentyne
Posts: 5
Joined: Tue Sep 29, 2015 11:56 pm

That AddNewEffect script

Post by Valentyne » Fri Oct 30, 2015 6:06 am

That AddNewEffect script looks like it might be the best function to work for my purposes. I'll see if I can get some sort of script functioning that will be able to make the effect work for the trait. Here's to learning new things!


Thanks again, Pintocat, your ideas have been very, very helpful.



Valentyne
Posts: 5
Joined: Tue Sep 29, 2015 11:56 pm

Thank you all again!

Post by Valentyne » Tue Nov 03, 2015 9:53 am

Thank you all again!


Seems I got it working. ^_^



Post Reply