Nephenee13 Posted March 28, 2013 Share Posted March 28, 2013 Alright, I'm adding a leveled item to the game, and I want it to update as the player advances in level. I figured the simplest way to do this would be to put a script on each version, so that when the player equips it, it checks the player's level. If the player has advanced to the next level tier, it will remove the current one and re-add the leveled list, so the player gets the appropriate one for their level. Additionally, whether the player received the Light or Heavy version depended on their level in those skills, and I want them to get the appropriate version if they've decided to pursue the other skill. Anyway, my code isn't working. Scriptname NephRoseKvatchHeavy01Script begin OnEquip player if player.getlevel > 4 player.removeitem NephRoseKvatchHeavy01 1 if player.getav LightArmor > player.getav HeavyArmor player.EquipItem NephRoseofKvatchLightList 1 else player.EquipItem NephRoseofKvatchHeavyList 1 endif endif endHowever...it doesn't work. It doesn't even remove the item properly. It doesn't seem to do anything. Link to comment Share on other sites More sharing options...
Nephenee13 Posted March 28, 2013 Author Share Posted March 28, 2013 Ok, it seems I can't use an OnEquip block, so here's my shot at a GameMode block Scriptname NephRoseKvatchHeavy01Script Short DoOnce begin GameMode if DoOnce == 0 if player.GetLevel &--#62; 4 Player.RemoveItem NephRoseKvatchHeavy01 1 if Player.GetAV LightArmor &--#62; Player.GetAV HeavyArmor Player.AddItem NephRoseofKvatchLightList 1 else Player.AddItem NephRoseofKvatchHeavyList 1 endif endif Set DoOnce to 1 endif end Still not working. Link to comment Share on other sites More sharing options...
KenJackson Posted March 28, 2013 Share Posted March 28, 2013 (edited) Let me get this straight. You're trying to remove an item via a script that is attached to that item? Again, my experience is Morrowind, so Oblivion may work differently, but in Morrowind, you need the item to be available to run the script on. Remove the item, you remove the script. Again, in Morrowind, this would crash the game as it is trying to access a script that is no longer there. You may need to start a "quest" which would run a script for the actual swap. Once the swap is done, you simply stop the quest. Edited March 28, 2013 by KenJackson Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted March 28, 2013 Share Posted March 28, 2013 Yes, KenJackson is right on this. While it certainly won't 'crash' Oblivion (it actually could, as the game is very touchy and always unpredictable even), removing the item the script is running on will terminate the script at the point of the removal. So you at least have to reorder things a little for this to ever have a chance to work: Scriptname NephRoseKvatchHeavy01Script begin OnEquip player if player.getlevel > 4 if player.getav LightArmor > player.getav HeavyArmor player.AddItem NephRoseofKvatchLightList 1 player.EquipItem NephRoseofKvatchLightList else player.AddItem NephRoseofKvatchHeavyList 1 player.EquipItem NephRoseofKvatchHeavyList endif endif removeMe ;should do here. if not, use your line instead. could be requiring OBSE in any case. endI'm not exactly sure you can 'equip' a 'list' though.Dusk/Dawnfang wasn't scripted with every instance of its advancement hardcoded into the script for no reason. Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted March 28, 2013 Share Posted March 28, 2013 Uah! Man, it's making a total mess of my code, if I try to edit it now! By all means, the "removeMe" line must not be outside of the "if" block! It will remove itself every time you equip it! Ahem. And coming to think of it, it will do so still even if it is placed correctly. You need to add some "do once" condition into this for sure, as the player's level will remain > 4 for quite a while and as such the script will run every time you equip this item again and again! Link to comment Share on other sites More sharing options...
KenJackson Posted March 29, 2013 Share Posted March 29, 2013 Might it be possible just to have a script on the item that assigns the desired changes to the item based on the character's level? Of course that would prevent it from switching between heavy and light armors, though. Link to comment Share on other sites More sharing options...
DKZZ2 Posted May 10, 2013 Share Posted May 10, 2013 (edited) .esp - How it http://www.sendspace.com/file/z2vgju Two scripts on the objects can not work simultaneously.This is easier to do as a quest script Scriptname NephRoseKvatchHeavy01ScriptShort DoOnceShort DoOnce2short ic;MUST BE QUEST SCRIPTTTTT;You can add control variables for the quest script into clothing scripts;Exmp. - Begin OnEquip; NameQuest.DoOnce to 0 ;; to start controll this clothbegin GameMode if DoOnce == 0 ; with Begin OnEquip controll must be not 0 if player.GetLevel >0 ;>4, for test >0 if Player.GetAV HeavyArmor< Player.GetAV LightArmor set ic to Player.getitemcount JailShirt ;NephRoseKvatchHeavy01 1;+it must be CALLfunc of course if ic>0 ;+ Player.removeitem JailShirt ic ;+NephRoseKvatchHeavy01 1 endif ;+ Player.AddItem JailShirt 1 ;NephRoseKvatchHeavy01 1 Set DoOnce to 1 ;!!!!!!!!!! added else set ic to Player.getitemcount JailPants ;NephRoseofKvatchLightList 1 if ic>0 Player.removeitem JailPants ic ;NephRoseofKvatchLightList 1 endif Player.AddItem JailPants 1 ;NephRoseofKvatchLightList 1 Set DoOnce to 1 ;!!!!!!!!!! added endif endif endif;========================; if DoOnce2 == 0 ; with Begin OnEquip controll must be not 0; ; if player.GetLevel >0 ;>4, for test >0; ; if Player.GetAV HeavyArmor> Player.GetAV LightArmor; set ic to Player.getitemcount JailShirt2 ;NephRoseKvatchHeavy02 1;+it must be CALLfunc of course; if ic>0 ;+ ; Player.removeitem JailShirt2 ic ;+NephRoseKvatchHeavy02 1; endif ;+ ; Player.AddItem JailShirt 1 ;NephRoseKvatchHeavy02 1; Set DoOnce to 1 ;!!!!!!!!!! added;;.........................etc end Edited May 10, 2013 by DKZZ2 Link to comment Share on other sites More sharing options...
kastano Posted May 11, 2013 Share Posted May 11, 2013 (edited) if you use OBSE is easier to get rid of the oldrosequirass and add the new (but still no equip)example without Quest-------------------------------------------------------------- Reveal hidden contents Scriptname NephRoseKvatchHeavy01Script ;---better NephRoseKvatchLevel01Scriptref oldroseref freshRoseshort runonlybegin OnEquip ;playerif player.getlevel > 4 ;change numbers according to levelset oldrose to player.GetEquippedObject 2 ;2=upperbodyif player.getav LightArmor > player.getav HeavyArmorset freshRose to NephRoseofKvatchLightListelseset freshRose to NephRoseofKvatchHeavyListendifset runonly to 1player.UnequipItem oldroseendifendbegin OnunEquip ;playerif runonly == 1player.additem freshRose 1; player.equipItem freshRose ;this dont workremoveMe ;this is gonna freeze the game to about 3-5 seconds(i hope it want crash)endifend =============================================================example with quest---------------------------- Reveal hidden contents Scriptname NephRoseKvatchScriptref freshRoseshort neednewdressBegin gamemodeif neednewdress == 1set neednewdress to 0set freshRose to player.GetEquippedObject 2player.removeitem freshRose 1if player.getav LightArmor < player.getav HeavyArmorset freshRose to NephRoseofKvatchHeavyListelseset freshRose to NephRoseofKvatchLightListendifplayer.additem freshRose 1; Player.EquipItem freshRose ;want run anywayendifend-------------------------and in the clothesScriptname NephRoseKvatchCuirassLevel02Scriptbegin OnEquip ;playerif player.getlevel > 4set NAmeofQuest.neednewdress to 1endifend------------------------------------------------------Scriptname NephRoseKvatchCuirassLevel03Scriptbegin OnEquip ;playerif player.getlevel > 8set NAmeofQuest.neednewdress to 1endifend Edited May 12, 2013 by kastano Link to comment Share on other sites More sharing options...
kastano Posted May 16, 2013 Share Posted May 16, 2013 On 5/11/2013 at 5:04 PM, kastano said: if you use OBSE is easier to get rid of the oldrosequirass and add the new (but still no equip)example without Quest-------------------------------------------------------------- Reveal hidden contents Scriptname NephRoseKvatchHeavy01Script ;---better NephRoseKvatchLevel01Script ref oldroseref freshRoseshort runonly begin OnEquip ;playerif player.getlevel > 4 ;change numbers according to levelset oldrose to player.GetEquippedObject 2 ;2=upperbody if player.getav LightArmor > player.getav HeavyArmorset freshRose to NephRoseofKvatchLightListelseset freshRose to NephRoseofKvatchHeavyListendif set runonly to 1 player.UnequipItem oldroseendifend begin OnunEquip ;player if runonly == 1player.additem freshRose 1; player.equipItem freshRose ;this dont workremoveMe ;this is gonna freeze the game to about 3-5 seconds(i hope it want crash)endif end =============================================================example with quest---------------------------- Reveal hidden contents Scriptname NephRoseKvatchScript ref freshRoseshort neednewdress Begin gamemode if neednewdress == 1set neednewdress to 0set freshRose to player.GetEquippedObject 2player.removeitem freshRose 1 if player.getav LightArmor < player.getav HeavyArmor set freshRose to NephRoseofKvatchHeavyListelseset freshRose to NephRoseofKvatchLightListendif player.additem freshRose 1; Player.EquipItem freshRose ;want run anyway endif end------------------------- and in the clothes Scriptname NephRoseKvatchCuirassLevel02Script begin OnEquip ;player if player.getlevel > 4set NAmeofQuest.neednewdress to 1 endifend ------------------------------------------------------ Scriptname NephRoseKvatchCuirassLevel03Script begin OnEquip ;player if player.getlevel > 8set NAmeofQuest.neednewdress to 1 endifend i found sth on nexus ,i think it works(for equip) Scriptname NephRoseKvatchScript ref pinvobjref pcontref freshRoseshort neednewdressshort invpos Begin gamemode if neednewdress == 1 set neednewdress to 0 set freshRose to player.GetEquippedObject 2 player.removeitem freshRose 1 if player.getav LightArmor < player.getav HeavyArmor set freshRose to NephRoseofKvatchHeavyList else set freshRose to NephRoseofKvatchLightList endif player.additem freshRose 1 set pCont to Player;Sets the inventory ref to the player set InvPos to pCont.GetNumItems;sets the position of the checker to the last item spot in the inventory if InvPos set InvPos to (InvPos - 1) set pInvObj to (pCont.GetInventoryObject InvPos) Player.EquipItem pinvobj endif endif end Link to comment Share on other sites More sharing options...
Nephenee13 Posted May 16, 2013 Author Share Posted May 16, 2013 Ah, I'm trying to avoid making this OBSE dependent. Link to comment Share on other sites More sharing options...
Recommended Posts