Jump to content
⚠ Known Issue: Media on User Profiles ×

Percent chance of giving different weapon when smelting


MinusGix

Recommended Posts

I have a melted Ebony dagger that I have made, and you craft it with A ebony dagger and fire salts, Basically its a bad weapon, but I want to make so that theres a 30% chance of it able to give you fire resistance, and fire damage, I can do th fire resist and fire damage but i have no idea on how to make a 30% chance.

Link to comment
Share on other sites

You can not do that with the crafting recipes. What you will have to do is have a specific object made and a script on the player alias. The script would catch the incoming item and make a random integer selection. The value obtained determines the object given in replacement of the crafted placeholder.

Link to comment
Share on other sites

You can not do that with the crafting recipes. What you will have to do is have a specific object made and a script on the player alias. The script would catch the incoming item and make a random integer selection. The value obtained determines the object given in replacement of the crafted placeholder.

Good thing, I dont know how to script XD. Ok, time to learn XD.

Link to comment
Share on other sites

To give you a head start (i.e. something to look at as you learn what you need to do)

 

The following script compiles. It has not been tested to see if it actually works. It uses a random float between and including 0.0 and 1.0 instead of a random integer. Random values at or below .7 (70%) leave you with the "dud" weapon (the "dud" weapon is the one crafted by the recipe). Random values above .7 takes the "dud" weapon away and gives you the "decent" weapon.

 

It would be assigned to a player alias. (see sub-section Set Up a Reference Alias). It can be either a start game enabled quest or one that you start and leave running for as long as you want this process to be available.

 

 

ScriptName DudOrDecentWeapon Extends ReferenceAlias

Weapon Property DudWeapon 	Auto 	;this is the weapon created by the crafting recipe
Weapon Property DecentWeapon 	Auto 	;this is the weapon that has the fire resistance and fire damage

Event OnInit()
	AddInventoryEventFilter(DudWeapon)
EndEvent

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
	If akBaseItem == DudWeapon
		If Utility.RandomFloat(0.0,1.0) > 0.7
			Self.GetReference().RemoveItem(DudWeapon,1,true)	;the true makes it so that there is no notification of removal
			Self.GetReference().AddItem(DecentWeapon,1,true)	;the true makes it so that there is no notification of adding
		EndIf
	EndIf
EndEvent 

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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