• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Movement and hp bar Not working

TomBartezz

Member
Joined
May 29, 2016
Messages
159
Reaction score
17
I have a very confusing movement.lua
This one works
Code:
       <movevent type="Equip" itemid="10032" slot="ring" function="onEquipItem" script="reborn100eq.lua"/>
    <movement type="DeEquip" itemid="10032" event="function" value="onDeEquipItem"/>

This one does not work
Code:
       <movevent type="Equip" itemid="2086" slot="ring" function="onEquipItem" script="reborn100eq.lua"/>
    <movement type="DeEquip" itemid="2086" event="function" value="onDeEquipItem"/>
Both is the same scripts

Items.xml
Code:
    <item id="2086" article="a" name="Human Ring">
        <attribute key="magiclevelpoints" value="30" />
        <attribute key="absorbPercentall" value="1" />
        <attribute key="skillsword" value="5" />
        <attribute key="skillaxe" value="5" />
        <attribute key="slotType" value="ring" />
        <attribute key="skilldist" value="5" />
        <attribute key="skillshield" value="5" />
        <attribute key="showattributes" value="1" />
        <attribute key="weight" value="100" />
    </item>

    <item id="10032" article="a" name="Monster Ring">
        <attribute key="magiclevelpoints" value="50" />
        <attribute key="absorbPercentall" value="2" />
        <attribute key="skillsword" value="5" />
        <attribute key="skillaxe" value="5" />
        <attribute key="skilldist" value="5" />
        <attribute key="skillshield" value="5" />
        <attribute key="slotType" value="ring" />
        <attribute key="showattributes" value="1" />
        <attribute key="weight" value="100" />
    </item>
 
Code:
<movevent type="Equip" itemid="2086" slot="ring" event="script" value="reborn100eq.lua"/>
<movement type="DeEquip" itemid="2086" slot="ring" event="function" value="onDeEquipItem"/>

Though, if you use a script for your item onEquip, the attributes will not be added to the player, so I don't recommend using this unless it's for a weapon or something.
 
Code:
function onEquip(cid, item, slot)
    if getPlayerStorageValue(cid, 4500) >= 100 then
        return true
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You must be Prestige 100 or higher to equip this.")
        return false
    end
end
 
So theres no way to check for prestiges when equipping? :( I guess I have to make monsters harder
if @Xeraphus is correct you can use lua function to add skills and such, but i never tried it, and probably you will need to remove those skill onDequip also, however i personally never tested if onEquip with script remove attrs.
On your script it is fine, the problem is because you dont defined the slotType on your item, add this line to Human ring:
<attribute key="slotType" value="ring" />
 
I've tested it on 0.3.6, if you add a script for onEquip instead of the actual function it doesn't add the attributes on the item to the player (magic, regen, etc)
 
So it would be this? btw human ring already has a ring slot but in a diff area
Code:
function onEquip(cid, item, slot)
 <attribute key="slotType" value="ring" />
  if getPlayerStorageValue(cid, 4500) >= 100 then
        return true
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You must be Prestige 100 or higher to equip this.")
        return false
    end
end
 
Since this would not work and it would be too complicated to make new vocations for each set.. (around 90 vocations) with even more than 300 luas i have to make and I only have 20-25mins a day to finish cuz of being busy helping with the kids for a year I have moved to non prestige server and am now figuring out how to find files that has hp and mp in percentages (The polish one I tried and the English one too but it does not work for me -.-)
 
Worked for me, you just need to use AddU16 instead of put<uint16_t>
Where do I add AddU16 to? or <uint16_t>, now I am currently searching for source edit files the one to change to hp and mp bars to 100% and for magic level rising too, its gonna be hard to find ones for 0.3.6 since its old
 
Hopefully I did not screw this up I will test this when I wake up tomorrow http://pastebin.com/xWrKzpXM full code
in short
Code:
msg-> put AddU16 (player-> getHealth ());
msg-> put AddU16 (player-> getPlayerInfo (PLAYERINFO_MAXHEALTH));

if (player-> getPlayerInfo (PLAYERINFO_MAXHEALTH)> 0)
{
msg-> put AddU16 (uint16_t (player-> getHealth () * 100 / player-> getPlayerInfo (PLAYERINFO_MAXHEALTH)));
msg-> put AddU16 (100);
}
else
{
msg-> put AddU16 (0);
msg-> put AddU16 (0);
}

msg-> put AddU16 (player-> getPlayerInfo (PLAYERINFO_MANA));
msg-> put AddU16 (player-> getPlayerInfo (PLAYERINFO_MAXMANA));

if (player-> getPlayerInfo (PLAYERINFO_MAXMANA)> 0)
{
msg-> put AddU16 (player-> getPlayerInfo (PLAYERINFO_MANA) * 100 / player-> getPlayerInfo (PLAYERINFO_MAXMANA));
msg-> put AddU16 (100);
}
else
{
msg-> put AddU16 (0);
msg-> put AddU16 (0);
}
Untouched source edit
http://pastebin.com/trtmJy4X
 
@TomBartezz
So let me understand you right.
Is the problem that the attributes that you have placed in your items.xml does not count when you equip the item, or does it not even require prestiges to equip the item?
 
@TomBartezz
So let me understand you right.
Is the problem that the attributes that you have placed in your items.xml does not count when you equip the item, or does it not even require prestiges to equip the item?
i wanted my items to require prestiges and have attributes in the first place, but it did not show and the prestiges did not work out so i had to give up and start making a normal server instead of a prestige one
 
Back
Top