Help me with a Script Please

Post » Mon Nov 19, 2012 11:19 am

Hello
I have allready started with a script and I need to add one more command, Dont know how :confused:
how the script should work is :

Player Cast the Spell
If Player Has any item form the form list in his inventory
open Gift Menu
Player Select Item from the list
Remove Selected Item from inventory
Add Item to Player Inventory
Else
Show Message.

Here is My Script
Spoiler
Scriptname GP_DisenchantScript extends ActiveMagicEffect  FormList Property GP_FormList  Auto  WEAPON Property EnchIronMaceFire01  Auto  WEAPON Property EnchIronMaceFire02  Auto  Sound Property FailureSFX  Auto  EVENT OnEffectStart(Actor akTarget, Actor akCaster)Actor Player = Game.GetPlayer()	objectReference caster = akCaster	if caster.getItemCount(GP_FormList) >= 1		Player.ShowGiftMenu(true, GP_FormList)		{"Whats the codes for this command below ????"}                {If Player select (EnchIronMaceFire01) from his Gift Menu, Do this Below.}                 		                ;caster.removeItem(EnchIronMaceFire01, 1, TRUE)		;caster.addItem(Something, 1, FALSE)	else		FailureSFX.play(caster)		Debug.Notification("You Don't Have Any Magic Item To Disenchant")	endifEndEvent
User avatar
C.L.U.T.C.H
 
Posts: 3385
Joined: Tue Aug 14, 2007 6:23 pm

Post » Mon Nov 19, 2012 10:41 am

For starters:
  • You can do entirely without the GetPlayer line using a property instead.
  • akCaster already exists. Why bother with the caster ObjectReference var?
  • The '>= 1' for GetItemCount is extraneous.
  • AddItem's abSilent is False by default, so it doesn't have to be mandated like is necessary for the non-default True like in the RemoveItem line (which shouldn't be necessary if the item is removed via the menu).

Spoiler
ScriptName GP_DisenchantScript Extends ActiveMagicEffectActor Property PlayerREF AutoFormList Property GP_FormList Auto  Weapon Property EnchIronMaceFire01 Auto  Weapon Property EnchIronMaceFire02 Auto  Sound Property FailureSFX Auto  Event OnEffectStart(Actor akTarget, Actor akCaster)	If akCaster.GetItemCount(GP_FormList)		Int iEnchIronMaceFire01Count = PlayerREF.GetItemCount(EnchIronMaceFire01)		PlayerREF.ShowGiftMenu(True, GP_FormList)		Utility.Wait(0.1) ; <--- This might not be necessary/effective		If PlayerREF.GetItemCount(EnchIronMaceFire01) != iEnchIronMaceFire01Count			;akCaster.RemoveItem(EnchIronMaceFire01, 1, True)			akCaster.AddItem(EnchIronMaceFire02, 1)		EndIf	Else		FailureSFX.Play(akCaster)		Debug.Notification("You don't have a magic item to disenchant.")	EndIfEndEvent
Not sure about the gift menu, however, the above approach might work. I've not used the gift menu yet... If it doesn't work, you could catch removed items with an OnItemRemoved even on a player alias.
User avatar
sarah taylor
 
Posts: 3490
Joined: Thu Nov 16, 2006 3:36 pm

Post » Mon Nov 19, 2012 12:54 pm

its not doing anything Justin. Same as before.
when the Gift Menu opens, i want to click on the item to disenchant it.
let me explain it again to you how i want the spell to work:

Player Cast Spell
If Player Has any item form the form list in his inventory,
open Gift Menu
I dont want an auto command, or auto Disenchant. Left Click on an Item in the Gift Menu in order to run the next command is a must !
so after Player Select the item from the list,
Remove Selected Item from inventory
Add another Item to Player Inventory
Else ?
Show Message.
User avatar
James Potter
 
Posts: 3418
Joined: Sat Jul 07, 2007 11:40 am

Post » Mon Nov 19, 2012 12:52 pm

Can we do make a script like this ?
if player left click on EnchIronMaceFire01 for example
BoxMessage.Show()
Box message will say :
Disenchant EnchIronMaceFire01 ?

Yes No

If Yes
akCaster.RemoveItem(EnchIronMaceFire01, 1, True)
akCaster.AddItem(EnchIronMaceFire02, 1)

if no
exit
User avatar
Laura Hicks
 
Posts: 3395
Joined: Wed Jun 06, 2007 9:21 am

Post » Mon Nov 19, 2012 12:09 pm

There's not currently a way to detect which item is being moused over, I don't think. Perhaps an SKSE function could be devised, something like http://cs.elderscrolls.com/index.php/GetActiveMenuSelection.
User avatar
Jack Walker
 
Posts: 3457
Joined: Wed Jun 06, 2007 6:25 pm

Post » Mon Nov 19, 2012 8:59 am

Yep. thats what we need. i do have skse installed though.
User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm


Return to V - Skyrim