SorinSmon 493 Posted January 16, 2020 Share Posted January 16, 2020 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 Share on other sites More sharing options...
Kori 170 Posted January 16, 2020 Share Posted January 16, 2020 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 2 Link to comment Share on other sites More sharing options...
Premium Syreldar 1870 Posted January 16, 2020 Premium Share Posted January 16, 2020 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 1 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 Link to comment Share on other sites More sharing options...
SorinSmon 493 Posted January 16, 2020 Author Share Posted January 16, 2020 work perfectly. ty guys highly respect! you can close this topic as solved! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now