Jump to content

Crafting potions, Resist Fire is not Resist Fire


disi30

Recommended Posts

Good lord, no, there should be no need for any of that. What exactly are you trying to do?

Its all in the first post:

 

 

I try to make a quest here to give the player some ingredients and make him craft a potion.

But I am ok with the current solution, if he crafts any potion it triggers to come back, if he walks too far away, the quest fails.

It chooses random between 9 different potions and gives him the needed ingredients to make one.

Link to comment
Share on other sites

So you have a quest which tasks the player with creating one of 9 potions and you give the player the ingredients to create the potion. However, because crafted potions do not yield pre-created potions you cannot determine if the player has created the intended potion.

 

Is this correct?

 

Consider the following:

Using SKSE check if the "Crafting Menu" is open with IsMenuOpen. If "Crafting Menu" is open, check the items coming in to the player's inventory. If at the alchemy station, only potions should be coming in so filter out the incoming to only potions. On the incoming potion use GetNumEffects followed by GetNthMagicEffect then compare the potion's effects with the desired target effect of the potion type you want created. If one is successfully created, then the quest passes. If none matching are made by the time the player leaves the current cell, then fail the quest.

 

 

 

EDIT: pointed to IsInMenuMode instead of IsMenuOpen, corrected that.

Edited by IsharaMeradin
Link to comment
Share on other sites

 

Good lord, no, there should be no need for any of that. What exactly are you trying to do?

Its all in the first post:

 

 

I try to make a quest here to give the player some ingredients and make him craft a potion.

But I am ok with the current solution, if he crafts any potion it triggers to come back, if he walks too far away, the quest fails.

It chooses random between 9 different potions and gives him the needed ingredients to make one.

 

 

That is not a detailed description of what you want to do. Which ingredients? Which potion?

 

If you are OK with your implementation then I guess that is that, but you made it sound like you were making do because you were still complaining ("Alchemy is really bad!") I thought maybe I could help you achieve the effect you originally wanted, but obviously if you are not willing to tell me what that is then I can't help you.

Edited by lofgren
Link to comment
Share on other sites

Sorry, I didn't mean to be rude. I spent hours over hours to come up with something that works posted here with a video that shows what happens in the game.

 

It is really just a minor task, but I do not want the player to craft any evil poisons or destruction stuff. It should be restoration related only.

 

In its current state there is also not much exploitation, the ingredients are minor and not much worth if sold. If he walks too far away, they are removed from the inventory and the quest fails. The only really beneficial option for the player is to craft the actual potion at an alchemist table nearby. If he somehow eats the ingredient or use it to craft the wrong stuff, he can still walk away and try some other day again. :D

 

I didn't try to compare the magic effect on every item added to the inventory, but tried to filter for items with a certain magic effect that didn't work. Your option could work, but it says on the wiki you should not have wildcard event filters for adding or removing from the inventory (the remove inventory for the ingredients does not work either, they are consumed at the alchemist table). Does the magnitude of the effect would make it not match again (this increases with skill and gives a stronger effect again)?

 

The only part of my quest idea that does not work this way, I wanted to give the player a random answer like "nice potion!", potion is removed from the inventory or "keep it, you may need it!", potion remains with the player. Without knowing what he crafted, I cannot remove it.

Link to comment
Share on other sites

 

 

The only part of my quest idea that does not work this way, I wanted to give the player a random answer like "nice potion!", potion is removed from the inventory or "keep it, you may need it!", potion remains with the player. Without knowing what he crafted, I cannot remove it.

 

I have tested the following, tho I don't have the dialogue setup that you want to use. Feel free to adapt to your needs

 

trace statements were for proof that it was working as intended, you can remove them if desired.

ScriptName __GetPotionEffectFromPlayerCrafted Extends ReferenceAlias

FormList Property __DesiredEffects Auto
GlobalVariable Property __TellToKeep Auto

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
	If UI.IsMenuOpen("Crafting Menu") 	;we are using a crafting station
		If akBaseItem as Potion	;We are getting a potion 9 times out of 10 this means alchemy workshop
			Int numFX = (akBaseItem as Potion).GetNumEffects() - 1
			Bool keepItem = true
			While numFX >= 0
				MagicEffect currentFX = (akBaseItem as Potion).GetNthEffectMagicEffect(numFX)
				If __DesiredEffects.HasForm(currentFX)
					Debug.Trace("This item has a beneficial effect at index: "+numFX)
				Else
					Debug.Trace("This item has an undesired effect at index: "+numFX)
					;this item is no good we don't want it even if it does have a desired effect.
					keepItem = false
					numFX = -1
					Return
				EndIf
				numFX -= 1
			EndWhile
			If keepItem == true
				;potion is beneficial so we want to take it from player cause our NPC wants it
				__TellToKeep.SetValue(0.0)	;0.0 = we take, use this var in dialog check
			Else
				;potion has undesired effects so tell player they can keep it
				__TellToKeep.SetValue(1.0)	;1.0 = tell player to keep, use this var in dialog check
			EndIf
		EndIf
	EndIf
EndEvent 

Knowing what effects you put into what index of the formlist you can run through the list after you know that the effect is on the list and thus pinpoint the exact effect and perform actions accordingly.

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...