KDStudios Posted July 12, 2011 Author Share Posted July 12, 2011 I've tried adding it and adjusting the script but for some reason nothing happens now after I press More :/ Cipscis and geck don't come up with any errors though :/ Reveal hidden contents scn 0MCSCraftingBenchScript short HasItems short Button int iAlternateMessage short item1 short item2 short item3 short item4 float weaponCondition int iHealth int iStage float fTimer Begin OnHit if ( iHealth == 2 ) Player.AddItem 0MCBlockCraftingBench 1 Disable MarkForDelete else Set fTimer to 2 Set iStage to 1 Set iHealth to iHealth + 1 endif End Begin GameMode if ( fTimer > 0 ) Set fTimer to fTimer - GetSecondsPassed elseif ( iStage == 1 ) Set iStage to 0 Set fTimer to 0 Set iHealth to 0 endif End Begin OnActivate if IsActionRef player == 1 set HasItems to 0 if GetHasNote 0SchTNTMineNote == 1 set HasItems to 1 endif if HasItems == 1 ShowMessage 0SchCraftingbenchMsg else ShowMessage 0SchCraftingbenchNoneMsg endif endif End Begin GameMode set Button to GetButtonPressed if ( Button >0 ) set weaponcondition to (player.getav Repair)/100 elseif iAlternateMessage == 0 if button == 1 if ( player.GetItemCount LunchBox > 0 ) && ( player.GetItemCount CherryBomb > 0 ) && ( player.GetItemCount Caps001 >= 20 ) ShowMessage 0SchCraftingbenchSuccessTNTBlockMsg player.RemoveItem LunchBox 1 1 player.RemoveItem CherryBomb 1 1 player.RemoveItem Caps001 20 1 player.AddItemHealthPercent 0WeapMineTNTBlock 1 100 PlaySound UIRepairWeapon endif elseif button == 2 if ( player.GetItemCount 0MCStick > 1 ) && ( player.GetItemCount 0MCBarIron > 2 ) ShowMessage 0SchCraftingbenchSuccessPickaxeMsg player.RemoveItem 0MCStick 2 1 player.RemoveItem 0MCBarIron 3 1 player.additemhealthpercent 0WeapPickaxeIron 1 100 PlaySound UIRepairWeapon endif elseif button == 3 if ( player.GetItemCount 0MCStick > 0 ) && ( player.GetItemCount 0MCBarIron > 1 ) ShowMessage 0SchCraftingbenchSuccessAxeMsg player.RemoveItem 0MCStick 1 1 player.RemoveItem 0MCBarIron 2 1 player.additemhealthpercent 0weapAxeIron 1 100 PlaySound UIRepairWeapon endif elseif button == 4 if ( player.GetItemCount 0MCBlockWoodenPlank > 1 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0MCBlockWoodenPlank 2 1 player.additem 0MCStick 4 1 Playsound UIRepairWeapon endif elseif button == 5 if ( player.GetItemCount 0MCStick > 0 ) && ( player.GetItemCount 0MCBarIron > 1 ) ShowMessage 0SchCraftingbenchSuccessSwordMsg player.RemoveItem 0MCStick 1 1 player.RemoveItem 0MCBarIron 2 1 player.additemhealthpercent 0WeapSwordIron 1 100 PlaySound UIRepairWeapon endif elseif button == 6 if ( player.getitemcount 0mcblockwood > 0 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0mcblockwood 1 1 player.additem 0MCBlockWoodenPlank 4 1 Playsound UIRepairWeapon endif elseif button == 7 if ( player.getitemcount 0MCBlockWoodenPlank > 3 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0MCBlockWoodenPlank 4 1 player.additem 0MCBlockCraftingBench 1 1 Playsound UIRepairWeapon endif elseif button == 8 if ( player.getitemcount 0MCBlockCobblestone > 7 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0MCBlockCobblestone 8 1 player.additem 0MCBlockFurnace 1 1 Playsound UIRepairWeapon endif elseif button == 9 ShowMessage 0SchCraftingbenchMsg2 set iAlternateMessage to 1 endif elseif iAlternateMessage == 1 if ( Button >0 ) set weaponcondition to (player.getav Repair)/100 if button == 1 if ( player.getitemcount 0MCBlockWoodenPlank > 7 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0MCBlockWoodenPlank 8 1 player.additem 0MCBlockChest 1 1 Playsound UIRepairWeapon endif elseif button == 2 if ( player.getitemcount 0MCBrick > 3 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0MCBrick 4 1 player.additem 0MCBlockBrick 1 1 Playsound UIRepairWeapon endif endif endif endif End Link to comment Share on other sites More sharing options...
tunaisafish Posted July 12, 2011 Share Posted July 12, 2011 Fixed up the script and added some comments in there where I changed. A mixup in the nested if's mainly. I notice that some of your ID's start with zero. It's better to avoid digits at the start of the ID's (as sometimes that causes an error where the scripting engine thinks you are passing it a numerical ref.)Not sure what you are using the timer for yet :) Reveal hidden contents scn 0MCSCraftingBenchScript short HasItems short Button int iAlternateMessage short item1 short item2 short item3 short item4 float weaponCondition int iHealth int iStage float fTimer Begin OnHit if ( iHealth == 2 ) Player.AddItem 0MCBlockCraftingBench 1 Disable MarkForDelete else Set fTimer to 2 Set iStage to 1 Set iHealth to iHealth + 1 endif End Begin OnActivate if IsActionRef player == 1 set HasItems to 0 if GetHasNote 0SchTNTMineNote == 1 set HasItems to 1 endif if HasItems == 1 ShowMessage 0SchCraftingbenchMsg ; make sure we're reading the right responses. set iAlternateMessage to 0 else ShowMessage 0SchCraftingbenchNoneMsg endif endif End Begin GameMode if ( fTimer > 0 ) Set fTimer to fTimer - GetSecondsPassed elseif ( iStage == 1 ) Set iStage to 0 Set fTimer to 0 Set iHealth to 0 endif set Button to GetButtonPressed if ( Button <0 ) ; no button pressed yet. return elseif Button ; A button with a positive number set weaponcondition to (player.getav Repair)/100 if iAlternateMessage == 0 ;Handle first message responses if button == 1 if ( player.GetItemCount LunchBox > 0 ) && ( player.GetItemCount CherryBomb > 0 ) && ( player.GetItemCount Caps001 >= 20 ) ShowMessage 0SchCraftingbenchSuccessTNTBlockMsg player.RemoveItem LunchBox 1 1 player.RemoveItem CherryBomb 1 1 player.RemoveItem Caps001 20 1 player.AddItemHealthPercent 0WeapMineTNTBlock 1 100 PlaySound UIRepairWeapon endif elseif button == 2 if ( player.GetItemCount 0MCStick > 1 ) && ( player.GetItemCount 0MCBarIron > 2 ) ShowMessage 0SchCraftingbenchSuccessPickaxeMsg player.RemoveItem 0MCStick 2 1 player.RemoveItem 0MCBarIron 3 1 player.additemhealthpercent 0WeapPickaxeIron 1 100 PlaySound UIRepairWeapon endif elseif button == 3 if ( player.GetItemCount 0MCStick > 0 ) && ( player.GetItemCount 0MCBarIron > 1 ) ShowMessage 0SchCraftingbenchSuccessAxeMsg player.RemoveItem 0MCStick 1 1 player.RemoveItem 0MCBarIron 2 1 player.additemhealthpercent 0weapAxeIron 1 100 PlaySound UIRepairWeapon endif elseif button == 4 if ( player.GetItemCount 0MCBlockWoodenPlank > 1 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0MCBlockWoodenPlank 2 1 player.additem 0MCStick 4 1 Playsound UIRepairWeapon endif elseif button == 5 if ( player.GetItemCount 0MCStick > 0 ) && ( player.GetItemCount 0MCBarIron > 1 ) ShowMessage 0SchCraftingbenchSuccessSwordMsg player.RemoveItem 0MCStick 1 1 player.RemoveItem 0MCBarIron 2 1 player.additemhealthpercent 0WeapSwordIron 1 100 PlaySound UIRepairWeapon endif elseif button == 6 if ( player.getitemcount 0mcblockwood > 0 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0mcblockwood 1 1 player.additem 0MCBlockWoodenPlank 4 1 Playsound UIRepairWeapon endif elseif button == 7 if ( player.getitemcount 0MCBlockWoodenPlank > 3 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0MCBlockWoodenPlank 4 1 player.additem 0MCBlockCraftingBench 1 1 Playsound UIRepairWeapon endif elseif button == 8 if ( player.getitemcount 0MCBlockCobblestone > 7 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0MCBlockCobblestone 8 1 player.additem 0MCBlockFurnace 1 1 Playsound UIRepairWeapon endif elseif button == 9 ShowMessage 0SchCraftingbenchMsg2 set iAlternateMessage to 1 endif elseif iAlternateMessage == 1 ;Handle alternate message responses if button == 1 if ( player.getitemcount 0MCBlockWoodenPlank > 7 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0MCBlockWoodenPlank 8 1 player.additem 0MCBlockChest 1 1 Playsound UIRepairWeapon endif elseif button == 2 if ( player.getitemcount 0MCBrick > 3 ) ShowMessage 0SchCraftingbenchSuccessMsg player.removeitem 0MCBrick 4 1 player.additem 0MCBlockBrick 1 1 Playsound UIRepairWeapon endif endif endif ; else ; ;User pressed top button 0, do nothing. endif End Link to comment Share on other sites More sharing options...
KDStudios Posted July 12, 2011 Author Share Posted July 12, 2011 That did the trick for me, thanks so much :DI think I am getting there... really slowly :P I'll bare that in mind though, force of habit naming everything with a 0 at the beginning. I like to find the stuff I need at the top of the list :PI'll consider removing it all in the next version, though knowing me I'll break it :P Link to comment Share on other sites More sharing options...
Pronam Posted July 12, 2011 Share Posted July 12, 2011 (edited) Just use a few "A"s instead of 0s. :P numbers at the start can provide a LOT of issues and it won't notify you of it, mainly because one time it will work fine and another time it won't work at all. Edited July 12, 2011 by Pronam Link to comment Share on other sites More sharing options...
AlexxEG Posted July 12, 2011 Share Posted July 12, 2011 I like use the first letter(s) in upper case of the mod name followed by a lower case X, for example, I have a mod called Grayditch Home. Therefore: GHxSomethingThen it's almost certain you will only see your stuff when you filter. ;) Link to comment Share on other sites More sharing options...
Pronam Posted July 12, 2011 Share Posted July 12, 2011 Yeah, but it's per person how it's dealt..some want it in view directly and find ticking a few letters too much time to waste :facepalm:. I'm using the same method as you, usually consisting of 3 letters, but at most of the mods I've worked with I either see A or 0 used. At least A doesn't mess things up too much. Link to comment Share on other sites More sharing options...
AlexxEG Posted July 12, 2011 Share Posted July 12, 2011 @Pronam: True. I use my method cause I only want to see my content. :) Link to comment Share on other sites More sharing options...
Ghogiel Posted July 13, 2011 Share Posted July 13, 2011 I do that same thing more or less. For example all the star wars entries I made started with SW. This stems back to old MW modder etiquette more or less. Pronam might remember judging by his join data, back then everyone would have used their initials to begin entries with, I would have ended up using GH for example. Link to comment Share on other sites More sharing options...
KDStudios Posted July 13, 2011 Author Share Posted July 13, 2011 (edited) Okay I'll bare all of this in mind then :)So I'm pretty much done with Falloutcraft V3 then and I'll just add a few clutter items to give it a bit of a finished look. In V4 I'll get start by changing all the ID's of everything so they begin with "FC", this will remove the number 0 and hopefully prevent any future problems. Also it will come in handy when filtering as all I'll need to type is FC, I do have a system like that already.0MCA - Activators0MCH - Harvesters0MCTex - Texture Sets0MCB - Blocksetc etcSo all I need to do is replace 0MC with FC :) I thank everyone here who has provided help and advice in my scripting. Without it I dread to think where the project would be now!So each of you that have helped will definitely get a mention in the credits part when I get around to uploading it later today. So yeah in V4, I'll be changing the ID's and introducing an Inventory Crafting Area similar to the crafting bench except this will be activated via the players inventory.I already have a script in place and it works as intended. However the buttons don't work at all. Not sure what the issue is, so I'll figure that out later.The script is something like: (not accurate as this is just wrote off the top of my head and most likely won't work, just giving you guys an idea of what it says) Reveal hidden contents scn FCInventoryCraftingAreaScript Short Button float weaponcondition Begin OnDrop Showmessage FCInventorycraftingbench player.additem FCInventoryCraftingArea 1 ; This is the item that you drop to activate this script disable markfordelete End Begin Gamemode set Button to GetButtonPressed if ( Button <0 ) set weaponcondition to (player.getav Repair)/100 if button == 1 if ( player.getitemcount 0mcblockwoodenplank > 3 ) showmessage 0schcraftingbenchsuccessmsg player.removeitem 0mcblockwoodenplank 4 1 player.additem 0mcblockcraftingbench 1 1 playsound UIRepairWeapon endif endif End ; But yeah like I said, this isn't the actual script and I wrote this off the top of my head. The buttons don't work. If anyone wants to help with this, be my guest. :) What I'm more interested in is adding a Damage variable to a lava/cactus block so that the player or NPC's get damaged when they touch or walk on it (Or a set distance from it if it must be like that)Rausheim kindly left a script for me that attempted to do that but it didn't wouldn't save for whatever reason, now I've appeared to have lost it so I can't comment on what the script actually said.So any advice on how to achieve that? Edited July 13, 2011 by KDStudios Link to comment Share on other sites More sharing options...
AlexxEG Posted July 13, 2011 Share Posted July 13, 2011 (edited) Let me know how this works out for ya: Reveal hidden contents scn FCInventoryCraftingAreaScript Short Button float weaponcondition Begin OnDrop Showmessage FCInventorycraftingbench player.additem FCInventoryCraftingArea 1 ; This is the item that you drop to activate this script disable markfordelete End Begin Gamemode set Button to GetButtonPressed if ( Button <0 ) ;Button hasn't been pressed yet Return elseif ( Button ) ;If Button is equal or above 0 set weaponcondition to (player.getav Repair)/100 if button == 1 if ( player.getitemcount 0mcblockwoodenplank > 3 ) showmessage 0schcraftingbenchsuccessmsg player.removeitem 0mcblockwoodenplank 4 1 player.additem 0mcblockcraftingbench 1 1 playsound UIRepairWeapon endif ;Forgot a endif endif endif End Edited July 13, 2011 by Alexx378 Link to comment Share on other sites More sharing options...
Recommended Posts