×
×
• Create New...
• 0

# help event quest

## Question

```when login begin
local boss = {101, 102, 103, 104}
local escolha = math.random(1,1)
if escolha == 1 then
pc.setqf("state", 20)
q.set_counter("eventkill:", 20)
say("kill mob"..boss[math.random(1,4)].."")
end
end
when "..boss[math.randam(1,4)]..".kill begin
local count = pc.getqf("state") - 1            if count <= 20 then

pc.setqf("state", count)
q.set_counter("eventkill", -count)

end

if count == 0 then
local itens =  {27005, 200},{27002, 200},{27006, 100},{27003, 100}
pc.give_item2(itens[math.random(1,4)], itens)
end
end
end

```

help ?

## Recommended Posts

• 0

The quest is totally wrong. Try this one:

```quest yourquest begin
local boss = {101, 102, 103, 104}
local escolha = math.random(1,1) -- math.random(1,1) is always 1... dou you really want this??
if escolha == 1 then
local mob = boss[number(1,table.getn(boss)]
pc.setqf("mob", mob)
pc.setqf("state", 20)
q.set_counter("eventkill:", 20)
say("kill mob"..mob_name(mob).."")
end
end

when kill with not npc.is_pc() begin
local mob = pc.getqf("mob")
if mob == 0 or npc.get_race() ~= mob then return end

local count = pc.getqf("state") - 1
if count <= 20 then
pc.setqf("state", count)
q.set_counter("eventkill", -count)
end
if count == 0 then
local itens =  {{27005, 200},{27002, 200},{27006, 100},{27003, 100}}
local reward = number(1,table.getn(itens))
pc.give_item2(itens[reward], itens[reward])
pc.delqf("mob")
pc.delqf("state")
end
end
end```

I've just fixed the errors, but this quest is still a sh!t. Look at a hunting quest and modify to your needs.

• 1

\$ uptime
1:26AM  up 732 days,  8:29, 1 user, load averages: 0.38, 0.31, 0.22

\$ uname -srp
FreeBSD 9.1-RELEASE amd64

##### Share on other sites

• 0
• Moon
when "..boss[math.randam(1,4)]..".kill begin

the number should be specified.
```when 101.kill or 102.kill or 103.kill or 104.kill begin.
vnum = mob_vnum()
xxxx
end```

• 1
##### Share on other sites

• 0

thanks

error :

local mob = boss[number(1,table.getn(boss)]

fix :

local mob = boss[number(1,table.getn(boss))]

## Create an account

Register a new account

1. 162

2. 3

3. 2

4. 2

5. 7

6. 0

7. 0

8. 0

9. 32