Jump to content
DarkKreepe

How "Take Pill" Action works?

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Speaking of this anyone know why the game freezes up if you try to have a drink or food item replicate itself? Was trying to make an item that would create another of itself on use instead of empty bottle and the game freezes no errors just locks up

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

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.

Guest
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.

Loading...

×
×
  • Create New...