Jump to content

How "Take Pill" Action works?


DarkKreepe

Recommended Posts

Hi everyone. Please, can you help me with the context menu for my custom pills? 

I cant understad how work a "Take Pill" action for vanilla Painkillers...

This is code of my item

item AspirinBottle
	{
		Weight				=	0.1,
		Type				=	Drainable,
		UseDelta			=	0.02,
		DisplayName			=	Bottle of aspirin pills,
		Icon				=	OZMoreMeds_Aspirin500mg,
		Tooltip 			= 	Tooltip_Painkillers,
		UseWhileEquipped	=	FALSE,
		
	}

 

I tried to make a custom context menu but my lua script still not working... 

 

Edited by DarkKreepe
Link to comment
Share on other sites

Vanilla action for it is hardcoded into Java as far as I can tell. Base game meds existed long before .lua modding was easily doable.

There are ways to do it easily by using crafting, which I can make you a template for it if you want but to replicate the effect of base game meds would be a tad more difficult I imagine.

Edited by Svarog
Link to comment
Share on other sites

9 hours ago, Svarog said:

Vanilla action for it is hardcoded into Java as far as I can tell. Base game meds existed long before .lua modding was easily doable.

There are ways to do it easily by using crafting, which I can make you a template for it if you want but to replicate the effect of base game meds would be a tad more difficult I imagine.

 

O my hero! I need your help! :-D

 

 

btw can you help me with this function?

JustTookPill(InventoryItem Pill)

I found it in ISTakePillAction.lua (TimedActions in lua folder)

 

At least I need a example ...

 

Edited by DarkKreepe
Link to comment
Share on other sites

Well, not really medicine but you could use this as a template for medicine.
 

http://www.mediafire.com/download/3gemu3104rcx03g/SVGTestMod.zip

 

What this is is a drainable bottle of Whiskey that isn't classified as food, doesn't have any of the typical food item stuff in the script, it applies the status effect through a lua call, the Drink action itself is actually a crafting recipe that produces a dummy item that is then removed.

It's not the best way to implement such things I'm sure but it works for me.

Edit: By the way, it doesn't replace the base whiskey and it doesn't spawn at all, you need to use NecroForge or something that can spawn an item via a console command or something to spawn it for yourself, I was too lazy to create a distribution script for a template :S
 

Edited by Svarog
Link to comment
Share on other sites

6 hours ago, Svarog said:

Well, not really medicine but you could use this as a template for medicine.
 

http://www.mediafire.com/download/3gemu3104rcx03g/SVGTestMod.zip

 

What this is is a drainable bottle of Whiskey that isn't classified as food, doesn't have any of the typical food item stuff in the script, it applies the status effect through a lua call, the Drink action itself is actually a crafting recipe that produces a dummy item that is then removed.

It's not the best way to implement such things I'm sure but it works for me.

Edit: By the way, it doesn't replace the base whiskey and it doesn't spawn at all, you need to use NecroForge or something that can spawn an item via a console command or something to spawn it for yourself, I was too lazy to create a distribution script for a template :S
 

 

Svarog, many thanks! In gratitude, I will write about you in my mod. For example, the drug "Svarog". :grin:

Edited by DarkKreepe
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...