Jump to content

Recommended Posts

  • Active Member

Hello guys..

A little help? is a simple quest i think..

A quest with  "item use" uses to spawn a random boss from the list quest.. just x1 not all and from a list of idk 5-10 boss. and to spawn close by the player when the player use that item to disappear after.

Link to comment
https://metin2.dev/topic/22625-quest-item-to-spawn-random-boss/
Share on other sites

  • Active+ Member
1 hour ago, SorinSmon said:

Hello guys..

A little help? is a simple quest i think..

A quest with  "item use" uses to spawn a random boss from the list quest.. just x1 not all and from a list of idk 5-10 boss. and to spawn close by the player when the player use that item to disappear after.

I'm not the best in lua I have search for you in Google for a random function. 

 

You can make a quest and with this function 

 

local myTable = { "one", "two", "three","four"}

 

local keyset = {}

for k in pairs(myTable) do

    table.insert(keyset, k)

end

 

random_elem = myTable[keyset[math.random(#keyset)]]

print(random_elem)

 

 

You can use the myTable for the vnums 

  • Love 2
  • Honorable Member
quest spawn_boss begin
    state start begin
        function GetRandomBossVnum()
           local boss_vnums = {591, 1091}; -- Add as many as you like.
  
            -- https://metin2.dev/board/index.php?/topic/15905-functionssyreldars-quest-functions/ - table_get_random_item(table_ex)
            return table_get_random_item(boss_vnums);
        end -- function

        when ITEMVNUM.use begin -- Set your vnum, has to be type 18 in item_proto to work as a quest item.
            pc.remove_item(item.get_vnum(), 1);
            
            -- Spawn a random aggressive boss in 5 units radius from player posision.
            mob.spawn(spawn_boss.GetRandomBossVnum(), pc.get_local_x(), pc.get_local_y(), 5, 1, 1);
        end -- when
    end -- state
end -- quest

 

  • Good 1
  • Love 5

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.