Jump to content

Sherer

Inactive Member
  • Posts

    112
  • Joined

  • Last visited

  • Days Won

    3
  • Feedback

    0%

Posts posted by Sherer

  1. Generate 2 sets and shuffle one of them.
     

    local tabA = {} local tabB = {}
    for i = 1, 5 do
    	table.insert(tabA, i)
    	table.insert(tabB, i)
    end
    
    -- Shuffle second tab with Yates-Fisher
    for i = table.getn(tabB), 2, -1 do
    	local j = math.random(i)
    	tabB[j], tabB[i] = tabB[i], tabB[j]
    end
    
    print("Table A:")
    for k, v in pairs(tabA) do
    	print(string.format("[%d] = %d", k, v))
    end
    print("Table B:")
    for k, v in pairs(tabB) do
    	print(string.format("[%d] = %d", k, v))
    end

     

    • Love 1
  2. Simply use vid to bind spawned npc to a player (mob.spawn returns monster's vid in case if one was spawned and zero if spawned was somehow unsuccessful).

    quest npcspawn begin
    	state start begin
    		when letter begin
    			send_letter("NpcSpawn")
    		end
    		when button or info begin
    			local x = (pc.get_local_x())
    			local y = (pc.get_local_y())
    			local iVID = mob.spawn(4001, x+2, y+2, 2, 2, 1)
    			if iVID == 0 then
    				say("Cannot spawn.")
    			else
    				pc.setqf("spawnedVID", iVID)
    			end
    		end
    		when 4001.click begin
    			if npc.get_vid() == pc.getqf("spawnedVID") then
    				say("jonapot")
    				wait()
    				say("aviszontlátásra")
    				wait()
    				game.set_event_flag("player", 0)
    				npc.purge()
    			end
    		end
    	end
    end
    • Metin2 Dev 1
    • Good 1
  3. 4 minutes ago, CHKRZ said:

    I guess you missunderstood.

    I dont want it to be behind the inventory but before, and that all the time.

    Kind regards.

    You are right my bad.
    What you can do from C++ level is to add additional flag like "TOP_SUPER" on indicate it during rendering process to no other window will be displayed above it (or the window with flag above will we rendered at the end of tick).

    • Love 1
  4. 1 hour ago, Speachless said:

     

    There is a bug when you have CD/DVD-ROM with letter D on some sources the game will work very bad. This is the main reason of the tutorial, however nobody has any obligation to use my code.

    Yeah that's pretty normal. Anyway had one builds its client files should not be read from disk at all (security reason; with exception for whitelist).

×
×
  • 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.