Magical Items for TFS 1.2/3

Discussion in 'Mods & Lua Functions' started by bayview, Feb 2, 2018.

?

Are you excited to try out this system?

  1. Yes!

  2. No

Results are only viewable after voting.
  1. bayview

    bayview Retired

    Joined:
    Jan 25, 2018
    Messages:
    614
    Likes Received:
    305
    Best Answers:
    24
    I am about to become homeless.. well in 24 days I will be homeless so I have no need for my ot server code. I was going to launch an ot server but that is a lot of work. Although I was almost done with the project, it still requires a lot more time to finish than I have.

    But in reality I need to find a real job so with that said. I am releasing this system I made some time last year.

    If you follow the instructions you shouldn't have any issues with getting it to work.

    Guide
    This guide will help you install and create the necessary files needed to run Magical Items.
    If you follow this guide step by step you shouldn't have any problems, this system is written entirely in lua & the TFS framework, no source editing is required.

    A little bit about Magical Items:
    Magical Items by @Codex NG, is a tiered based system for all items which can be equipped to a player.
    These items can have all sorts of conditions applied to them, they can also be transformed from one item to another.
    This system allows you to set and stack damage types for both attack and defense.
    You can also assign existing spells which are not normally meant for that vocation at different tiers that a player can use temporarily or forever.

    An example of this system:
    Code (Text):
    1.  
    2. 17:03 You see a backpack (Vol:20).
    3. It weighs 150.60 oz.
    4. Wearing this backpack will grant the bearer these attributes [Axe:20] in stats.
    5. Damage Reduction [Fire: +9] [Physical: +9]
    6.  
    In addition to everything listed above, Magical Items has been assigned an auto heal script which determines the type of damage a player takes and uses the appropriate potion (health / mana) regardless of level or vocation requirement.

    When a player logins they will receive a msg some thing similar to this:
    Code (Text):
    1.  
    2. 17:03 Your autoheal is not active, the warning msg is on, has not been set, it is at its default of 50%, for more info type /autoheal help.
    3.  
    To see exactly what autoheal does type the command /autoheal help
    Which should look like this:
    Code (Text):
    1.  
    2. 17:07 To see the status autoheal type:
    3. 17:07 /autoheal status
    4. 17:07 To turn on autoheal type:
    5. 17:07 /autoheal on
    6. 17:07 To turn off autoheal type:
    7. 17:07 /autoheal off
    8. 17:07 To toggle the warning message you get when out of potions type:
    9. 17:07 /autoheal warning toggle
    10. 17:07 To change the percentage of healing type:
    11. 17:07 /autoheal n
    12. 17:07 Where n is a number, the number must be between 1 - 100.
    13. 17:07 If the number is the same, less than 1 or greater than 100, then no change will take place.
    14.  
    The execution per heal will show an emote at what percentage you are healing and a message in the console will tell you what potions you are using.
    When a player runs out of potions of the required type an emote warning is executed, this warning can be toggled off.
    Code (Text):
    1.  
    2. 17:19 Using 1 of 136x super ultimate health potions heals both hp/mana.
    3.  
    Installation

    Step 1
    Copy this below and place it at the bottom of your global.lua
    Code (Text):
    1.  
    2. dofile('data/items/magical_items.lua')
    3.  
    Step 2
    Copy magical_items_lib.lua, run_first.lua, run_second.lua and run_third.lua to data/items/

    There are 7 files that go in this directory, you will are given 4 the remaining 3 will be created, you will need a lua interpreter to run run_first.lua, run_second.lua and run_third.lua

    Zerobrane is a completely free lua interpreter for Windows, Linux & Mac.
    You can download it here Download - ZeroBrane Studio - Lua IDE/editor/debugger for Windows, Mac OSX, and Linux

    run_first.lua
    This file creates a file called items.lua and must be run 1st, it parses your items.xml file.
    If you have custom items with different names or properties such as a shield which you made into a helmet it will read that shield as a helmet.

    items.lua
    This is the base file you want to edit to add or remove items you won't be using with this system.
    The next two files parse the information which is retained in items.lua.

    run_second.lua
    This file parses the items.lua file and generates a file called magical_items.lua and should be run 2nd

    run_third.lua
    This file also parses the items.lua file and creates a file called magical_items.xml

    magical_items_lib.lua
    This is the library which contains all the code needed to run the magical items system.


    Step 3
    magicItems_creaturescript.lua
    Place this file in data/creaturescripts/scripts/

    Then edit creaturescripts.xml and add this entry
    HTML:
    1. <event type="healthchange" name="MagicItems" script="magicItems_creaturescript.lua" />
    Open up login.lua in data/creaturescripts/scripts/ and add this somewhere inside onLogin
    Code (Lua):
    1.  
    2.         x:onLogin(player:getId())
    3.         player:registerEvent("MagicItems")
    4.  


    Step 4
    Go to data/events/scripts and open up creature.lua

    Select everything in there and paste this in, if you have other custom code in there then make the adjustments.
    Code (Lua):
    1.  
    2.     function Creature:onChangeOutfit(outfit)
    3.         if self:isPlayer() and self:getCondition(CONDITION_OUTFIT) then
    4.             return false
    5.         end
    6.         return true
    7.     end
    8.  
    9.     function Creature:onAreaCombat(tile, isAggressive)
    10.         return RETURNVALUE_NOERROR
    11.     end
    12.  
    13.     function Creature:onTargetCombat(target)
    14.         if target:isMonster() then
    15.             target:registerEvent("MagicItems")
    16.         end
    17.         return RETURNVALUE_NOERROR
    18.     end
    19.  
    Now open up events.xml in data/events/ and make sure these lines match the one's in your events.xml
    HTML:
    1.  
    2.         <event class="Creature" method="onChangeOutfit" enabled="1" />
    3.         <event class="Creature" method="onTargetCombat" enabled="1" />
    4.  
    5.         <event class="Player" method="onLook" enabled="1" />
    6.         <event class="Player" method="onLookInTrade" enabled="1" />
    7.  
    Step 5
    Next we need to do is open up player.lua in data/events/scripts

    Look for this in Player onLook
    Code (Lua):
    1. local description = "You see " .. thing:getDescription(distance)


    You are going to replace that code with this, if you have custom code here, make the adjustments.
    Code (Lua):
    1.  
    2. local description = "You see " .. thing:getDescription(distance) .. self:getMagicItemDescription(thing)
    3.  
    Next inside of that method look for
    Code (Lua):
    1.  
    2.             local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
    3.             if uniqueId > 0 and uniqueId < 65536 then
    4.                 description = string.format("%s, Unique ID: %d", description, uniqueId)
    5.             end
    6.  
    Underneath that section of code you are going to place this
    Code (Lua):
    1.  
    2.             local text = thing:getAttribute(ITEM_ATTRIBUTE_TEXT)
    3.             if text and text ~= '' then
    4.                 description = string.format("%s, Text : %s", description, text)
    5.             end
    6.  
    7.             local serial = x:getSerial(thing:getName())
    8.             if serial and serial ~= '' then
    9.                 description = string.format("%s, Serial : %s", description, serial)
    10.             end
    11.  
    Next look for in Player onLookInTrade
    Code (Lua):
    1.  
    2.             self:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. item:getDescription(distance))
    3.  
    Replace that code with this
    Code (Lua):
    1.  
    2.             self:sendTextMessage(MESSAGE_INFO_DESCR, item:getDescription(distance) .. self:getMagicItemDescription(item) )
    3.  

    Step 6
    Open up the magical_items.xml which was created in data/items/ and then open up your movements.xml in data/movements/

    Copy the entries in magical_items.xml and replace the existing onEquip/DeEquip entries in movements.xml

    Next place the magical_items_movements.lua in your data/movement/scripts/ directory.

    Step 7
    Go to data/talkactions and open talkactions.xml and place this in there.
    HTML:
    1.  
    2.         <talkaction words="/autoheal" separator=" " script="autoHeal.lua" />
    3.  
    Next go to data/talkactions/scripts and drop autoheal.lua in there


    Step 8

    Editing

    magical_items.lua
    This file will contain all of items which will be used with this system.

    On server startup all the items in this file will be set with a default of tier 1 with no conditions associated with them.
    It will be your job to use the methods in the magical items library to set the different attributes to your equipment in this file.

    Please note all methods are procedural, also you can not (or shouldn't) stack the same condition on top of another.

    Example:
    Code (Lua):
    1. [B][/B]
    2.         -- sets the item ancient tiara to tier 1 at slot 1
    3.         -- x:setTier(slot, item name, tier)
    4.         x:setTier(1, 'ancient tiara', 1)
    5.         -- everything below will be a tier 1 value until it reaches another set tier
    6.         -- ancient tiara is given a condition of manashield
    7.         x:manashield()
    8.         -- ancient tiara attributes
    9.         x:attributes({'max health', 'max mana', 'fist%','club', 'sword'}, {500, 1000, 20, 30, 50})
    10.         -- ancient tiara is assigned an outfit
    11.         x:outfit(2)
    12.         -- ancient tiara is assigned a condition of hp regen of 50
    13.         x:regen('hp', 50)
    14.         -- ancient tiara is given a damage reduction of 20 physical and 10 death damage
    15.         x:damageReduction('defense physical', 'defense death', 20, 10)
    16.  
    17.         -- sets the item ancient tiara to tier 2 at slot 1
    18.         x:setTier(1, 'ancient tiara', 2)
    19.         -- everything below will be a tier 2 value
    20.         x:dot({'fire', 'energy'}, 100, 1000, {-1, -2})
    21.         x:outfit(1)
    22.         x:damageReduction('defense energy', nil, 50)
    23.  
    The onLook properties of the ancient tiara on a GOD character will look something like this
    Code (Lua):
    1.  
    2.         17:15 You see an ancient tiara.
    3.         It weighs 8.20 oz.
    4.         Ye who bears this mystical ancient tiara is granted an ancient magical shield.
    5.         Wearing this ancient tiara will grant the bearer these attributes [Max Health:500] [Max Mana:1000] [Fist%:20] [Club:30] [Sword:50] in stats.
    6.         By dressing ancient tiara your true identity will be masked.
    7.         Wearing this ancient tiara will grant the bearer a boost in [Hp:50] regen.
    8.         Damage Reduction [Physical: +20] [Death: +10]
    9.         Item ID: 2139, Serial : 1|0|1|0|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0|0|0|1|0|0
    10.         Position: 93, 130, 7
    11.  
    A little info on the Magical Items Methods (not all of them)
    Code (Lua):
    1.  
    2.         -- this is the 1st thing called before each tier, and must be set 1st
    3.         -- slot is the equipment slot, item name is the name of the item in items.xml, and tier is the tier it has to be to
    4.         -- benefit from this system
    5.         x:setTier(slot, item name, tier)
    6.  
    7.         -- this is used to up/downgrade and items tier (think crafting)
    8.         x:setMagicItemTier(item, subtype, tier)
    9.  
    10.         -- gives the player manashield when an item is equipped, manashield does not stack or scale
    11.         x:manashield([description[, isCustomItem]])
    12.  
    13.         -- gives the player invisible when an item is equipped, invisible does not stack or scale
    14.         x:invisible([description[, isCustomItem]])
    15.  
    16.         -- gives the player an outfit to wear which they can not remove unless they unequip the item
    17.         -- outfit does not stack or scale
    18.         -- the outfitIndex corresponds to both v & d table's index
    19.         x:outfit(outfitIndex[, description[, isCustomItem]])
    20.  
    21.         -- gives the player a haste condition, there are a few haste formulas, you can define your own by editing the v table
    22.         -- the hasteIndex corresponds to the v table's index
    23.         x:haste(hasteIndex[, description[, isCustomItem]])
    24.  
    25.         -- gives the player a paralyze condition, there are a few paralyze formulas, you can define your own by editing the v table
    26.         -- the paralyzeIndex corresponds to the v table's index
    27.         x:paralyze(paralyzeIndex[, description[, isCustomItem]])
    28.  
    29.         -- applies a regen buff for either hp or mana or both
    30.         -- both attributeType & attribute can be a table/variable, if attributeType is a variable so should attribute
    31.         x:regen(attributeType, attribute[, description[, isCustomItem]])
    32.  
    33.         -- applies attributes such as health, mana, sword, health percentage, magic level etc to the player when the item is equipped
    34.         -- both type and attribute can be a table/variable, if type is not a table then attribute has to be a variable
    35.         x:attributes(type, attribute[, description[, isCustomItem]])
    36.  
    37.         -- applies light to a player when the item is equipped
    38.         -- color is anything in the v table, level is a range value of 1 being the lowest and 8 possibly being the highest
    39.         x:light([color[, level[, description[, isCustomItem]]]])
    40.  
    41.         -- applies soulgain to a player when an item is equipped
    42.         -- gain is how much soul to gain and ticks is how often to gain them
    43.         x:soul(gain, ticks[, description[, isCustomItem]])
    44.  
    45.         -- applies damage over time to the player when the item is equipped
    46.         -- (think, this item has great stats but it's cursed or it does not belong to them)
    47.         -- time, round or interval can be a table/variable, if time is a variable the rest should be aswell
    48.         -- this can not be applied to weapon damage... yet ;)
    49.         x:dot(time, round, interval, damage[, description[, isCustomItem]])
    50.  
    51.         -- this method is enabled by default and just detects if the player has manashield
    52.         -- this method was written because I found the internal manashield not working as expected
    53.         x:hasManashield(cid, aid, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    54.  
    55.         -- this method only applies to weapons and shields, it gives the item additional attack damage
    56.         -- in the primary or secondary types
    57.         -- example of this is
    58.         -- x:directDamage('combat physical', 12, 'combat fire', 10)
    59.         x:directDamage(primaryType, primaryValue, secondaryType, secondaryValue, isCustomItem)
    60.  
    61.         -- this method applies to all items that can be equipped and stacks meaning if you have damage reduction on an
    62.         -- armor of say 10 and a shield of 15 then you get reduced fire damage of 25
    63.         -- in the primary or secondary types
    64.         -- example of this is
    65.         -- x:damageReduction('defense physical', 12, 'defense fire', 10)
    66.         x:damageReduction(primaryType, secondaryType, primaryValue, secondaryValue, isCustomItem)
    67.  
    68.         -- sets spell(s) to an item which can be removed when the item is equipped or made a permanent part of the player's arsonal
    69.         x:setSpells(spells[, permanent[, isCustomItem]])
    70.  
    71.         -- this physically transforms an item from one to another
    72.         -- name is the name of the item you want this item to transform to
    73.         -- keep is if you want to keep this item as is, as in not change it back
    74.         x:setTransformItem(name[, keep[, isCustomItem]])
    75.  
    76.         -- this method will execute the autoheal aspect of Magical Items, its 1st parameter is the player id
    77.         -- the second parameter is the threshold (the percentage to heal at), the 3rd parameter is the type of heal
    78.         -- or potion type rather to heal, both the 2nd and 3rd parameters are optional.
    79.         -- Currently the auto heal does not work on monsters, pets, or summons.
    80.         x:autoHeal(cid[, threshold[, type_]])
    81.  
     

    Attached Files:

    God Nixez, karudotpl, Okke and 2 others like this.
  2. 2Rec

    2Rec Well-Known Member

    Joined:
    Jul 31, 2013
    Messages:
    398
    Likes Received:
    426
    Best Answers:
    40
    Damn, that's a twist.
     
  3. Aeronx

    Aeronx Active Member

    Joined:
    Dec 17, 2015
    Messages:
    646
    Likes Received:
    75
    Best Answers:
    9
    I paid for this system, and i havent given him any permission to release it.

    That the way he is. You show some kindness, and they stab you hard! Well done!
     
  4. bayview

    bayview Retired

    Joined:
    Jan 25, 2018
    Messages:
    614
    Likes Received:
    305
    Best Answers:
    24
    I did not exclusively write this system for you, you do not own the rights to it.
    So I do not need your permission as I can do what I like with it.
    I wrote it for me, what sane person would spend an entire month writing and re-writing a library for $100?
    I have already explain this to you on numerous occasions.

    Kindness?
    You are one of the worst and cheapest "clients" I have ever have had to work for, I wouldn't exactly call you or your actions kind.

    Yes I am very generous :)
     
    owned likes this.
  5. Aeronx

    Aeronx Active Member

    Joined:
    Dec 17, 2015
    Messages:
    646
    Likes Received:
    75
    Best Answers:
    9
    100$? You got more than 150$ when we stablished 100$ for that system. And now you did it for yourself? REALLY?
    At least karma seems to work.
     
  6. bayview

    bayview Retired

    Joined:
    Jan 25, 2018
    Messages:
    614
    Likes Received:
    305
    Best Answers:
    24
    Do I need to provide proof that you only paid me $100?
    Because I have the records...
     
  7. Aeronx

    Aeronx Active Member

    Joined:
    Dec 17, 2015
    Messages:
    646
    Likes Received:
    75
    Best Answers:
    9
    Actually yeah, you are right. I thought it was more. I paid exactly 101$ to you. 60$ in advance. (Just checked paypal)
    So i paid you to work in something for yourself? Why would i pay if i could get it for free?

    But ey! I wish you did enjoy that money! Have a happy life mate!
     
  8. bayview

    bayview Retired

    Joined:
    Jan 25, 2018
    Messages:
    614
    Likes Received:
    305
    Best Answers:
    24
    No you paid me exactly $100 total,
    $25 on May 9th, 2017
    $35 on May 25th, 2017
    $40 on May 29th 2017
    Because you have a difficult time understanding verbal or written English, I explained this to you on several occasions that I would either use this for my project, resell it or make it public.

    I don't know what the goal of your posting here is, I never pointed out in this thread or its sources that this system was made for your server.
    You have your own self to blame for this admission, especially when its not 100% accurate.

    Thanks! I'll try ;)
     
  9. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,875
    Likes Received:
    630
    Best Answers:
    13
    you maybe payed him a 100$ for the script but not for the script rights so eat it.
     
    Catalyst and bayview like this.
  10. Aeronx

    Aeronx Active Member

    Joined:
    Dec 17, 2015
    Messages:
    646
    Likes Received:
    75
    Best Answers:
    9
    My goal was to let the community know something about you that they seem to know already.

    But i will not get to your level and i will just live with it. Its a good system! :)
     
    bayview likes this.
  11. Nekiro

    Nekiro worst coder Support Team

    Joined:
    Sep 7, 2015
    Messages:
    1,659
    Likes Received:
    509
    Best Answers:
    64
    If you didn't state when buying that this script is exclusively made for you, and cannot be shared anywhere, then he is right. You bought the script, but he is free to do whatever he likes with it, even share it for free (which I don't support, because it's just not fair for the one who bought it, but that's his desire.).
     
    bayview likes this.
  12. LightTenshimaru

    LightTenshimaru LightTenshimaru

    Joined:
    Mar 15, 2014
    Messages:
    21
    Likes Received:
    1
    Best Answers:
    0
    Where is magical_items_movements.lua?
    '-'
     
  13. God Nixez

    God Nixez Member

    Joined:
    Sep 20, 2009
    Messages:
    401
    Likes Received:
    18
    Best Answers:
    0
    Same as above ;<
     
  14. Pedrook

    Pedrook Member

    Joined:
    May 24, 2009
    Messages:
    203
    Likes Received:
    16
    Best Answers:
    1
    can you make magical_items_movements.lua available?
     
  15. bayview

    bayview Retired

    Joined:
    Jan 25, 2018
    Messages:
    614
    Likes Received:
    305
    Best Answers:
    24
    I am unable to assist you since i do not own a computer nor do i have a place to live/work on any scripts or missing files.
     
    Pedrook likes this.
  16. Kubakos

    Kubakos Banned User

    Joined:
    Mar 3, 2010
    Messages:
    744
    Likes Received:
    27
    Best Answers:
    0
    I don't understand how your autoheal script is taking informations about potions that have to be used to heal and how to configure the potion that it needs to use?
     
  17. Pedrook

    Pedrook Member

    Joined:
    May 24, 2009
    Messages:
    203
    Likes Received:
    16
    Best Answers:
    1
    friend, force! All will be alright!
     
  18. bayview

    bayview Retired

    Joined:
    Jan 25, 2018
    Messages:
    614
    Likes Received:
    305
    Best Answers:
    24
    It takes from this table
    Code (Lua):
    1. potions = {
    2.   [7439] = {mana = {0, 0}, health = {250, 350}, flask = 7634, name = 'berserker', status = ''}, -- berserker
    3.   [7440] = {mana = {0, 0}, health = {250, 350}, flask = 7634, name = 'mastermind', status = ''}, -- mastermind
    4.   [7443] = {mana = {0, 0}, health = {250, 350}, flask = 7634, name = 'bullseye', status = ''}, -- bullseye
    5.   [7588] = {mana = {0, 0}, health = {250, 350}, flask = 7634, name = 'strong health', status = ''}, -- strong hp
    6.   [7589] = {mana = {115, 185}, health = {0, 0}, flask = 7634, name = 'strong mana', status = ''}, -- strong mana
    7.   [7590] = {mana = {150, 250}, health = {0, 0}, flask = 7635, name = 'great mana', status = ''}, -- great mana
    8.   [7591] = {mana = {0, 0}, health = {425, 575}, flask = 7635, name = 'great health', status = ''}, -- great hp
    9.   [7618] = {mana = {0, 0}, health = {125, 175}, flask = 7636, name = 'health', status = ''}, -- hp
    10.   [7620] = {mana = {75, 125}, health = {0, 0}, flask = 7636, name = 'small mana', status = ''}, -- small mana
    11.   [8472] = {mana = {100, 200}, health = {250, 350}, flask = 7635, name = 'great spirit', status = ' heals both hp/mana'}, -- great spirit
    12.   [8473] = {mana = {0, 0}, health = {650, 850}, flask = 7635, name = 'ultimate health', status = ''}, -- ultimate hp
    13.   [8474] = {combat = antidote, flask = 7636}, -- antidote
    14.   [8704] = {mana = {0, 0}, health = {60, 90}, flask = 7636, name = 'small health', status = ''}, -- small hp
    15.   [26029] = {mana = {425, 575}, health = {0, 0}, flask = 7635, name = 'ultimate mana', status = ''}, -- ultimate mana
    16.   [26030] = {mana = {250, 350}, health = {420, 580}, flask = 7635, name = 'ultimate spirit', status = ' heals both hp/mana'}, -- ultimate spirit
    17.   [26031] = {mana = {875, 1125}, health = {875, 1125}, flask = 7635, name = 'super ultimate health', status = ' heals both hp/mana'}, -- super ultimate hp
    18. }
    The method which is called is this
    Code (Lua):
    1. x:autoHeal(cid[, threshold[, type_]])
    Here is it's definition
    Code (Lua):
    1. function EQ.autoHeal(self, cid, threshold, type_, count)
    2.   count = count or 1
    3.   local player = Player(cid)
    4.   if player then
    5.     local pos = player:getPosition()
    6.     local activated = player:getStorageValue(active)
    7.     if activated > 0 then
    8.       local store = player:getStorageValue(storage)
    9.       store = store < 1 and 50 or store
    10.       threshold = threshold and (threshold * .01) or (store * 0.01)
    11.       local d, p = 1, 0
    12.       local condition = type_ or self:hasCon(cid)
    13.       local itemid, amount = self:hasItem(cid, count, condition)
    14.       local mLevel = player:getMagicLevel()
    15.       local potion = itemid and potions[itemid] or nil
    16.       if potion and next(potion) then
    17.         if potion.health or potion.mana or potion.combat then
    18.           if condition == 'mana' then
    19.             d = player:getMana()
    20.             local maxMana = player:getMaxMana()
    21.             p = math.floor(maxMana * threshold)
    22.             if d <= p then
    23.               --print(potion.mana[1], potion.mana[2], itemid, 'mana')
    24.               player:addMana(math.random(potion.mana[1], potion.mana[2]))
    25.               player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    26.             end
    27.           elseif condition == 'health' then
    28.             d = player:getHealth()
    29.             local maxHealth = player:getMaxHealth()
    30.             p = math.floor(maxHealth * threshold)
    31.             if d <= p then
    32.               --print(potion.health[1], potion.health[2], itemid, 'health')
    33.               player:addHealth(math.random(potion.health[1], potion.health[2]))
    34.               player:removeCondition(CONDITION_PARALYZE)
    35.               player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    36.             end
    37.           end
    38.           if d <= p then
    39.             doPlayerRemoveItem(cid, itemid, count)
    40.             player:addItem(potion.flask, count)
    41.             Game.sendAnimatedText("Healing "..condition.." at "..(threshold * 100).."%", pos, textColors[math.random(#textColors)])
    42.             player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Using "..count.." of " .. amount .. "x " .. potion.name .. " potions"..potion.status..".")
    43.           end
    44.         end
    45.       end
    46.     end
    47.   end
    48. end
    I don't know what happened to the original movements scripts because this does not look like it.. I would have to look it over which i really don't have the time for but here is link to the github which @Peonso forked.
    peonso/Magical-Items-1.2-3-Otx3
     

    Attached Files:

    Last edited by a moderator: May 5, 2018
  19. God Nixez

    God Nixez Member

    Joined:
    Sep 20, 2009
    Messages:
    401
    Likes Received:
    18
    Best Answers:
    0
    @bayview
    Thanks for including movements.xml :)
    however am having this error while equip or desequip "doesn't add stats anyhow also"
    Code (Text):
    1. Lua Script Error: [MoveEvents Interface]
    2. data/movements/scripts/magical_items.lua:onEquip
    3. data/movements/scripts/magical_items.lua:19: attempt to call method 'getSlottedI
    4. tems' (a nil value)
    5. stack traceback:
    6.         [C]: in function 'getSlottedItems'
    7.         data/movements/scripts/magical_items.lua:19: in function <data/movements
    8. /scripts/magical_items.lua:11>
    9.  
    10. Lua Script Error: [MoveEvents Interface]
    11. data/movements/scripts/magical_items.lua:onEquip
    12. data/movements/scripts/magical_items.lua:19: attempt to call method 'getSlottedI
    13. tems' (a nil value)
    14. stack traceback:
    15.         [C]: in function 'getSlottedItems'
    16.         data/movements/scripts/magical_items.lua:19: in function <data/movements
    17. /scripts/magical_items.lua:11>
     
  20. God Nixez

    God Nixez Member

    Joined:
    Sep 20, 2009
    Messages:
    401
    Likes Received:
    18
    Best Answers:
    0
    @bayview
    any thoughts why those errors are appearing? returning nil value
    any help will be appreciated

    /Nixez
     

Share This Page

Loading...