malloc(): invalid size (unsorted)
Hi i have problem with move monster.xml to lua

>> Loading lua monsters
malloc(): invalid size (unsorted)
Aborted
how fix this problem ?
did you delete your data/monster/monsters.xml file?
monster.xml i leave like
<?xml version="1.0" encoding="UTF-8"?>
<monsters>
</monsters>
and put file lua to /tfs/monster/lua/
https://user-images.githubusercontent.com/63555106/170957567-b961baa9-030c-42ae-a3f3-316b62d87c00.mp4
So i don't know where is a problem.
where did you got your Lua monsters from? can you post one file here as example so I can test it?
where did you got your Lua monsters from? can you post one file here as example so I can test it?
I use ot monster converter and use file XML from source tfs
https://github.com/whitecrixu/forgottenserver/tree/master/data/monster
I can reproduce. At least one issue is because of the loot lines which contain a description. Input:
<loot>
<item id="1962" chance="940" /><!-- orange book -->
<item name="small ruby" chance="320" />
<item name="gold coin" countmax="60" chance="65520" />
<item id="2169" chance="420" /><!-- time ring -->
<item name="silver amulet" chance="1020" />
<item name="hailstorm rod" chance="220" />
<item name="clerical mace" chance="1260" />
<item name="red robe" chance="80" />
<item name="pirate voodoo doll" chance="1730" />
<item id="6089" chance="700" /><!-- music sheet 3rd verse -->
<item name="lunar staff" chance="120" />
<item name="amber staff" chance="680" />
<item name="cultish robe" chance="10080" />
<item name="cultish symbol" chance="90" />
<item name="rope belt" chance="10000" />
<item name="broken key ring" chance="120" />
</loot>
Output:
monster.loot = {
{id = 1962, chance = 940, description = "orange book"},
{id = "small ruby", chance = 320},
{id = "gold coin", chance = 65520, maxCount = 60},
{id = 2169, chance = 420, description = "time ring"},
{id = "silver amulet", chance = 1020},
{id = "hailstorm rod", chance = 220},
{id = "clerical mace", chance = 1260},
{id = "red robe", chance = 80},
{id = "pirate voodoo doll", chance = 1730},
{id = 6089, chance = 700, description = "music sheet 3rd verse"},
{id = "lunar staff", chance = 120},
{id = "amber staff", chance = 680},
{id = "cultish robe", chance = 10080},
{id = "cultish symbol", chance = 90},
{id = "rope belt", chance = 10000},
{id = "broken key ring", chance = 120}
}
The converter reads in the comments after each loot line and shoves it into the description field. I didn't realize description was used as a synonym of text in revscriptsys because it not in xml. TFS engine is choking because text is being set on items that can't be written. I will fix that with the ot monster converter
edit2: Beyond that there seems to be other issues with TFS revscriptsys. I can't get the converted Abyssador to load either but I couldn't pinpoint the issue to any particular table. When i removed the tables one at a time tfs doesn't load but If I remove several tables at once it loads.
I can reproduce. At least one issue is because of the loot lines which contain a description. Input:
<loot> <item id="1962" chance="940" /><!-- orange book --> <item name="small ruby" chance="320" /> <item name="gold coin" countmax="60" chance="65520" /> <item id="2169" chance="420" /><!-- time ring --> <item name="silver amulet" chance="1020" /> <item name="hailstorm rod" chance="220" /> <item name="clerical mace" chance="1260" /> <item name="red robe" chance="80" /> <item name="pirate voodoo doll" chance="1730" /> <item id="6089" chance="700" /><!-- music sheet 3rd verse --> <item name="lunar staff" chance="120" /> <item name="amber staff" chance="680" /> <item name="cultish robe" chance="10080" /> <item name="cultish symbol" chance="90" /> <item name="rope belt" chance="10000" /> <item name="broken key ring" chance="120" /> </loot>Output:
monster.loot = { {id = 1962, chance = 940, description = "orange book"}, {id = "small ruby", chance = 320}, {id = "gold coin", chance = 65520, maxCount = 60}, {id = 2169, chance = 420, description = "time ring"}, {id = "silver amulet", chance = 1020}, {id = "hailstorm rod", chance = 220}, {id = "clerical mace", chance = 1260}, {id = "red robe", chance = 80}, {id = "pirate voodoo doll", chance = 1730}, {id = 6089, chance = 700, description = "music sheet 3rd verse"}, {id = "lunar staff", chance = 120}, {id = "amber staff", chance = 680}, {id = "cultish robe", chance = 10080}, {id = "cultish symbol", chance = 90}, {id = "rope belt", chance = 10000}, {id = "broken key ring", chance = 120} }The converter reads in the comments after each loot line and shoves it into the description field. I didn't realize description was used as a synonym of text in revscriptsys because it not in xml. TFS engine is choking because text is being set on items that can't be written. I will fix that with the ot monster converter
edit2: Beyond that there seems to be other issues with TFS revscriptsys. I can't get the converted
Abyssadorto load either but I couldn't pinpoint the issue to any particular table. When i removed the tables one at a time tfs doesn't load but If I remove several tables at once it loads.
ok i delete all discription from code and try again. I write results when i finished
and i think
<item name="small ruby" chance="320" />
{name = "small ruby", chance = 320},
ok i delete all discription from code and try again. I write results when i finished
I have it fixed in PR soul4soul/ot-monster-converter/pull/77
and i think
<item name="small ruby" chance="320" />{name = "small ruby", chance = 320},
It's still defined using id, see the example file https://github.com/otland/forgottenserver/blob/master/data/monster/lua/%23example.lua#L47-L48
But still I think there could be something wrong with the TFS side.
ok i delete all discription from code and try again. I write results when i finished
I have it fixed in PR soul4soul/ot-monster-converter/pull/77
and i think
<item name="small ruby" chance="320" />{name = "small ruby", chance = 320},It's still defined using
id, see the example file https://github.com/otland/forgottenserver/blob/master/data/monster/lua/%23example.lua#L47-L48But still I think there could be something wrong with the TFS side.
i dont know where is a problem but this script .lua work perferct
`
local mType = Game.createMonsterType("pharaoh")
local monster = {}
monster.name = "Pharaoh"
monster.description = "Pharaoh"
monster.experience = 1650
monster.outfit = {
lookType = 90,
lookHead = 0,
lookBody = 0,
lookLegs = 0,
lookFeet = 0,
lookAddons = 0,
lookMount = 0
}
monster.health = 1600
monster.maxHealth = 1600
monster.runHealth = 0
monster.race = "undead"
monster.corpse = 6025
monster.speed = 320
monster.summonCost = 0
monster.changeTarget = {
interval = 5000,
chance = 8
}
monster.flags = {
attackable = true,
hostile = true,
summonable = false,
convinceable = false,
illusionable = false,
boss = false,
ignoreSpawnBlock = false,
pushable = false,
canPushItems = true,
canPushCreatures = true,
staticAttackChance = 90,
targetDistance = 1,
healthHidden = false,
canWalkOnEnergy = false,
canWalkOnFire = false,
canWalkOnPoison = false
}
monster.light = {
level = 0,
color = 0
}
monster.voices = {
interval = 2000,
chance = 7,
{text = "You will become a feast for my maggots.", yell = false}
}
monster.immunities = {
{type = "paralyze", condition = true},
{type = "outfit", condition = false},
{type = "invisible", condition = true},
{type = "drunk", condition = true},
{type = "bleed", condition = false}
}
monster.elements = {
{type = COMBAT_PHYSICALDAMAGE, percent = 0},
{type = COMBAT_ENERGYDAMAGE, percent = 20},
{type = COMBAT_EARTHDAMAGE, percent = 100},
{type = COMBAT_FIREDAMAGE, percent = -10},
{type = COMBAT_LIFEDRAIN, percent = 0},
{type = COMBAT_MANADRAIN, percent = 0},
{type = COMBAT_DROWNDAMAGE, percent = 0},
{type = COMBAT_ICEDAMAGE, percent = -10},
{type = COMBAT_HOLYDAMAGE , percent = -20},
{type = COMBAT_DEATHDAMAGE , percent = 100}
}
monster.attacks = {
{name ="melee", interval = 2000, chance = 100, minDamage = -60, maxDamage = -251},
{name ="combat", interval = 2000, chance = 25, type = COMBAT_EARTHDAMAGE, minDamage = -150, maxDamage = -200, range = 7, shootEffect = CONST_ANI_POISON, effect = CONST_ME_POISONAREA},
{name ="combat", interval = 3000, chance = 17, type = COMBAT_EARTHDAMAGE, minDamage = 0, maxDamage = -292, length = 8, spread = 3, effect = CONST_ME_POISONAREA},
{name ="condition", interval = 1000, chance = 15, type = CONDITION_POISON, startDamage = 0, tick = 4000, minDamage = -34, maxDamage = -34, radius = 5, target = false, effect = CONST_ME_POISONAREA},
{name ="speed", interval = 1000, chance = 6, speed = {min = -400, max = -400}, duration = 20000, range = 7, effect = CONST_ME_MAGIC_RED}
}
monster.defenses = {
defense = 30,
armor = 20,
{name ="combat", interval = 2000, chance = 20, type = COMBAT_HEALING, minDamage = 150, maxDamage = 350, effect = CONST_ME_MAGIC_BLUE}
}
monster.loot = {
{id = 2148, chance = 91000, maxCount = 238, description = "gold coin"},
{id = 2411, chance = 20000, description = "poison dagger"},
{id = 2149, chance = 9000, maxCount = 3, description = "small emerald"},
{id = 7591, chance = 8000, description = "great health potion"},
{id = 2169, chance = 4320, description = "time ring"},
{id = 2409, chance = 3600, description = "serpent sword"},
{id = 2451, chance = 1200, description = "djinn blade"},
{id = 2155, chance = 240, description = "green gem"},
{id = 11207, chance = 100, description = "mini mummy"}
}
mType:register(monster)
edit2
Is funny after convert some monster.xml to monster.lua is work but i get new funny error problem with Segmentation fault