Scripting items, take 2 - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Scripting items, take 2 (/Thread-Scripting-items-take-2) |
Scripting items, take 2 - Stephka - 10-30-2012 04:38 AM Hi again all of you! It's me again, and now I'm trying to script more complicated items. I want to script poisons and such for alchemy. Say I want to script a poison named Nightshade,with one charge, which upon consumption gets the player to be more intelligent, but he must take it every 72 hours or suffer a -15 penalty in Dex, Str and Int for 96 hours (withdrawal time). How do I do that? [ITEMDEF i_nightshade] NAME= Nightshade ID=0EFB TYPE=t_normal VALUE=0 WEIGHT=1 CHARGE=1 RESOURCES=1 i_blue_flower, 1 i_empty_bottle, 1 i_ash SKILLMAKE=ALCHEMY 60.0 CATEGORY=TdF SUBSECTION=Drug DESCRIPTION=Nightshade ON=@Create MORE1=s_Cunning What is missing for it to be functionnal? Thank you all so much for bearing with my inexperience! RE: Scripting items, take 2 - Barnabus - 11-02-2012 04:53 AM Hi the spherewiki should be a great help to you with item creation. Though just to help, if you were creating a posion first it must be in a bottle or have the id of a bottle I assume thats what 0efb is ? the type I guess must be T_Potion thats something you dclick and apparently drink, unlike t_normal which kind of declares a custom script. Though you can use any type there or make your own to suit. A value of 0 should be considered because if you add these to your vendor NPCS to sell at any point, they are a bit cheap ! The resourses are fine but were is the nightshade. LOL @ the withdrawal time thats funny. PHP Code: [DEFNAME potionControlPanel] PHP Code: [ITEMDEF i_potion_nightShade] PHP Code: [TYPEDEF t_potion_nightshade] PHP Code: [ITEMDEF i_potiondelay] Then all you would have to deal with is the i_potionNightshadeAddiction memory. First we will add your variables to the control. PHP Code: [DEFNAME potionControlPanel] Before your write the memory that will control the effect on the player you need to consider your time format its in hours so we could use a function to convert that to seconds-ish PHP Code: [FUNCTION f_convertHoursSecs] i write <EVAL <f_convertHoursSecs <nightshade_withdrawl_time>>> Finally the Memory PHP Code: [ITEMDEF i_nightShadeEffect] ^^ thats got to have errors in it but you should see whats supposed to happen. finally the functions f_doNightShadeEffect f_removeNightShadeEffect f_doNightShadeWithdrawl f_removeNightShadeWithdrawl PHP Code: [FUNCTION f_doNightShadeEffect] ^^ I havnt tested any of that so you might have to fix or rearrange it, but it should give you a good idea of how you could layout and code something like drugs RE: Scripting items, take 2 - Stephka - 11-09-2012 12:17 PM Thank you for your help! That should help me getting started. RE: Scripting items, take 2 - Stephka - 11-09-2012 04:47 PM Well, my first try made my server go boom. Second try, a wooden wall came out of nowhere. This is fun! RE: Scripting items, take 2 - Barnabus - 11-16-2012 10:59 PM LOL ^^ What did you do ? I would not have tested anything I wrote previously, did you follow my instructions? If your still stuck with this... Just post what you have built and I will check over it for you! |