Rizalgar Posted May 24, 2019 Share Posted May 24, 2019 Okay, here's the breakdown... Cast Alchemy SpellReceive Alchemy AbilityGo into inventoryChoose item to Alch for goldMessageBox pops up for confirmationYes to alch, no closes menu Here's the problem After the first alch, the MessageBox no longer pops up, until you drop the item and pick it back up. Here's the scripts. Low Alch script Scriptname RS_Spells_Alchemy extends ActiveMagicEffect {Script for alching items} GlobalVariable Property RS_GV_MagicLvl Auto GlobalVariable Property RS_GV_XPMultiplier Auto MiscObject Property RS_Item_Rune_Fire Auto MiscObject Property RS_Item_Rune_Nature Auto Spell Property RS_Ability_Alchemy Auto Spell Property RS_Ability_AlchemyHigh Auto MagicEffect Property RS_ME_Spell_Alch Auto MagicEffect Property RS_ME_Spell_AlchHigh Auto Actor Property PlayerRef Auto Int Property XP Auto Event OnEffectStart(Actor target, Actor caster) Float xpm = XP * RS_GV_XPMultiplier.GetValue() If PlayerRef.HasSpell(RS_Ability_Alchemy) PlayerRef.RemoveSpell(RS_Ability_Alchemy) If PlayerRef.HasMagicEffect(RS_ME_Spell_AlchHigh) PlayerRef.AddSpell(RS_Ability_AlchemyHigh) EndIf ElseIf PlayerRef.HasSpell(RS_Ability_AlchemyHigh) PlayerRef.RemoveSpell(RS_Ability_AlchemyHigh) If PlayerRef.HasMagicEffect(RS_ME_Spell_Alch) PlayerRef.AddSpell(RS_Ability_Alchemy) EndIf Else PlayerRef.AddSpell(RS_Ability_Alchemy) EndIf rsframeworkmenu.rsxpgain("magic", xpm) EndEvent High Alch script Scriptname RS_Spells_AlchemyHigh extends activemagiceffect {High alch script} GlobalVariable Property RS_GV_MagicLvl Auto GlobalVariable Property RS_GV_XPMultiplier Auto MiscObject Property RS_Item_Rune_Fire Auto MiscObject Property RS_Item_Rune_Nature Auto Spell Property RS_Ability_Alchemy Auto Spell Property RS_Ability_AlchemyHigh Auto MagicEffect Property RS_ME_Spell_Alch Auto MagicEffect Property RS_ME_Spell_AlchHigh Auto Actor Property PlayerRef Auto Int Property XP Auto Event OnEffectStart(Actor target, Actor caster) Float xpm = XP * RS_GV_XPMultiplier.GetValue() If PlayerRef.HasSpell(RS_Ability_Alchemy) PlayerRef.RemoveSpell(RS_Ability_Alchemy) If PlayerRef.HasMagicEffect(RS_ME_Spell_AlchHigh) PlayerRef.AddSpell(RS_Ability_AlchemyHigh) EndIf ElseIf PlayerRef.HasSpell(RS_Ability_AlchemyHigh) PlayerRef.RemoveSpell(RS_Ability_AlchemyHigh) If PlayerRef.HasMagicEffect(RS_ME_Spell_Alch) PlayerRef.AddSpell(RS_Ability_Alchemy) EndIf Else PlayerRef.AddSpell(RS_Ability_AlchemyHigh) EndIf rsframeworkmenu.rsxpgain("magic", xpm) EndEvent OnEquipped alchemy script Scriptname RS_AlchemyScript extends ObjectReference {Needed for alchemy} MagicEffect Property RS_ME_Ability_Alch Auto MagicEffect Property RS_ME_Ability_AlchHigh Auto Message Property RS_Message_Magic_Alchemy Auto FormList Property RS_FL_Alchemy Auto MiscObject Property Gold001 Auto Int Property LowAlch Auto Int Property HighAlch Auto MiscObject Property RS_Item_Rune_Fire Auto MiscObject Property RS_Item_Rune_Nature Auto Ammo Property ItemAmmo Auto Armor Property ItemArmor Auto Ingredient Property ItemIngred Auto MiscObject Property ItemMisc Auto Weapon Property ItemWeapon Auto GlobalVariable Property RS_GV_XPMultiplier Auto Actor PlayerRef Int a1 Function Exit() Game.DisablePlayerControls(false, false, false, false, false, true, false) Utility.Wait(0.1) Game.EnablePlayerControls(false, false, false, false, false, true, false) EndFunction Event OnEquipped(Actor me) Int LL = 31 Int HL = 65 Float XPL = LL * RS_GV_XPMultiplier.GetValue() Float XPH = HL * RS_GV_XPMultiplier.GetValue() If me == Game.GetPlayer() PlayerRef = Game.GetPlayer() Exit() a1 = RS_Message_Magic_Alchemy.Show() If a1 == 0 && Game.GetPlayer().HasMagicEffect(RS_ME_Ability_Alch) If PlayerRef.GetItemCount(RS_Item_Rune_Fire) < 3 && PlayerRef.GetItemCount(RS_Item_Rune_Nature) < 1 Debug.Notification("You lack the required runes to cast low level alchemy!") Else PlayerRef.RemoveItem(ItemAmmo, 1, true) PlayerRef.RemoveItem(ItemArmor, 1, true) PlayerRef.RemoveItem(ItemIngred, 1, true) PlayerRef.RemoveItem(ItemMisc, 1, true) PlayerRef.RemoveItem(ItemWeapon, 1, true) PlayerRef.RemoveItem(RS_Item_Rune_Fire, 3, true) PlayerRef.RemoveItem(RS_Item_Rune_Nature, 1, true) PlayerRef.AddItem(Gold001, LowAlch, true) rsframeworkmenu.rsxpgain("magic", LL) EndIf ElseIf a1 == 0 && Game.GetPlayer().HasMagicEffect(RS_ME_Ability_AlchHigh) If PlayerRef.GetItemCount(RS_Item_Rune_Fire) < 5 && PlayerRef.GetItemCount(RS_Item_Rune_Nature) < 1 Debug.Notification("You lack the required runes to cast low level alchemy!") Else PlayerRef.AddItem(Gold001, HighAlch, true) PlayerRef.RemoveItem(ItemAmmo, 1, true) PlayerRef.RemoveItem(ItemArmor, 1, true) PlayerRef.RemoveItem(ItemIngred, 1, true) PlayerRef.RemoveItem(ItemMisc, 1, true) PlayerRef.RemoveItem(ItemWeapon, 1, true) PlayerRef.RemoveItem(RS_Item_Rune_Fire, 3, true) PlayerRef.RemoveItem(RS_Item_Rune_Nature, 1, true) rsframeworkmenu.rsxpgain("magic", HL) EndIf EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 24, 2019 Share Posted May 24, 2019 Not part of your problem:You are using a local Actor variable called 'PlayerRef', an Actor event parameter variable called 'me' as well as Game.GetPlayer(). In this scenario you do not need the PlayerRef. Compare the parameter 'me' to Game.GetPlayer() and if true then use 'me' throughout the remainder of the event. Using a mix can get confusing as well as multiple calls to Game.GetPlayer() taking up processing time that is not needed. As for your issue:This is just guess work so take it with a grain of salt. Equip a particular object reference and that object reference cannot be equipped again without first being unequipped. If this object reference is such an object that receives the OnEquipped event but does not technically equip, the status of that object needs to be updated in order to be equipped again. Dropping and picking it up is one such way. Opening and closing the inventory should also work. That said, you could always try unequipping the object anyway via script even if it is not an actual equippable object. Link to comment Share on other sites More sharing options...
Rizalgar Posted May 25, 2019 Author Share Posted May 25, 2019 (edited) Ah, yes, yes of course. I have tried closing the menu, but to no avail. I'll see if I throw in a force unequip bit in the script if that fixes the issue. Edit --- Yes! Throwing an UnequipItem before RemoveItem did the trick. Thank you, Ishara :) Edited May 25, 2019 by Rizalgar Link to comment Share on other sites More sharing options...
Recommended Posts