Jump to content

Need someone to script something for me.


Nightshadow697

Recommended Posts

I am making a mod that adds trading cards to the game, and the way you get the cards is by opening packs. The packs will go in the Misc section, and I have 0 scripting experience. All I need is a simple popup menu that says, "would you like to open this pack?" and with "yes" and "no" and the options. When you click yes, you get 10 cards. 7 of the 10 will either be common or uncommon. 2 of the 10 will be guaranteed rares, and the last one will either be rare, mythic, or legendary. If anyone can help me with this, I will be extremely grateful and will give you credit. If you are interested, PM me.

Link to comment
Share on other sites

Not sure you can do that with script. You can write a script to react to an item being equipped or used, but Misc items don't support either and there's no event like OnSelectedInMenu.

You can do all of those things with a script. Misc objects support both Onequip and Onactivate events, and there is a menu function that returns which button the player selects.

Edited by lofgren
Link to comment
Share on other sites

 

Not sure you can do that with script. You can write a script to react to an item being equipped or used, but Misc items don't support either and there's no event like OnSelectedInMenu.

You can do all of those things with a script. Misc objects support both Onequip and Onactivate events, and there is a menu function that returns which button the player selects.
All ObjectReferences support the events, yes, but do misc items ever fire them? I don't think there's any situation where you can equip a misc item or consume it from the menu. (OnActivate fires when you activate an item in world, and won't help the OP with what they're looking for.)

 

You can show a menu and detect what the user picks, yes, but I don't think you can query the status of the inventory window -- certainly not in enough detail to hack in a "use" option on misc items.

Link to comment
Share on other sites

 

 

Not sure you can do that with script. You can write a script to react to an item being equipped or used, but Misc items don't support either and there's no event like OnSelectedInMenu.

You can do all of those things with a script. Misc objects support both Onequip and Onactivate events, and there is a menu function that returns which button the player selects.
All ObjectReferences support the events, yes, but do misc items ever fire them? I don't think there's any situation where you can equip a misc item or consume it from the menu. (OnActivate fires when you activate an item in world, and won't help the OP with what they're looking for.)

 

You can show a menu and detect what the user picks, yes, but I don't think you can query the status of the inventory window -- certainly not in enough detail to hack in a "use" option on misc items.

 

The mod "Field Alchemy" has a Mortar and Pestle item in the Misc section that acts as an alchemy station, just by using it. because of this I am sure this can be done

Link to comment
Share on other sites

Yes, despite the warning notification you get about not being able to equip misc. items they do fire an OnEquipped event if you try.

 

The script is easy enough.

ScriptName TradingCardPackScript extends ObjectReference
{Converts an unopened pack of cards into 10 random cards of appropriate levels.}

Event OnEquipped(Actor akActor)
	if akActor == Game.GetPlayer()
		if TCPackOpenConfirmMsg.Show() == 0 ; Yes is button 0
			akActor.RemoveItem(TCPackUnopenedPack)
			akActor.AddItem(TCPackRandomSetOfCardsLI)
		endif
	endif
EndEvent

Message Property TCPackOpenConfirmMsg Auto
{Prompt for opening the pack with two buttons Yes (0) and No (1)}

LeveledItem Property TCPackRandomSetOfCardsLI Auto
{A list that provides for picking 10 cards.}

MiscObject Property TCPackUnopenedPack Auto
{The base form of an unopened pack of cards.}

In addition to the actual MiscObject representing the unopened pack of cards, you'll need a Message object set up as a message box and a set of leveled item lists. If you haven't already, you should create leveled item lists for each of the levels of cards, then you can create selection lists that pick particular types and finally a main list to select the 10 cards of appropriate levels. The script is just the glue that links the three together. Attach it to the MiscObject in the CK and fill the three properties.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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