Ryan-rsm-McKenzie / CommonLibSSE

A reverse engineered library for hacking Skyrim Special Edition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getPoison and setPoison

marcusx2 opened this issue · comments

Hi, I want to make a new sse mod, and I decided to use this lib. Basically I want to be able to poison arrows instead of bows using this lib. Is there an easy way to use this lib to get a poison from the inventory, then apply it to any object, including arrows(equipped arrows specifically)? Or is it only possible to poison weapons and it wouldn't work on arrows? Thank you for your time!

That may help you to get all the poision items from your inventory:

		RE::BSTArray<RE::AlchemyItem*> poision_arr;

		auto playerref = RE::PlayerCharacter::GetSingleton();

		auto inv = playerref->GetInventory();

		for (auto& item : inv) 
		{
			auto thisitem = item.first;

			if (thisitem->formType.get() == RE::FormType::AlchemyItem);
			{
				auto Alc = thisitem->As<RE::AlchemyItem>();

				if (Alc && Alc->IsPoison())
					poision_arr.push_back(Alc);
			}
		}