Hi, could you help me edit that script?
Could you edit for me reward function to be in % chance, for example for first saga i will have 10% chance to receive 2160 item.
TFS 0.3.6
nagrodaStorage = 33333; -- storage nagrod - reward storage
lib
and here is creaturescript
Could you edit for me reward function to be in % chance, for example for first saga i will have 10% chance to receive 2160 item.
TFS 0.3.6
nagrodaStorage = 33333; -- storage nagrod - reward storage
lib
Lua:
nsaga = 37845; -- glowny storage saga
nagrodaStorage = 33333; -- storage nagrod
saga_tokeny = 378123; -- tokeny
sagi = {
[-1] = {Chapter = 1,subname = "Beginning the adventure", name = "Emperor Pilaf Saga",opis = "Go to Mount Pazou and talk to a young boy with a tail, your adventure will start there."},
[0] = {Chapter = 1,nagroda = {2160,10},subname = "Beginning the adventure", name = "Emperor Pilaf Saga", opis = "Help Goku and Bulma collect dragon balls."},
[1] = {Chapter = 1,subname = "Beginning the adventure", name = "Emperor Pilaf Saga", opis = "Help Turtle."},
[2] = {Chapter = 1,nagroda = {2160,10},subname = "Beginning the adventure", name = "Emperor Pilaf Saga", opis = "Defeat a Bear Thief!"},
[3] = {Chapter = 1,subname = "Beginning the adventure", name = "Emperor Pilaf Saga", opis = "Talk to Mr. Roshi."},
[4] = {Chapter = 2,nagroda = {2160,12},subname = "Taking on Oolong", name = "Emperor Pilaf Saga", opis = "Go through Aru Village to Diablo Desert."},
[5] = {Chapter = 2,subname = "Taking on Oolong", name = "Emperor Pilaf Saga", opis = "Villagers thinks of you as of Oolong, talk to Grandma Paozu."},
[6] = {Chapter = 2,subname = "Taking on Oolong", name = "Emperor Pilaf Saga", opis = "Disguise yourself to look same as Oolong's next target."},
[7] = {Chapter = 2,nagroda = {2160,15},subname = "Taking on Oolong", name = "Emperor Pilaf Saga", opis = "Go to Grandma Paozu house and find clothes for change."},
[8] = {Chapter = 2,subname = "Taking on Oolong", name = "Emperor Pilaf Saga", opis = "Surprise Oolong and defeat him!"},
[9] = {Chapter = 2,nagroda = {2160,17},subname = "Taking on Oolong", name = "Emperor Pilaf Saga", opis = "Put oolong clothes back to house where you got them."},
[10] = {Chapter = 2,nagroda = {2160,18},subname = "Taking on Oolong", name = "Emperor Pilaf Saga", opis = "Talk to Grandma Paozu."},
[11] = {Chapter = 2,nagroda = {2160,19},subname = "Taking on Oolong", name = "Emperor Pilaf Saga", opis = "Talk to Oolong."},
[12] = {Chapter = 3,subname = "", name = "Dangers in the Diablo Desert", opis = "Bulma passed out, and youl fell into desert bandit trap!"},
[13] = {Chapter = 3,subname = "", name = "Dangers in the Diablo Desert", opis = "Defeat Yamcha."},
[14] = {Chapter = 3,subname = "Bulma wakes up!", name = "Dangers in the Diablo Desert", opis = "Yamcha fell into rage and try to kill you again, but then he saw Bulma, and ran away."},
[15] = {Chapter = 3,subname = "Yamcha stalks you", name = "Dangers in the Diablo Desert", opis = "Defeat yamcha for the second time."},
[16] = {Chapter = 3,nagroda = {2346,1},subname = "Yamcha surrendered.", name = "Dangers in the Diablo Desert", opis = ""},
[17] = {Chapter = 4,subname = "", name = "The destruction of Fire Mountain", opis = "----NOT DONE YET ---- Convince Oolong to come with you."},
[18] = {Chapter = 4,subname = "", name = "The destruction of Fire Mountain", opis = "Convince Oolong to come with you."},
[19] = {Chapter = 4,subname = "", name = "The destruction of Fire Mountain", opis = "Ox-King arrived, defend yourself!"},
[20] = {Chapter = 4,subname = "Ox-King's favor", name = "The destruction of Fire Mountain", opis = ""},
[21] = {Chapter = 4,subname = "", name = "The destruction of Fire Mountain", opis = "Talk to Goku and let him go with Chi-Chi instead of you."},
[22] = {Chapter = 4,subname = "", name = "The destruction of Fire Mountain", opis = "Talk with Mr. Roshi"},
[23] = {Chapter = 4,subname = "Find sixthT Dragon Ball.", name = "The destruction of Fire Mountain", opis = "Ask bulma for dragon ball radar."},
[24] = {Chapter = 5,subname = "Head to the Monster Carrot's Village", name = "Conflict with the Rabbit Mob", opis = "Villagers are afraid of Bulma because of what she looks like."},
[25] = {Chapter = 5,subname = "", name = "Conflict with the Rabbit Mob", opis = "Talk to the Villager."},
[26] = {Chapter = 5,subname = "", name = "Conflict with the Rabbit Mob", opis = "Take Bulma to the clothes store."},
[27] = {Chapter = 5,subname = "Rabbit Mob bullies", name = "Conflict with the Rabbit Mob", opis = "Defeat two members of Rabbit Mob that are bullying the villagers"},
[28] = {Chapter = 5,subname = "", name = "Conflict with the Rabbit Mob", opis = "Defeat Rabbit Mob boss, the Carrot Master."},
[29] = {Chapter = 6,subname = "", name = "Emperor Pilaf and the Eternal Dragon", opis = "Leave the village and head north to find last dragon ball!"},
[30] = {Chapter = 6,subname = "", name = "Emperor Pilaf and the Eternal Dragon", opis = "You fell into a Pilaf trap!"},
[31] = {Chapter = 6,subname = " You are asleep", name = "Emperor Pilaf and the Eternal Dragon", opis = "Pilaf used sleeping gas in order to steal your dragon balls!"},
[32] = {Chapter = 6,subname = "", name = "Emperor Pilaf and the Eternal Dragon", opis = "Pilaf summoned an Shenlong, make wish before him! Head north to the Pilaf Castle, you have 4 minutes to get there."},
[33] = {Chapter = 6,subname = "Make your wish.", name = "Emperor Pilaf and the Eternal Dragon", opis = ""},
[34] = {Chapter = 6,subname = "", name = "Emperor Pilaf and the Eternal Dragon", opis = "Go back to the rest of group and talk with them"},
[35] = {Chapter = 6,subname = "Goku turned into Oozaru!", name = "Emperor Pilaf and the Eternal Dragon", opis = "Defeat Goku in form of Oozaru!"},
[36] = {Chapter = 6,subname = "It's time to go home!", name = "Emperor Pilaf and the Eternal Dragon", opis = "Talk with Bulma"},
}
function sagaNumber(cid)
return getPlayerStorageValue(cid,nsaga)
end
function ktoraSaga(cid,nsaga)
nsaga = getPlayerStorageValue(cid,nsaga)
return nsaga
end
function realSagaStorageReward(cid)
return nagrodaStorage - sagaNumber(cid)
end
function shouldGetReward(cid)
if getPlayerStorageValue(cid,realSagaStorageReward(cid)) == -1 and ktoraSaga(cid,nsaga) ~= -1 then
return true
else
return false
end
end
function giveSagaReward(cid)
if sagi[ktoraSaga(cid,nsaga) - 1].nagroda ~= nil then
local pid = sagi[ktoraSaga(cid,nsaga) - 1].nagroda
doPlayerAddItem(cid, pid[1], pid[2], true)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You get Saga reward!")
doPlayerSetStorageValue(cid, realSagaStorageReward(cid), 2)
end
end
function upgradeSaga(cid)
doSendMagicEffect(getCreaturePosition(cid), 160)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Saga sheet updated! You get 1 Saga Point")
doPlayerSetStorageValue(cid, nsaga, getPlayerStorageValue(cid,nsaga)+1)
doPlayerSetStorageValue(cid, saga_tokeny, getPlayerStorageValue(cid,saga_tokeny)+1)
return true
end
function downgradeSaga(cid)
doSendMagicEffect(getCreaturePosition(cid), 160)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Saga sheet updated!")
doPlayerSetStorageValue(cid, nsaga, getPlayerStorageValue(cid,nsaga)-1)
return true
end
and here is creaturescript
Lua:
function onKill(cid, target)
local swirustabelka = {
["Raditz"] = {id = 2172, ile = 1, exp = 600000},
["Mankey"] = {id = 0, ile = 0, exp = 400000},
["Gregory"] = {id = 0, ile = 0, exp = 450000},
["Nappa"] = {id = 2424, ile = 1, exp = 1000000},
["Vegeta"] = {id = 0, ile = 0, exp = 1300000},
["Vegeta Oozaru"] = {id = 2450, ile = 1, exp = 1550000},
["Dodoria"] = {id = 2362, ile = 100, exp = 1800000},
["Zarbon"] = {id = 2160, ile = 25, exp = 2300000},
["Ginyu Force"] = {id = 2160, ile = 40, exp = 5200000},
["Freezer First Form"] = {id = 0, ile = 0, exp = 8200000},
["Freezer Second Form"] = {id = 0, ile = 0, exp = 10200000},
["Freezer Third Form"] = {id = 0, ile = 0, exp = 14200000},
["Freezer Last Form"] = {id = 0, ile = 0, exp = 19000000},
["Metal Freezer"] = {id = 0, ile = 0, exp = 25000000}
}
local swiry = swirustabelka[getCreatureName(target)]
if(swiry ~= nil) then
setGlobalStorageValue(swiry.id, 1)
if swiry.id > 100 then
doPlayerAddItem(cid, swiry.id, swiry.ile)
end
if swiry.exp > 0 then
doPlayerSay(cid, '+' .. swiry.exp .. ' EXP!', TALKTYPE_ORANGE_1)
doPlayerAddExperience(cid, swiry.exp)
end
return true
else
return true
end
end
Last edited: