Jump to content

[LE] How to apply a poison to a weapon from script


irswat

Recommended Posts

I'm trying to figure out a way to apply a poison in the players inventory to the currently equipped weapon by means of a script. I was thinking I could do something like"

bool PoisonousPotion=PotionForm.IsPoison()
MagicEffect PoisonousEffect
int numEffects=PotionForm.GetNumEffects
int i=0

if PoisonousPotion==true
	while(i<numEffects)
		PoisonousEffect=GetNthEffectMagicEffect(i)
		;IS applied to a weapon?
		;what weapon is equipped?
		;if PoisonousEffect is applied to a weapon
		;WHAT COMMAND DO I USE TO APPLY POISONOUS EFFECT TO A WEAPON?
		i+=1
	endWhile
endif

But I'm unsure what function I could possibly use to SetMagicEffect to a weapon. There is a SetEnchanment function for weapons, but no SetMagicEffect. Also wondering if there is a function that returns whether a potion is applied to a weapon or not.

Link to comment
Share on other sites

Here is the relevant code:

SearchType="Potion"
					;need to add support for poisons
					form FormThatMatches=ExEquipItem(ItemNameLength, SearchType)
					debug.notification("Using potion " + FormThatMatches.GetName())
					debug.trace("Using potion " + FormThatMatches.GetName())
					
					if (FormThatMatches as Potion).IsPoison()
						if PlayerRef.GetItemCount(FormThatMatches as Potion)>0
							PlayerRef.EquipItem(FormThatMatches as Potion, false, false)
						endif
					endif
					
					if !(FormThatMatches as Potion).IsPoison()
						if PlayerRef.GetItemCount(FormThatMatches)>0
							PlayerRef.EquipItem(FormThatMatches, false, false)
						endif
					endif
Link to comment
Share on other sites

  • 4 months later...
  • Recently Browsing   0 members

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