Saját vadász küldetés?

Indította RealKorf, 2018-06-13, 21:59:04

Sziasztok.
Questeknél, milyen függvénnyel, és hogyan tudnám elmenteni, ha valaki megöl egyet az adott szörnyből?

Válaszokat előre is köszönöm!

Questflag esetleg? :o

Üzenet összefésülés: 2018-06-13, 22:55:07

De itt a lv2-es vadászküldi példaként:
quest main_quest_lv2 begin
state start begin
end
state run begin
when login or levelup or enter with pc.get_level() >= 2 begin
set_state ( gototeacher )
end
when 20354.chat.gameforge.main_quest_lv2._10_npcChat with pc.get_level() < 2 begin
say_title(gameforge.main_quest_lv1._60_sayTitle)
say(gameforge.main_quest_lv2._20_say)
end
end
state gototeacher begin
when letter begin

send_letter(gameforge.main_quest_lv2._30_sendLetter)
local v=find_npc_by_vnum(20354)
if 0==v then
else
target.vid("__TARGET__", v, gameforge.main_quest_lv2._40_targetVid)
end
end
when button or info begin
say_title(gameforge.main_quest_lv2._30_sendLetter)
say_reward(gameforge.main_quest_lv2._50_sayReward)
end
when __TARGET__.target.click begin
target.delete("__TARGET__")

say_title(gameforge.main_quest_lv1._60_sayTitle)
say(gameforge.main_quest_lv2._60_say)
wait()

say_title(gameforge.main_quest_lv1._60_sayTitle)
say(gameforge.main_quest_lv2._70_say)
wait()
say_title(gameforge.buy_fishrod._210_sayTitle)
say_reward(gameforge.main_quest_lv2._80_sayReward)
say_reward(string.format(gameforge.main_quest_lv2._90_sayReward,item_name(27001), 15))
say_item(item_name(27001),27001,"")
set_state ( killdog )

pc.setqf("state", 0)
q.set_counter(gameforge.main_quest_lv2._95_counter, 0)
end

end

state killdog begin
when letter begin
send_letter(gameforge.main_quest_lv2._100_sendLetter)
end
when button or info begin
say_title(gameforge.main_quest_lv2._110_sayTitle)
say(gameforge.main_quest_lv2._120_sayReward)
say_reward(string.format(gameforge.main_quest_lv2._130_sayReward, pc.getqf("state")))
end
when 101.kill begin
local count = pc.getqf("state") + 1

if count <= 9 then
pc.setqf("state", count)
q.set_counter(gameforge.main_quest_lv2._135_counter, 9 - count)

if count == 9 then
say_title(gameforge.main_quest_lv2._140_sayTitle)
say(gameforge.main_quest_lv2._150_sayReward)
set_state (gototeacher2)
end
end
end
when 20354.chat.gameforge.main_quest_lv2._160_npcChat with pc.getqf("state") < 9 begin
say_title(gameforge.main_quest_lv1._60_sayTitle)

say(gameforge.main_quest_lv2._170_say)
if pc.is_gm() then
wait()
say_title(gameforge.main_quest_lv2._180_sayTitle)
say(gameforge.main_quest_lv2._182_say)
local s =  select(gameforge.locale.guild.yes, gameforge.locale.guild.no)
if s == 1 then
set_state (gototeacher2)
end
end
end
when 20354.chat.gameforge.main_quest_lv2._160_npcChat with pc.getqf("state") >= 9 begin
say_title(gameforge.main_quest_lv1._60_sayTitle)
say(gameforge.main_quest_lv2._190_say)
set_state (gototeacher2)
end
end
state gototeacher2 begin
when letter begin
local v=find_npc_by_vnum(20354)
if 0==v then
else
target.vid("__TARGET__", v, gameforge.main_quest_lv2._40_targetVid)
end
end
when letter begin
send_letter(gameforge.main_quest_lv2._200_sendLetter)
end
when button or info begin
say_title(gameforge.main_quest_lv2._200_sendLetter)
say_reward(gameforge.main_quest_lv2._150_sayReward)
end
when __TARGET__.target.click begin
target.delete("__TARGET__")

say_title(gameforge.main_quest_lv1._60_sayTitle)
say(gameforge.main_quest_lv2._210_say)
wait()
say_title(gameforge.collect_herb_lv4._130_sayTitle)
say_reward(gameforge.main_quest_lv2._220_sayReward)
say_reward(string.format(gameforge.main_quest_lv2._230_sayReward, item_name(27001), 15))
say_item(item_name(27001),27001,"")


pc.give_exp2( 250 )
pc.change_money( 1000 )
pc.give_item2( 27001 ,15 )
pc.setqf("state", 0)

clear_letter()
set_state (__COMPLETE__)
set_quest_state("main_quest_lv3","run")

end
end
state __COMPLETE__ begin
end
end



Ez alapján kezdtem el egyet írni. Én pc.setqf / getqf ekkel csináltam meg.
Szerinted jobb lenne, amit te javasoltál?

2018-06-13, 23:08:46 #3 Utolsó szerkesztés: 2018-06-13, 23:20:19 Szerző: 5310pati
Ugyanazt mondtam :-X :-\ :'(
questflag -> qf -> setqf / getqf

Üzenet összefésülés: 2018-06-13, 23:20:19

Valami ilyesmi:
quest asd begin
state start begin
when letter with pc.get_level() >= 2 begin
send_letter("Asd")
end

when button or info begin
say("...")
local s = select("10 x Kutya", "5 x Farkas")
if s == 1 then
pc.setqf("dog", 0)
set_state(state_dog)
else
pc.setqf("wolf", 0)
set_state(state_wolf)
end
end

state state_dog begin
when kill with npc.get_race() == 101 begin
local cnt = pc.getqf("dog") + 1
if cnt < 10 then
pc.setqf("dog", cnt)
q.set_counter(mob_name(101), 10 - cnt)
elseif cnt == 10 then
-- jutalomadás
set_state(__DONE__)
end
end
end

state state_wolf begin
when kill with npc.get_race() == 102 begin
local cnt = pc.getqf("wolf") + 1
if cnt < 5 then
pc.setqf("wolf", cnt)
q.set_counter(mob_name(102), 5 - cnt)
elseif cnt == 5 then
-- jutalomadás
set_state(__DONE__)
end
end
end

state __DONE__ begin
end
end

Lehet benne elírás/hiba, nem teszteltem. :-X

Köszönöm szépen a segítséget!