Jump to content

Hands on player needs and other stuff at lua scale

Recommended Posts

Hey, I'm making mod with injectors. 

There's quite much I need to make, at least for learning's sake. 


Is there any more efficient way of making crafting result multiple items than using OnCreate with Lua? 

Well, that's not so important, it works this way so that can be left there. 


But more importantly, I need to get my hands on player's needs at lua scale, meaning I need to get modify all these pain, depression, hunger, thirst, and to temporary modify increase and decrease multipliers. I can't find those myself (I tried digging) so I hope someone of you can tell me where to get all that.


I can't remember right now what all other stuff I need help with, but these are first that came in mind. 


Reason where I need these are my so-called potions with longer effects, and to prevent continuous injecting without nasty side effects, like pain and getting heavily toxicated (yes, mixtures use alcohol), or eventually death. (That's grim)

if someone wants to know more, I'm willing to tell. 

My data is a bit scattered and unorganized so I don't attach it here, at least not yet. 


Kinda messy text, but I hope you can dig out what I meant.

Asking is always my last resort  :D


Thanks in advance. 

Share this post

Link to post
Share on other sites

	player:getBodyDamage():RestoreToFullHealth();	player:getStats():setHunger(0);	player:getStats():setPanic(0);	player:getStats():setBoredom(0);	player:getStats():setThirst(0);	player:getStats():setFatigue(0);
I use this to heal the player constantly for debugging reasons.

RegularX has made a quite similar mod called XMod (IIRC) which has healing potions and lots of other stuff. I'd suggest that you check out his code too.

Share this post

Link to post
Share on other sites

This XMod has quite interesting lua stuff there.



Still no way to get access to player pain and toxicity? I'd really like to get my injections have a bit more potent alcohol, and increase pain whenever using injections, or is health and pain same thing


How about that code behind pills, or is it hidden in java? 


I found these functions (accidentally), I thought I checked this site many times over...

Anyway, here's link if someone else had same problem.



Also, is there any way to make new modifiers to items, and add new function in lua?

In this case "VialType" and "getVialType()".  

This would potentially shorten my lua code behind crafting. 

 item InjectorEmpty{Weight = 0.21,Type = Normal,VialType = Vial,DisplayName = Injector (Empty),Icon = InjectorEmpty.png,} item Vial{Weight = 0.01,Type = Normal,DisplayName = Vial,Icon = Vial.png,}

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...