nie ma czegoś takiego jak math.random(2)
Mam chyba popsute lua bo u mnie jest.
nie ma czegoś takiego jak math.random(2)
local MOUNTS = {
["undead cavebear"] = {id = 12, tame = 10, remov = 5, escape = 30, again = 55, name = "Undead Cavebear",effect = CONST_ME_POFF},
}
function onUse(cid,item,fromPosition,itemEx,toPosition)
if(not isCreature(itemEx.uid) or getPlayerName(getCreatureMaster(itemEx.uid))) then
return false
end
mount = MOUNTS[getCreatureName(itemEx.uid):lower()]
if(not mount) then
return false
end
rand = math.random (1,2)
if rand == 1 then
rand = math.random (0,4)
if rand == 1 or rand == 4 or rand == 3 then
doPlayerSay(cid,"uciekl",TALKTYPE_ORANGE_1)
end
else
doPlayerSay(cid,"oswojony",TALKTYPE_ORANGE_1)
end
return true
end
Mam chyba popsute lua bo u mnie jest.
i kiedy ktoś piszę że math.random(10) to 10 mozliwości to jak mu wytłumaczysz, że jest w błędzie?
lepiej zastosować lekką ścieme aby uniknąć nudnych tłumaczeń
if (math.random(100) <= 10) then
doCreatureSay(cid,"tame",TALKTYPE_ORANGE_1)
elseif (math.random(100) <= 5) then
doCreatureSay(cid,"remove",TALKTYPE_ORANGE_1)
elseif (math.random(100) <= 30) then
doCreatureSay(cid,"escape",TALKTYPE_ORANGE_1)
else
doCreatureSay(cid,"again",TALKTYPE_ORANGE_1)
end