Jump to content

Syreldar

Premium
  • Posts

    1298
  • Joined

  • Last visited

  • Days Won

    38
  • Feedback

    100%

Posts posted by Syreldar

  1. Teleport Portals are special kind of NPCs.

     

    To create one:

    1. Go to the coordinates you want the portal to warp to.
    2. Write /state and look for your coordinates. You should see 3 different types of coordinates (Global/Warp/Local Position), what you need is the Warp Position.RKZnYbn.png
    3. Make a mob that has type 0 and battle_type 3 in the mob_proto.
    4. His name and locale_name must be structured like this:

     

    Quote

    name_shown warp_x warp_y

     

    Example:

     

    Quote

    Yayang_Area 4002 8995

     

     

    If you don't want the portal to show any name (it will still work with the said coordinates) put a dot instead of the name_shown, like this:

    Quote

    . 4002 8995

     

  2. 34 minutes ago, Braxy said:

    Not sure what you want to say but i guess we both know LUA's syntax is not that complex lol

     

    Mh?

    Do you REALLY want to say that again?

     

    Quote

    Whatever, Syreldar version is alright but i would avoid that retarded loop anyway so: https://pastebin.com/ngi4ZXvB

     

    "My" version? I merely made your code barely readable and changed it according to what the OP asked for.

    May God strike me with lightning if I ever post/rework something publicly ever again after seeing this.

     

    34 minutes ago, Braxy said:

     

    (Regarding Duplicate bug, that bug only exists if you use pc.change_name function, since the function that changes name is based on SQL there won't be any Duplicate Bugs)

     

    You sure know a lot.

    	ALUA(pc_change_name)
    	{
        	//..
            char szQuery[1024];
    		snprintf(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM player%s WHERE name='%s'", get_table_postfix(), szName);
    		std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
    
    		if ( pmsg->Get()->uiNumRows > 0 )
    		{
    			MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
    
    			int	count = 0;
    			str_to_number(count, row[0]);
    
    			// ÀÌ¹Ì ÇØ´ç À̸§À» °¡Áø ij¸¯ÅÍ°¡ ÀÖÀ½
    			if ( count != 0 )
    			{
    				lua_pushnumber(L, 3);
    				return 1;
    			}
    		}
            //..
    	}

    Because I've always thought pc.change_name also did check for that and many other factors via query (duh, no other way to do that?) and worked pretty fine.

     

    I advise you to add me on Discord or Skype if you feel the need to tell me something, because to tell the truth.. I feel that you have had it for a very long time.

    • Good 1
  3. quest ChangeNameWithVip begin
    	state start begin
    		function isNameAlready(pc_name)
    			local index, value = mysql_direct_query("SELECT player.player.name as name FROM player.player;");
    		   
    			if (index > 0) then
    				for num, str in ipairs(value) do
    					if (string.lower(str.name) == string.lower(pc_name)) then
    						return false;
    					end -- if
    				end -- for
    			end -- if
    			
    			return true;
    		end -- function
    	   
    		function ChangeNameAddVip(new_name)
    			mysql_direct_query(string.format("UPDATE player.player SET name = '%s' WHERE name = '%s';", new_name, pc.get_name()));
    		end -- function
    	   
    		function isVipAlreadyAdded()
    			return pc.getqf("ChangeNameWithVipUsage") ~= 0;
    		end -- function
    	   
    		when 71173.use begin
    			if (ChangeNameWithVip.isVipAlreadyAdded()) then
    				return syschat("Poti adauga gradul [VIP] doar odata pe caracter!");
    			end -- if
    		   
    			say_title(string.format("%s:[ENTER]", item_name(item.get_vnum())))
    			say("Acest obiect ofera posibilitatea de a adauga")
    			say("gradul de [VIP] caracterului tau si")
    			say("cu posibilitatea de a schimba numele precedent.[ENTER]")
    			say("Doresti sa incepi procesul?[ENTER]")
    			if (select("Da", "Nu") == 1) then
    				say_title(string.format("%s:[ENTER]", item_name(item.get_vnum())))
    				say("Introdu numele dorit:[ENTER]")
    				local str_input = string.gsub(input(), "[^A-Za-z0-9]", "");
    				local input_len = string.len(str_input);
    			   
    				if (input_len < 3 or input_len > 7) then
    					return say_reward("The length has to be from 3 to 7 characters.[ENTER]");
    
    				elseif (not ChangeNameWithVip.isNameAlready(string.format("[%s]", str_input))) then
    					return say_reward("Acest nume a fost luat de catre alta persoana.[ENTER]");
    				end -- if/elseif
    			   
    				pc.remove_item(71173, 1);
    				pc.setqf("ChangeNameWithVipUsage", 1);
    				ChangeNameWithVip.ChangeNameAddVip(string.format("[%s]", str_input));
    				say("Adaugarea gradului [VIP] a avut succes.")
    				say("Actualizarea acestuia se face dupa 15 min")
    				say("offline de pe caracter/cont.[ENTER]")
    			end -- if
    		end -- when	
    	end -- state
    end -- quest

    Modifying Braxy's quests is very easy, they're very similiar to mine.. for some reason.

     

    But then again, the guy is still using regex when it's completely unneded and uses a query to change the name instead of using a simple function (pc.change_name), pretty disappointing.

    • Love 2
  4. As I previously stated, you can't expect to receive the quest as soon as you finish the other one without using the proper triggers. you are not even using set_quest_state, so what you're trying to do doesn't make much sense.

     

    You should end your previous quest like this

     

    set_quest_state("diary_lv32_2", "information");

     

    and then:

     

    quest diary_lv32_2 begin
        state start begin
            -- Empty since the quest should only be run after the previous one.
        end -- state
    
        state information begin
            when letter begin
                local v = find_npc_by_vnum(20011)
                if v != 0 then
                    target.vid("__TARGET__", v, "Uriel")
                end
                send_letter_ex(" A titkos napló oldalai #2 ", "blue", "333")
                q.set_icon("scroll_open_blue.tga")
            end -- when
        end
    
        ...
    end

     

    • Love 1
  5. Can you try this one?

     

    BoundingSphereRadius   150.000000
    BoundingSpherePosition 0.000000 0.000000 0.000000
    
    Group Particle
    {
        StartTime           0.000000
        List TimeEventPosition
        {
            0.000000 "MOVING_TYPE_DIRECT" 0.000000 0.000000 80.000000
        }
        
        Group EmitterProperty
        {
            MaxEmissionCount        2
        
            CycleLength             6.000000
            CycleLoopEnable         1
            LoopCount               0
        
            EmitterShape            2
            EmitterAdvancedType     0
            EmittingSize            30.000000 30.000000 50.000000
            EmitterEmitFromEdgeFlag  0
            EmittingDirection       1.000000 1.000000 1.000000
        
            List TimeEventEmittingSize
            {
                0.000000 0.000000
            }
            List TimeEventEmittingAngularVelocity
            {
                0.000000 0.000000
            }
            List TimeEventEmittingDirectionX
            {
                0.000000 0.000000
            }
            List TimeEventEmittingDirectionY
            {
                0.000000 0.000000
            }
            List TimeEventEmittingDirectionZ
            {
                0.000000 26.288660
            }
            List TimeEventEmittingVelocity
            {
                0.000000 0.100000
            }
            List TimeEventEmissionCountPerSecond
            {
                0.000000 20.000000
            }
            List TimeEventLifeTime
            {
                0.000000 0.206186
            }
            List TimeEventSizeX
            {
                0.000000 70.000000
                0.500000 52.577320
            }
            List TimeEventSizeY
            {
                0.000000 70.000000
                0.502857 44.329895
            }
        }
        
        Group ParticleProperty
        {
            SrcBlendType                 3
            DestBlendType                2
            ColorOperationType           4
            BillboardType                0
            RotationType                 4
            RotationSpeed                210.000000
            RotationRandomStartingBegin  90
            RotationRandomStartingEnd    90
        
            AttachEnable                 1
            StretchEnable                0
        
            TexAniType                   1
            TexAniDelay                  0.024000
            TexAniRandomStartFrameEnable 0
        
            List TimeEventGravity
            {
            }
            List TimeEventAirResistance
            {
            }
            List TimeEventScaleX
            {
                0.000000 0.711340
            }
            List TimeEventScaleY
            {
                0.011429 0.649485
            }
            List TimeEventColorRed
            {
                0.489744 0.862745
                1.000000 1.000000
            }
            List TimeEventColorGreen
            {
                0.489744 0.854902
                1.000000 0.866667
            }
            List TimeEventColorBlue
            {
                0.489744 1.000000
                1.000000 0.564706
            }
            List TimeEventAlpha
            {
                0.000000 0.600000
                0.997436 0.000000
            }
            List TimeEventRotation
            {
                0.000000 0.000000
            }
            List TextureFiles
            {
                "D:\Ymir Work\effect\hit\blow_electric\3.dds"
                "D:\Ymir Work\effect\hit\blow_electric\4.dds"
                "D:\Ymir Work\effect\hit\blow_electric\5.dds"
                "D:\Ymir Work\effect\hit\blow_electric\6.dds"
            }
        }
    }
    Group Particle
    {
        StartTime           0.000000
        List TimeEventPosition
        {
            0.000000 "MOVING_TYPE_DIRECT" 0.000000 0.000000 80.000000
        }
        
        Group EmitterProperty
        {
            MaxEmissionCount        1
        
            CycleLength             6.000000
            CycleLoopEnable         1
            LoopCount               0
        
            EmitterShape            2
            EmitterAdvancedType     0
            EmittingSize            30.000000 30.000000 50.000000
            EmitterEmitFromEdgeFlag  0
            EmittingDirection       1.000000 1.000000 1.000000
        
            List TimeEventEmittingSize
            {
                0.000000 0.000000
            }
            List TimeEventEmittingAngularVelocity
            {
                0.000000 0.000000
            }
            List TimeEventEmittingDirectionX
            {
                0.000000 0.000000
            }
            List TimeEventEmittingDirectionY
            {
                0.000000 0.000000
            }
            List TimeEventEmittingDirectionZ
            {
                0.000000 26.288660
            }
            List TimeEventEmittingVelocity
            {
                0.000000 0.200000
            }
            List TimeEventEmissionCountPerSecond
            {
                0.000000 20.000000
            }
            List TimeEventLifeTime
            {
                0.000000 0.154639
            }
            List TimeEventSizeX
            {
                0.000000 70.000000
                0.494286 39.175259
            }
            List TimeEventSizeY
            {
                0.000000 70.000000
                0.500000 38.144329
            }
        }
        
        Group ParticleProperty
        {
            SrcBlendType                 3
            DestBlendType                2
            ColorOperationType           4
            BillboardType                1
            RotationType                 4
            RotationSpeed                185.000000
            RotationRandomStartingBegin  0
            RotationRandomStartingEnd    0
        
            AttachEnable                 1
            StretchEnable                0
        
            TexAniType                   1
            TexAniDelay                  0.024000
            TexAniRandomStartFrameEnable 0
        
            List TimeEventGravity
            {
            }
            List TimeEventAirResistance
            {
            }
            List TimeEventScaleX
            {
                0.108571 1.000000
                0.994286 0.309278
            }
            List TimeEventScaleY
            {
                0.017143 0.597938
                1.000000 0.082474
            }
            List TimeEventColorRed
            {
                0.000000 1.000000
                1.000000 1.000000
            }
            List TimeEventColorGreen
            {
                0.000000 1.000000
                1.000000 0.866667
            }
            List TimeEventColorBlue
            {
                0.000000 1.000000
                1.000000 0.564706
            }
            List TimeEventAlpha
            {
                0.000000 0.600000
                0.943590 0.000000
            }
            List TimeEventRotation
            {
                0.000000 0.000000
            }
            List TextureFiles
            {
                "D:\Ymir Work\effect\hit\blow_electric\1.dds"
                "D:\Ymir Work\effect\hit\blow_electric\2.dds"
                "D:\Ymir Work\effect\hit\blow_electric\3.dds"
            }
        }
    }
    Group Particle
    {
        StartTime           0.000000
        List TimeEventPosition
        {
            0.000000 "MOVING_TYPE_DIRECT" 0.000000 0.000000 80.000000
        }
        
        Group EmitterProperty
        {
            MaxEmissionCount        1
        
            CycleLength             6.000000
            CycleLoopEnable         1
            LoopCount               0
        
            EmitterShape            2
            EmitterAdvancedType     0
            EmittingSize            30.000000 30.000000 50.000000
            EmitterEmitFromEdgeFlag  0
            EmittingDirection       1.000000 1.000000 1.000000
        
            List TimeEventEmittingSize
            {
                0.000000 0.000000
            }
            List TimeEventEmittingAngularVelocity
            {
                0.000000 0.000000
            }
            List TimeEventEmittingDirectionX
            {
                0.000000 0.000000
            }
            List TimeEventEmittingDirectionY
            {
                0.000000 0.000000
            }
            List TimeEventEmittingDirectionZ
            {
                0.000000 26.288660
            }
            List TimeEventEmittingVelocity
            {
                0.000000 0.200000
            }
            List TimeEventEmissionCountPerSecond
            {
                0.000000 20.000000
            }
            List TimeEventLifeTime
            {
                0.002857 0.154639
            }
            List TimeEventSizeX
            {
                0.000000 70.000000
                0.500000 44.329895
            }
            List TimeEventSizeY
            {
                0.000000 70.000000
                0.494286 48.453609
            }
        }
        
        Group ParticleProperty
        {
            SrcBlendType                 3
            DestBlendType                2
            ColorOperationType           4
            BillboardType                2
            RotationType                 4
            RotationSpeed                177.000000
            RotationRandomStartingBegin  0
            RotationRandomStartingEnd    0
        
            AttachEnable                 1
            StretchEnable                0
        
            TexAniType                   1
            TexAniDelay                  0.024000
            TexAniRandomStartFrameEnable 0
        
            List TimeEventGravity
            {
            }
            List TimeEventAirResistance
            {
            }
            List TimeEventScaleX
            {
                0.285714 1.000000
                1.000000 0.154639
            }
            List TimeEventScaleY
            {
                0.000000 0.556701
                0.988571 0.113402
            }
            List TimeEventColorRed
            {
                0.000000 1.000000
                0.997436 1.000000
            }
            List TimeEventColorGreen
            {
                0.000000 1.000000
                0.997436 0.866667
            }
            List TimeEventColorBlue
            {
                0.000000 1.000000
                0.997436 0.564706
            }
            List TimeEventAlpha
            {
                0.000000 0.600000
                0.946154 0.000000
            }
            List TimeEventRotation
            {
                0.000000 0.000000
            }
            List TextureFiles
            {
                "D:\Ymir Work\effect\hit\blow_electric\1.dds"
                "D:\Ymir Work\effect\hit\blow_electric\2.dds"
                "D:\Ymir Work\effect\hit\blow_electric\3.dds"
            }
        }
    }
    

     

  6. Basically what @hachiwari said. Also, if you got Lycan this is still wrong.

     

    char_battle.cpp:

    		if (pAttacker->IsMonster() && pAttacker->IsDeathBlower() && pAttacker->IsDeathBlow())
    		{
    			if (number(JOB_WARRIOR, JOB_MAX_NUM - 1) == GetJob())
    			{
    				IsDeathBlow = true;
    				dam *= 4;
    			}
    		}

     

    length.h:

    enum EJobs
    {
    	JOB_WARRIOR,
    	JOB_ASSASSIN,
    	JOB_SURA,
    	JOB_SHAMAN,
    #ifdef ENABLE_WOLFMAN_CHARACTER
    	JOB_WOLFMAN,
    #endif
    	JOB_MAX_NUM
    };

    There you go.

    • Love 3
  7. @Vanilla No, they're the same thing. That quest is just poorly written.

     

    HelloWorld-142-8-2-1579221813_qesmssRT5L.png

     

    This should do:

     

    Global:

     

    PERFECT_MASTER_SKILL_LEVEL = 40;
    
    ACTIVE_SKILL_LIST = {
    	--** Warrior
    	[0] = {
    		[1] = {1, 2, 3, 4, 5, 6}, --** Body
    		[2] = {16, 17, 18, 19, 20, 21} --** Mental
    	},
    
    	--** Assassin
    	[1] = {
    		[1] = {31, 32, 33, 34, 35, 36}, --** Blade Fight
    		[2] = {46, 47, 48, 49, 50, 51} --** Archery
    	},
    
    	--** Sura
    	[2] = {
    		[1] = {61, 62, 63, 64, 65, 66}, --** Weaponry
    		[2] = {76, 77, 78, 79, 80, 81} --** Black Magic
    	},
    
    	--** Shaman
    	[3] = {
    		[1] = {91, 92, 93, 94, 95, 96}, --** Dragon Power
    		[2] = {106, 107, 108, 109, 110, 111} --** Healing Power
    	},
    
    	--** Lycan
    	[4] = {
    		[1] = {170, 171, 172, 173, 174, 175}, --** Instinct
    	}
    };

    Quest:

    quest regenbogen begin
    	state start begin
    		function BuildSkillVnumList(job, group)
    			local skill_list = ACTIVE_SKILL_LIST[job][group];
    			local vnum_list = {};
    		
    			for _, skill_vnum in ipairs(skill_list) do
    				local skill_level = pc.get_skill_level(skill_vnum);
    				if (skill_level < PERFECT_MASTER_SKILL_LEVEL) then
    					table.insert(vnum_list, skill_vnum);
    				end -- if
    			end -- for
    		
    			return vnum_list;
    		end -- function
    
    		when 50512.use begin
    			say_title(string.format("%s:[ENTER]", item_name(item.get_vnum())))
    			if (pc.get_skill_group() == 0) then
    				return say_reward("You have to choose your skill group first.[ENTER]");
      
    			elseif (get_time() < pc.getqf("next_regenbogenstein_use_time")) then
    				-- https://metin2.dev/board/index.php?/topic/15905-functionssyreldars-quest-functions/ - get_time_format(sec)
    				return say_reward(string.format("Time remaining: %s", get_time_format(pc.getqf("next_regenbogenstein_use_time") - get_time())))
    			end -- if/elseif
    
    			-- https://metin2.dev/board/index.php?/topic/15905-functionssyreldars-quest-functions/ - time_hour_to_sec(hours)
    			pc.setqf("next_regenbogenstein_use_time", get_time() + time_hour_to_sec(1));
    
    			local skill_vnum_list = regenbogen.BuildSkillVnumList(pc.get_job(), pc.get_skill_group());
    			for _, skill_vnum in ipairs(skill_vnum_list) do
    				pc.set_skill_level(skill_vnum, PERFECT_MASTER_SKILL_LEVEL);
    			end -- for
    
    			say("Your skills' level has been set to Perfect Master.[ENTER]")
    		end -- when
    	end -- state
    end -- quest

     

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