Ares1 Posted March 2, 2012 Share Posted March 2, 2012 Hi I'm trying to make a script that will check the player for a certain amount of items then take those items and give the player another item in exchange... only issue I can't seem to get the script to work entirely it will only display the if statements message for when you don't have the required items, not exactly sure why as the script compiles fine and is pretty sraight forward. I do have the variables I have here linked to the actual items in the properties of the script too if that helps. Scriptname CrownStatueScript extends ObjectReference Armor Property helm auto MiscObject Property IngotGold auto MiscObject Property GemGarnet auto Event OnActivate(ObjectReference akActionRef) if (Game.GetPlayer().GetItemCount(IngotGold) == 2 && Game.GetPlayer().GetItemCount(GemGarnet) == 24) Game.GetPlayer().addItem(helm, 1) Game.GetPlayer().removeItem(IngotGold, 2) Game.GetPlayer().removeItem(GemGarnet, 24) Debug.MessageBox("You successfully make a replica of the helm.") endif if (Game.GetPlayer().GetItemCount(IngotGold) < 2 && Game.GetPlayer().GetItemCount(GemGarnet) < 24) Debug.MessageBox("You Lack Required Items, need 2 gold bars and 24 Garnet to replicate the helm.") endif EndEvent I word wrapped it a little to make it easier to read Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
dmjay Posted March 2, 2012 Share Posted March 2, 2012 It looks like you need exactly 2 ingots and 24 gems for your script to work. Maybe an >= instead of == ? Link to comment Share on other sites More sharing options...
Ares1 Posted March 2, 2012 Author Share Posted March 2, 2012 (edited) was thinking the same thing right as I was coming here haha thank you I'm checking that now... it's always the little things in code that get you ^.^ *edit* hmm it still doesn't work odd Edited March 2, 2012 by Ares1 Link to comment Share on other sites More sharing options...
dmjay Posted March 2, 2012 Share Posted March 2, 2012 It also looks like your message for not enough ingredients only fires when your missing both the garnets and the gold. I copied the talos shrine and put the following script on it. This seems to work. I linked the gold, garnet, and some random armor bit to the properties. Scriptname KonrikMerge extends ObjectReference Armor Property helm auto MiscObject Property IngotGold auto MiscObject Property GemGarnet auto Event OnActivate(ObjectReference akActionRef) if (Game.GetPlayer().GetItemCount(IngotGold) >= 2 && Game.GetPlayer().GetItemCount(GemGarnet) >= 24) Game.GetPlayer().addItem(helm, 1) Game.GetPlayer().removeItem(IngotGold, 2) Game.GetPlayer().removeItem(GemGarnet, 24) Debug.MessageBox("You successfully make a replica of the helm.") endif ;player has enough gold, but not garnets if (Game.GetPlayer().GetItemCount(IngotGold) >= 2 && Game.GetPlayer().GetItemCount(GemGarnet) < 24) Debug.MessageBox("You have enough Gold, but need more Garnets") endif ;player has enough garnets, but not gold if (Game.GetPlayer().GetItemCount(IngotGold) < 2 && Game.GetPlayer().GetItemCount(GemGarnet) >=24) Debug.MessageBox("You have enough Garnets, but need more Gold") endif if (Game.GetPlayer().GetItemCount(IngotGold) < 2 && Game.GetPlayer().GetItemCount(GemGarnet) < 24) Debug.MessageBox("You Lack Required Items, need 2 gold bars and 24 Garnet to replicate the helm.") endif EndEvent Link to comment Share on other sites More sharing options...
Ares1 Posted March 2, 2012 Author Share Posted March 2, 2012 hmm still not working for me even if i have the ingots and gems it says i don't have either.. tried all the if statements and in every situation i get the "you need both message" here's my current code to date: Scriptname CrownStatueScript extends ObjectReference Armor Property aaaBarenziahscrown auto MiscObject Property IngotGold auto MiscObject Property GemGarnet auto Event OnActivate(ObjectReference akActionRef) if ((Game.GetPlayer().GetItemCount(IngotGold) >= 2) && (Game.GetPlayer().GetItemCount(GemGarnet) >= 24)) Game.GetPlayer().addItem(aaaBarenziahscrown, 1) Game.GetPlayer().removeItem(IngotGold, 2) Game.GetPlayer().removeItem(GemGarnet, 24) Debug.MessageBox("You successfully make a replica of the crown.") endif if (Game.GetPlayer().GetItemCount(IngotGold) >= 2 && Game.GetPlayer().GetItemCount(GemGarnet) < 24) Debug.MessageBox("You have enough Gold, but need more Garnets") endif if (Game.GetPlayer().GetItemCount(IngotGold) < 2 && Game.GetPlayer().GetItemCount(GemGarnet) >=24) Debug.MessageBox("You have enough Garnets, but need more Gold") endif if ((Game.GetPlayer().GetItemCount(IngotGold) < 2) && (Game.GetPlayer().GetItemCount(GemGarnet) < 24)) Debug.MessageBox("You Lack Required Items, need 2 gold bars and 24 Garnet to replicate the crown.") endif EndEvent Link to comment Share on other sites More sharing options...
dmjay Posted March 3, 2012 Share Posted March 3, 2012 Do you have different versions of this code in multiple addons? The last one loaded will be the one that is used. Scriptname CrownStatueScript extends ObjectReference Armor Property aaaBarenziahscrown auto MiscObject Property IngotGold auto MiscObject Property GemGarnet auto Event OnActivate(ObjectReference akActionRef) Game.GetPlayer().addItem(aaaBarenziahscrown, 1) Game.GetPlayer().removeItem(IngotGold, 2) Game.GetPlayer().removeItem(GemGarnet, 24) Debug.MessageBox("You successfully make a replica of the crown.") EndEvent Or maybe the item your linking to to give to the player isn't really an item? I had problems with a fork once. It didn't have a description so probably wasn't a real object. Your code looks good to me though! I think it may need to be like this eventually. Scriptname CrownStatueScript extends ObjectReference Armor Property aaaBarenziahscrown auto MiscObject Property IngotGold auto MiscObject Property GemGarnet auto Event OnActivate(ObjectReference akActionRef) if ((Game.GetPlayer().GetItemCount(IngotGold) >= 2) && (Game.GetPlayer().GetItemCount(GemGarnet) >= 24)) Game.GetPlayer().addItem(aaaBarenziahscrown, 1) Game.GetPlayer().removeItem(IngotGold, 2) Game.GetPlayer().removeItem(GemGarnet, 24) Debug.MessageBox("You successfully make a replica of the crown.") else ;do not show not enough messages if we just made an item. if (Game.GetPlayer().GetItemCount(IngotGold) >= 2 && Game.GetPlayer().GetItemCount(GemGarnet) < 24) Debug.MessageBox("You have enough Gold, but need more Garnets") endif if (Game.GetPlayer().GetItemCount(IngotGold) < 2 && Game.GetPlayer().GetItemCount(GemGarnet) >=24) Debug.MessageBox("You have enough Garnets, but need more Gold") endif if ((Game.GetPlayer().GetItemCount(IngotGold) < 2) && (Game.GetPlayer().GetItemCount(GemGarnet) < 24)) Debug.MessageBox("You Lack Required Items, need 2 gold bars and 24 Garnet to replicate the crown.") endif endif EndEvent Link to comment Share on other sites More sharing options...
Ares1 Posted March 3, 2012 Author Share Posted March 3, 2012 ok I think I know the issue... I took out the if statements where it detects if you don't have the items but when i loaded the game it still gave me the dialog that I don't have enough so it has to be using a different script version... any way to get it updated? Link to comment Share on other sites More sharing options...
dmjay Posted March 3, 2012 Share Posted March 3, 2012 If you are using an external editor for the scripts then you need to remember to compile the script manually. I just edit the script from the object it's attached to in order to get around that. And make sure you don't have 2 copies of your mod activated! I've done that too. Only the last one in the load order takes precedence. Link to comment Share on other sites More sharing options...
Ares1 Posted March 3, 2012 Author Share Posted March 3, 2012 ok now its working I'll just have to edit the script a bit as it will display multiple you dont have enough of blah messages if multiple conditions are met (once I made the crown i got all other 3 messages)... Thank you for your help! ended up making a whole new script file and pasting the code into it... now one last question, if I package this mod together do I need to include the script file in the zip? Link to comment Share on other sites More sharing options...
dmjay Posted March 3, 2012 Share Posted March 3, 2012 I think you do. If you go to the file menu and create archive it will put all the scripts and stuff you need into a file names "modname.bsa". Then I think you just need to give them both out. I haven't pushed out many mods, but I think that's how it goes. Link to comment Share on other sites More sharing options...
Recommended Posts