Skrypty & Kody Jak wy??czy? event?

Status
Zamknięty.

sStempels

Active User
Zarejestrowany
Dołączył
Marzec 25, 2009
Posty
61
Liczba reakcji
2
Witam. Potrzebuj? pomocy jak wy??czy? addEvent. Posiadam 2x skrypty (actions, creaturescripts) dla pewnego potwora. W jednym i w drugim po spelnieniu pewnej funkcji w??cza si? addevent. Chcia?bym aby po zabiciu potwora wy??cza?y si? obydwa eventy. Z g?ry dzi?kuje.(pr?bowa?em if getCreatureMaxHealth(cid) == 0 then stopEvent(), oraz function onKill ale mo?e co? zle napisalem)
 
Odp: Jak wy??czy? event?

U?yj zmiennej globalnej.
PHP:
event = addEvent(...)
stopEvent(event)
 
Odp: Jak wy??czy? event?

Niestety nie dzia?a ..
 
Ostatnia edycja:
Odp: Jak wy??czy? event?

Kod:
Micha? (Stempel)
16:39:10
potrzebuje skryptu, ze jak zabije monsterka eventy si? wy??czaja
16:39:23
eventy s? w 2 plikach creaturescript i actions
16:39:58
bo napisa?em skrypt na lapanie potwork?w z ograniczonym czasem na z?apanie

Nie znam kodu, ale chodzi ci pewnie o ?apanie potworka jako quest czasowy.
Dodaj do kodu na lapanie:
Kod:
if (getPlayerStorageValue(cid, 99299) >= os.time()) then
+ gdy z?apie:
Kod:
setPlayerStorageValue(cid, 99299, 1)
(Mo?esz tym od razu sprawdza? u NPC czy z?apa?)

A przy dawaniu questa:
Kod:
setPlayerStorageValue(cid, 99299, os.time()+CZAS W SEC)
 
Ostatnia edycja:
Odp: Jak wy??czy? event?

Nadal problem nie zosta? rozwi?zany.
Oto skrypt:
PHP:
local pets = {

['Wolf'] = {hp = 150, id = 11389, shp = 25, czas = 3, chance = 80},
['Spider'] = {hp = 200, id = 11390, shp = 20, czas = 30, chance = 80},
['Green Frog'] = {hp = 250, id = 11390, shp = 60, czas = 30, chance = 80},
['Skeleton'] = {hp = 300, id = 11390, shp = 50, czas = 30, chance = 80},
['Rotworm'] = {hp = 400, id = 11389, shp = 65, czas = 30, chance = 80},

['Orc'] = {hp = 500, id = 11390, shp = 70, czas = 40, chance = 65},
['Dwarf'] = {hp = 600, id = 11390, shp = 90, czas = 40, chance = 65},
['Dworc Venomsniper'] = {hp = 700, id = 11390, shp = 80, czas = 40, chance = 65},
['Acid Blob'] = {hp = 800, id = 11390, shp = 250, czas = 40, chance = 65},
['Beholder'] = {hp = 1000, id = 11390, shp = 260, czas = 40, chance = 65},

['Novice Of The Cult'] = {hp = 1500, id = 11390, shp = 285, czas = 60, chance = 50},
['Ghoul'] = {hp = 1600, id = 11390, shp = 100, czas = 60, chance = 50},
['dragon lord hatchling'] = {hp = 1800, id = 11390, shp = 750, czas = 60, chance = 50},
['Witch'] = {hp = 2000,  id = 11390, shp = 300, czas = 60, chance = 50},
['Banshee'] = {hp = 2500, id = 11390, shp = 1000, czas = 60, chance = 50},

['fire elemental'] = {hp = 3500, id = 11390, shp = 280, czas = 120, chance = 35},
['Slick Water Elemental'] = {hp = 3500, id = 11390, shp = 550, czas = 120, chance = 35},
['Green Djinn'] = {hp = 5000, id = 11390, shp = 330, czas = 120, chance = 35},
['Mummy'] = {hp = 6000, id = 11390, shp = 240, czas = 120, chance = 35},
['lostsoul'] = {hp = 10000, id = 11390, shp = 5800, czas = 120, chance = 35},
['Nightmare Scion'] = {hp = 12000, id = 11390, shp = 1400, czas = 120, chance = 35},

['Grim Reaper'] = {hp = 25000, id = 11389, shp = 4100, czas = 180, chance = 20}
}
function onUse(cid, item, fromPosition, itemEx, toPosition, target)

for monstername, a in pairs(pets) do
if isMonster(itemEx.uid) and getCreatureName(itemEx.uid) == monstername and item.itemid == a.id and getCreatureMaxHealth(itemEx.uid) == a.shp then
doPlayerSetStorageValue(itemEx.uid, 1000, 1)
doPlayerRemoveItem(cid, 11389, 1)
setCreatureMaxHealth(itemEx.uid, a.hp)
maxhp = getCreatureMaxHealth(itemEx.uid)
doCreatureAddHealth(itemEx.uid, maxhp)
doCreatureSay(itemEx.uid, 'Zaczoles oswajac '..getCreatureName(itemEx.uid)..'. Masz na to '..a.czas..' sekund', TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(itemEx.uid), 3)

function monsterek(cid)
if itemEx == true then
doRemoveCreature(itemEx.uid)
end
end
addEvent(monsterek, a.czas*1000, cid)

elseif isMonster(itemEx.uid) and getCreatureName(itemEx.uid) == monstername and getCreatureMaxHealth(itemEx.uid) > a.shp then
doCreatureSay(cid, 'Juz zaczoles lapac tego potwora', TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(itemEx.uid), 1)
doCreatureSay(cid, 'Juz zaczoles lapac tego potwora', TALKTYPE_ORANGE_1)

end
end
return true
end

w linii 42 zaczyna si? funkcja do eventu. Nie wiem jak napisa? aby po zabiciu potwora przed czasem by? stopEvent(). REP dla tego kto pomo?e.
 
Odp: Jak wy??czy? event?

Spr?buj funkcji
Kod:
stopEvent(monsterek)
 
Odp: Jak wy??czy? event?

Temat do zamkni?cia. Doda?em storagevalue, ?e funkcja dzia?a gdy storage ma xxx a po zabiciu potwora wraca do poprzedniego stanu. BY? TO POMYS? DOUBLER chwa?a mu za to ;d
 
Status
Zamknięty.
Back
Do góry