Jump to content

backtop

Member
  • Posts

    42
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by backtop

  1. 14 hours ago, xP3NG3Rx said:

    Check the conditions and the type/subtype of the item on both sides(server, client).

    Hey thank you for your time

    ich check the type/subtype and i can't see a issue there... Type is ITEM_MEDIUM and subytype is MEDIUM_MOVE_COSTUME_ATTR

    the conditions are:

    char_item.cpp

    Spoiler
    void CHARACTER::ItemCombination(const short MediumIndex, const short BaseIndex, const short MaterialIndex)
    {
    	if (IsItemComb() == false)
    		return;
    	
    	const LPITEM MediumItem		= GetItem(TItemPos(INVENTORY, MediumIndex));
    	const LPITEM BaseItem		= GetItem(TItemPos(INVENTORY, BaseIndex));
    	const LPITEM MaterialItem	= GetItem(TItemPos(INVENTORY, MaterialIndex));
    
    	if (MediumItem == NULL || BaseItem == NULL || MaterialItem == NULL)
    		return;
    
    	switch (MediumItem->GetType())
    	{
    	case EItemTypes::ITEM_MEDIUM:
    		switch (MediumItem->GetSubType())
    		{
    		case EMediumSubTypes::MEDIUM_MOVE_COSTUME_ATTR:
    			break;
    		/*case EMediumSubTypes::MEDIUM_MOVE_ACCE_ATTR:
    			break;*/
    		default:
    			return;
    		}
    		break;
    	default:
    		return;
    	}
    
    	if (BaseItem->IsEquipped() || MaterialItem->IsEquipped())
    		return;
    
    	if (BaseItem->GetType() != EItemTypes::ITEM_COSTUME || MaterialItem->GetType() != EItemTypes::ITEM_COSTUME)
    		return;
    	
    	if (BaseItem->GetSubType() != MaterialItem->GetSubType())
    		return;
    
    	if (BaseItem->GetAttributeCount() < 1 || MaterialItem->GetAttributeCount() < 1)
    		return;
    
    	BaseItem->SetAttributes(MaterialItem->GetAttributes());
    	BaseItem->UpdatePacket();
    
    	ITEM_MANAGER::instance().RemoveItem(MaterialItem, "REMOVE (Item Combination)");
    	MediumItem->SetCount(MediumItem->GetCount() - 1);
    }

     

    This should be the clientside condition i think

    Spoiler
    PyObject* playerCanAttachToCombMediumSlot(PyObject* poSelf, PyObject* poArgs)
    {
    	BYTE bSlotType;
    	if (!PyTuple_GetByte(poArgs, 0, &bSlotType))
    		return Py_BadArgument();
    
    	TItemPos Cell;
    	if (!PyTuple_GetByte(poArgs, 1, &Cell.window_type))
    		return Py_BuildException();
    	if (!PyTuple_GetInteger(poArgs, 2, &Cell.cell))
    		return Py_BuildException();
    
    	if (bSlotType != ECombSlotType::COMB_WND_SLOT_MEDIUM || Cell.window_type != INVENTORY)
    		return Py_BuildValue("b", false);
    
    	const TItemData* pItem = CPythonPlayer::Instance().GetItemData(Cell);
    	if (pItem == nullptr)
    		return Py_BuildValue("b", false);
    
    	CItemData* pItemData = nullptr;
    	if (CItemManager::Instance().GetItemDataPointer(pItem->vnum, &pItemData) == false)
    		return Py_BuildValue("b", false);
    
    	const bool bRet = pItemData->GetType() == CItemData::EItemType::ITEM_TYPE_MEDIUM 
    		&& pItemData->GetSubType() == CItemData::EMediumSubTypes::MEDIUM_MOVE_COSTUME_ATTR;
    
    	return Py_BuildValue("b", bRet);
    }

     

    i can't see a issue here...

  2. Hey com,

    i implemented the system by mali in my server but i can't put the item into the socket... it says This item cannot be used.

    Spoiler

    .png

    I'm using the reference files by TMP4

     

    no syserr errors in server and client

    Can someone help me here please?

     

    Sorry for my bad english😅

  3. Hello,

    I got an error while compiling game source:

    Spoiler

    /usr/local/bin/ld: ../../Extern/lib/libIL.a: error adding symbols: file format not recognized

    collect2: error: ld returned 1 exit status

    The libIL.a is in the right folder...

    Files are untouched, so no changes made... 

    Files are from Martysama, I wrote him but didn't get a reply, so trying my luck here

    Can someone help me here?

    Screenshot:

    spacer.png

  4. Hey Com,

    can someone help me here? i got this error in server syserr

    Spoiler
    SYSERR: Jul 30 18:33:27 :: ModifyPoints: cannot find table by vnum 1691088938
    SYSERR: Jul 30 18:33:56 :: ModifyPoints: cannot find table by vnum 1691088938
    SYSERR: Jul 30 18:33:58 :: ModifyPoints: cannot find table by vnum 1691088938
    SYSERR: Jul 30 18:33:58 :: ModifyPoints: cannot find table by vnum 1691088938
    SYSERR: Jul 30 18:33:58 :: ModifyPoints: cannot find table by vnum 1691088938
    SYSERR: Jul 30 18:34:32 :: ModifyPoints: cannot find table by vnum 1691088938
    SYSERR: Jul 30 18:34:36 :: ModifyPoints: cannot find table by vnum 1691088938
    SYSERR: Jul 30 18:34:36 :: ModifyPoints: cannot find table by vnum 1691088938
    SYSERR: Jul 30 18:34:36 :: ModifyPoints: cannot find table by vnum 1691088938

     

    The only change i made before the error appears was in mob_drop_item.txt

    But no mob drop the item 1691088938

    I get kicked out and cant login again unless i reboot the server can play for like 2 minutes and kicked out again... But this only appears in the desert map

    Client Syserr:

    Spoiler
    0730 16:34:27334 :: Traceback (most recent call last):
    
    0730 16:34:27334 ::   File "game.py", line 1281, in OnKeyUp
    
    0730 16:34:27335 :: TypeError
    0730 16:34:27335 :: : 
    0730 16:34:27335 :: 'NoneType' object has no attribute '__getitem__'

     

    And this is my cleint syserr

  5. 21 minutes ago, DGCStaff said:

    Player->item (count-smallint-4-default 0)

    yes its set like that

    21 minutes ago, DGCStaff said:

    Player->shop_item(count-smallint-4-default 1)

    same here

    21 minutes ago, DGCStaff said:

    that's how you have to have it, and if everything goes wrong on your server, it's not from those tables 

    both entrys are right... do i miss something in source? 

    shop.h
    
    typedef struct shop_item
    		{
    			DWORD	vnum;		// 아이템 번호
    			long	price;		// 가격
    			WORD	count;		// 아이템 개수
    
    			LPITEM	pkItem;
    			int		itemid;		// 아이템 고유아이디
    
    			shop_item()
    			{
    				vnum = 0;
    				price = 0;
    				count = 0;
    				itemid = 0;
    				pkItem = NULL;
    			}
    		} SHOP_ITEM;
    packet.h
    
    struct packet_shop_item
    {   
    	DWORD       vnum;
    	DWORD       price;
    	WORD        count;
    	BYTE		display_pos;
    	long	alSockets[ITEM_SOCKET_MAX_NUM];
    	TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
    };

     

  6. 28 minutes ago, DGCStaff said:

    did you set the default to 0? let us know what's wrong with your server, so we can help you 

    Default is 1 but trying it with 0

    Sadly i dont know whats wrong... I am using TMP4 files... if this helps

    Edit: Error still occurs

  7. Hey,

    can someone help me here?

    Spoiler
    SYSERR: Jul 20 10:22:20 :: Boot: shop table size error
    SYSERR: Jul 20 10:22:20 :: SpawnEventHelper: cannot get map base position 1
    SYSERR: Jul 20 10:22:20 :: SpawnEventHelper: cannot get map base position 3
    SYSERR: Jul 20 10:22:20 :: SpawnEventHelper: cannot get map base position 23
    SYSERR: Jul 20 10:22:20 :: SpawnEventHelper: cannot get map base position 43

     

    I edited the shop_item table in navicat from tinyint to smallint and length to 4 but i got this error even i changed it back to tinyint and length 3... what am i doing wrong here?

    • Good 1
  8. 46 minutes ago, Syreldar said:

    I would not post code that's not working.

    I know you wouldn't, sorry for the misunderstanding... i just wanted to say that it don't work for me, cause i do something wrong... but i don't know what...

    Thats the Quest im using:

    Spoiler
    define MAX_LEVEL 70
    define PROG_LEVEL 10
    define START_AVG_DMG 10
    define PROG_AVG_DMG 3
    define MAX_AVG_DMG 30
    
    quest young_heroes_weapons begin
        state start begin
            function IsYoungHeroLevel(pc_level)
                return pc_level >= PROG_LEVEL*pc.getqf("times") and pc_level <= MAX_LEVEL;
            end
    
            function GetYoungHeroWeaponsPerJob(pc_job)
                local data = {
                    [WARRIOR] = {21900, 21903},
                    [NINJA] = {21900, 21901, 21902},
                    [SURA] = {21900},
                    [SHAMAN] = {21904, 21905},
                    [WOLFMAN] = {21906}
                };
                return data[pc_job];
            end
    
            when letter or levelup with young_heroes_weapons.IsYoungHeroLevel(pc.get_level()) begin
                send_letter("Young Heroes' Weapons");
            end
    
            when button or info with young_heroes_weapons.IsYoungHeroLevel(pc.get_level()) begin
                say_title("Young Heroes' Weapons:[ENTER]")
                say("Select your weapon:[ENTER]")
    
                local weapons_per_job = young_heroes_weapons.GetYoungHeroWeaponsPerJob(pc.get_job());
                local choose_weapon_list_name = {};
                for _, weapon_vnum in ipairs(weapons_per_job) do
                    table.insert(choose_weapon_list_name, item_name(weapon_vnum + PROG_LEVEL*pc.getqf("times")));
                end -- for
                table.insert(choose_weapon_list_name, "I'll choose later");
    
                local selection = select_table(choose_weapon_list_name);
                if (selection == table.getn(choose_weapon_list_name)) then
                    send_letter(letter_str);
                    return;
                end -- if
    
                local weapon_to_receive = weapons_per_job[selection] + PROG_LEVEL*pc.getqf("times");
                pc.give_item2_select(weapon_to_receive);
                item.set_attribute(0, APPLY.NORMAL_HIT_DAMAGE_BONUS, math.min(MAX_AVG_DMG, START_AVG_DMG + PROG_AVG_DMG*pc.getqf("times")));
                pc.setqf("times", pc.getqf("times")+1);
                q.done();
            end
        end
    end

     

    Do i miss something?

    For example:

    On 4/27/2023 at 12:35 PM, Syreldar said:
    -- Needs: globals.lua, functions.lua, item.set_attribute(idx, type, value)

    item.set_attribute is implemented in source and in quest_functions... but i dont have globals.lua in my quest folder... Could that be the reason why i don't work?

  9. On 4/28/2023 at 6:31 PM, caanmasu said:
    item.set_value(0, 72, math.min(MAX_AVG_DMG, START_AVG_DMG + PROG_AVG_DMG*pc.getqf("times")));

     

    On 4/27/2023 at 12:35 PM, Syreldar said:
    item.set_attribute(0, APPLY.NORMAL_HIT_DAMAGE_BONUS, math.min(MAX_AVG_DMG, START_AVG_DMG + PROG_AVG_DMG*pc.getqf("times")));

    Both Methods don't work for me... in the first quoted Methods i get an random Bonus for example strong against Devils... in the second Method i don't get an Bonus at all, i implemented the item.set_attribute in source from Pengers release

  10. 20 hours ago, Syreldar said:

    ..You really don't need that amount of code and states to make such a basic thing.

    define MAX_LEVEL 70
    define PROG_LEVEL 10
    define START_AVG_DMG 10
    define PROG_AVG_DMG 3
    define MAX_AVG_DMG 30
    
    -- Needs: globals.lua, functions.lua, item.set_attribute(idx, type, value)
    
    quest young_heroes_weapons begin
        state start begin
            function IsYoungHeroLevel(pc_level)
                return pc_level >= PROG_LEVEL*pc.getqf("times") and pc_level <= MAX_LEVEL;
            end -- function
    
            function GetYoungHeroWeaponsPerJob(pc_job)
                local data = {
                    [WARRIOR] = {21900, 21903},
                    [NINJA] = {21900, 21901, 21902},
                    [SURA] = {21900},
                    [SHAMAN] = {21904, 21905},
                    [WOLFMAN] = {21906}
                };
                return data[pc_job];
            end -- function
    
            when letter or levelup with young_heroes_weapons.IsYoungHeroLevel(pc.get_level()) begin
                send_letter("Young Heroes' Weapons");
            end -- when
    
            when button or info with young_heroes_weapons.IsYoungHeroLevel(pc.get_level()) begin
                say_title("Young Heroes' Weapons:[ENTER]")
                say("Select your weapon:[ENTER]")
    
                local weapons_per_job = young_heroes_weapons.GetYoungHeroWeaponsPerJob(pc.get_job());
                local choose_weapon_list_name = {};
                for _, weapon_vnum in ipairs(weapons_per_job) do
                    table.insert(choose_weapon_list_name, item_name(weapon_vnum + PROG_LEVEL*pc.getqf("times")));
                end -- for
                table.insert(choose_weapon_list_name, "I'll choose later");
    
                local selection = select_table(choose_weapon_list_name);
                if (selection == table.getn(choose_weapon_list_name)) then
                    send_letter(letter_str);
                    return;
                end -- if
    
                local weapon_to_receive = weapons_per_job[selection] + PROG_LEVEL*pc.getqf("times");
                pc.give_item2_select(weapon_to_receive);
                -- Adds Average Damage like official.
                item.set_attribute(0, APPLY.NORMAL_HIT_DAMAGE_BONUS, math.min(MAX_AVG_DMG, START_AVG_DMG + PROG_AVG_DMG*pc.getqf("times")));
                pc.setqf("times", pc.getqf("times")+1);
                q.done();
            end -- when
        end -- state
    end -- quest

     

    Thank you for your help 🙂 But I don't have the function item.set_attribute in questlib.lua can you share this function?

  11. 16 minutes ago, caanmasu said:

    Put TEST_SERVER: 1 in CONFIG file from your core and check lua errors

    Line 116 in questlib.lua

    Spoiler
    raw_script("[INSERT_IMAGE image_type;item|idx;"..vnum.."|title;"..item_name(vnum).."|desc;".."".."|index;"..index.."|total;"..total.."]")

     

    This is my output:

    Spoiler

    XOAdlbl.png

  12. 41 minutes ago, caanmasu said:

    You are welcome!

     

    Hmmm my bad.

    Elements in table should be splitted by comma, so:

     

    			local weapons = {
    				[0] = {21900, 21903},
    				[1] = {21900, 21901, 21902},
    				[2] = {21900},
    				[3] = {21904, 21905},
    			}

     

    Thanks quest compiled without any errors

    Can't choose anything and images aren't showing too

    My Quest:

    Spoiler
    quest young_weapon_heroes begin
    	state start begin
    		when login begin
    			set_state(level_1)
    		end
    	end
    
    	state level_1 begin
    		when letter with pc.level >= 1 and pc.level < 10 begin
    			send_letter("Waffen für den Junghelden")
    		end
    
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    
    			local weapons = {
    				[0] = {21900, 21903},
    				[1] = {21900, 21901, 21902},
    				[2] = {21900},
    				[3] = {21904, 21905},
    			}
    
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    
    			set_state(level_10)
    		end
    	end
    
    	state level_10 begin
    		when letter with pc.level >= 10 and pc.level < 20 begin
    			send_letter("Waffen für den Junghelden")
    		end
    
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    			
    			local weapons = 
    			{
    				[0] = {21910, 21913},
    				[1] = {21910, 21911, 21912},
    				[2] = {21910},
    				[3] = {21914, 21915},
    			}
    
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    
    			set_state(level_20)
    		end
    	end
    	
    	state level_20 begin
    		when letter with pc.level >= 20 and pc.level < 30 begin
    			send_letter("Waffen für den Junghelden")
    		end
    
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    			
    			local weapons = {
    				[0] = {21920, 21923},
    				[1] = {21920, 21921, 21922},
    				[2] = {21920},
    				[3] = {21924, 21925},
    			}
    
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    
    			set_state(level_30)
    		end
    	end
    
    	state level_30 begin
    		when letter with pc.level >= 30 and pc.level < 40 begin
    			send_letter("Waffen für den Junghelden")
    		end
    
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    			
    			local weapons = {
    				[0] = {21930, 21933},
    				[1] = {21930, 21931, 21932},
    				[2] = {21930},
    				[3] = {21934, 21935},
    			}
    
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    
    			set_state(level_40)
    		end
    	end
    
    	state level_40 begin
    		when letter with pc.level >= 40 and pc.level < 50 begin
    			send_letter("Waffen für den Junghelden")
    		end
    
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    			
    			local weapons = {
    				[0] = {21940, 21943},
    				[1] = {21940, 21941, 21942},
    				[2] = {21940},
    				[3] = {21944, 21945},
    			}
    
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    
    			set_state(level_50)
    		end
    	end
    
    	state level_50 begin
    		when letter with pc.level >= 50 and pc.level < 60 begin
    			send_letter("Waffen für den Junghelden")
    		end
    
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    			
    			local weapons = {
    				[0] = {21950, 21953},
    				[1] = {21950, 21951, 21952},
    				[2] = {21950},
    				[3] = {21954, 21955},
    			}
    
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    
    			set_state(level_60)
    		end
    	end
    
    	state level_60 begin
    		when letter with pc.level >= 60 and pc.level < 70 begin
    			send_letter("Waffen für den Junghelden")
    		end
    
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    			
    			local weapons = {
    				[0] = {21960, 21963},
    				[1] = {21960, 21961, 21962},
    				[2] = {21960},
    				[3] = {21964, 21965},
    			}
    
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    
    			set_state(level_70)
    		end
    	end
    
    	state level_70 begin
    		when letter with pc.level >= 70 and pc.level < 80 begin
    			send_letter("Waffen für den Junghelden")
    		end
    
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    			
    			local weapons = {
    				[0] = {21970, 21973},
    				[1] = {21970, 21971, 21972},
    				[2] = {21970},
    				[3] = {21974, 21975},
    			}
    
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    
    			set_state(__COMPLETE__)
    		end
    	end
    	
    	state __COMPLETE__ begin
    	end
    end

     

    But i got another problem ingame:

    Spoiler

    .png

  13. 7 hours ago, caanmasu said:

    Hi @backtop

    I have this quest identical to how it is seen on the official server and even improved (fixes).

    I can't send it to you for free but I can help you with some tips.

    1. Seeing in game how the quest works is the most important part.

    If you realize, at level 1 they give a weapon, then at level 10, then at 20, and so on until 70.
    I'm not sure if when you get to level 30 (example) and you didn't claim the one from level 20, you won't be able to claim it anymore, only the one from 30 onwards.

    Another thing to note is that it will show you the types of weapons that the character can use. For example, the sura only uses a sword, while the ninja uses a dagger, bow and sword.

    2. The way to program it.

    I think you're new to quest, so I'll make your life easier by making static code. (I never use static code in my quests, only dynamic code but the difficulty is much higher)

    I will not use a data structure in this case either, I will only declare variables as it comes out. (I always use data structure in my quests, it is a higher difficulty)

    You should also think about validating if the character has already claimed the weapon and sending it to the next weapon. So in this case you can use several states (each state would be each level where the weapon is claimed) or qf variables of the character that would serve as flags. In this case to make your life easier, I will do it with states (static code)

    3. The interface

    You have said that you want it as the official one, because you have to think about how to display the inline icons and radio buttons. In this part many people get confused.

    About the texts, the indices of the locale texts are: 82, 84 and 85. Maybe at higher levels there are other texts like 86 but at the moment I'm not sure.

     

    Let us begin:

    Establish a structure for the quest.

     

    quest young_weapon_heroes begin
    	state start begin
    		when login begin
    			set_state(level_1)
    		end
    	end
    	
    	state level_1 begin
    		when letter with pc.level >= 1 and pc.level < 10 begin --limit level
    			send_letter(locale(82))
    		end
    		
    		when button or info begin
    			say_title(locale(82))
    			say(locale(84))
    			wait()
    			say(locale(85))
    			--GUI part
    			
    			--in case the character has accepted a weapon, then this is done:
    			set_state(level_10)
    		end
    	end
    	
    	--The same but with level_10 :)
    	state level_10 begin
    		when letter with pc.level >= 10 and pc.level < 20 begin --limit level
    			send_letter(locale(82))
    		end
    		
    		when button or info begin
    			say_title(locale(82))
    			say(locale(84))
    			wait()
    			say(locale(85))
    			--GUI part
    			
    			--in case the character has accepted a weapon, then this is done:
    			set_state(level_20) --now change here to 20
    		end
    	end
    	
    	--Do the same until level 70.
    	state level_70 begin
    		when letter with pc.level >= 70 begin --limit level
    			send_letter(locale(82))
    		end
    		
    		when button or info begin
    			say_title(locale(82))
    			say(locale(84))
    			wait()
    			say(locale(85))
    			--GUI part
    			
    			--in case the character has accepted a weapon, then this is done:
    			set_state(__COMPLETE__) --This is so they don't claim infinite times the last weapon
    		end
    	end
    	
    	state __COMPLETE__ begin
    	end
    end

     

    We will now do the data part.

    You must have listed the vnum of the weapons.

    The ones of level 1 go from 21900 to 21906, but you have to take into account the type of weapon to be able to show the correct ones in the corresponding races.

    We will create simple tables to store the weapons (level 1) that correspond to each race:

     

    local weapons = {
    	[0] = {21900, 21903}
    	[1] = {21900, 21901, 21902}
    	[2] = {21900}
    	[3] = {21904, 21905}
    	[4] = {21906}
    }

    The indices in the table correspond to the breeds.
    war = 0
    ninja = 1
    sura = 2
    shaman = 3
    wolfman = 4


    If you notice, the buttons are almost ready, just need to do a little fix.

    We will create the select:

     

    local t_select = {}
    for i = 1, table.getn(weapons[pc.job]) do
    	local weapon_vnum = weapons[pc.job][i]
    	table.insert(t_select, item_name(weapon_vnum))
    end
    table.insert(t_select, "Close")

    I have simply created a table of each weapon vnum converted to its name.

     

    		when button or info begin
    			say_title(locale(82))
    			say(locale(84))
    			wait()
    			say(locale(85))
    			--GUI part
    			
    			local weapons = {
    				[0] = {21900, 21903}
    				[1] = {21900, 21901, 21902}
    				[2] = {21900}
    				[3] = {21904, 21905}
    				[4] = {21906}
    			}
    			
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    			
    			--in case the character has accepted a weapon, then this is done:
    			set_state(level_10)
    		end

    Not bad. We already have the buttons. Now we must activate the event when a weapon is chosen.

     

    local sel = select_table(t_select)
    if sel == table.getn(t_select) then
    	return
    end
    
    pc.give_item2(weapons[pc.job][sel])

    Note: select_table() is the same as select(), with the difference that select_table receives a table as a parameter, and in this way we make it more dynamic. I admit, I got a little dynamic on some things.

     

    In the last option (close) we go to the return so that nothing happens ?

    You may be confused in the pc.give_item2. Well, we go to the table of the weapons of our race, and the variable sel is equivalent to the position of the element. In this case, the position of the element corresponds to the weapon.

    Thus we have our when:

     

    		when button or info begin
    			say_title(locale(82))
    			say(locale(84))
    			wait()
    			say(locale(85))
    			--GUI part
    			
    			local weapons = {
    				[0] = {21900, 21903}
    				[1] = {21900, 21901, 21902}
    				[2] = {21900}
    				[3] = {21904, 21905}
    				[4] = {21906}
    			}
    			
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) donde
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    			
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    			
    			pc.give_item2(weapons[pc.job][sel])
    			
    			set_state(level_10)
    		end

    We are left with the interface part. For this we go to the questlib and look for this function:

     

    function say_item_vnum_inline(vnum,index,total)
    	if index >= total then
    		return
    	end
    	if total > 3 then
    		return
    	end
    	raw_script("[INSERT_IMAGE image_type;item|idx;"..vnum.."|title;"..item_name(vnum).."|desc;".."".."|index;"..index.."|total;"..total.."]")
    end


     

    (I don't like how it's programmed but it works, we'll use it that way.)

    This function has the same goal as say_item, but instead of displaying a single item in the middle, this time up to 3 will be displayed on the same line. Just like in the original quest.

    Parameters:

    vnum: vnum of the item
    index: number of the position in the line. It starts with 0.
    total: maximum number of items that you are going to put in the row

    Example if I were a warrior:

    say_item_vnum_inline(21900, 0, 2) --the 2 is because we will put the sword and spear
    say_item_vnum_inline(21903, 1, 2)

    In this case, the level 1 sword and spear will be shown in a single line.

    Example if I were a ninja:

    say_item_vnum_inline(21900, 0, 3)
    say_item_vnum_inline(21901, 1, 3)
    say_item_vnum_inline(21902, 2, 3)

    Example if it were a surah:

    say_item_vnum_inline(21900, 0, 1)

    Do you understand the pattern?

    We're going to make it dynamic because for me it's the best way to do it, but if you don't understand it, go over it a bit because sometimes it's difficult the first time.

     

    local count_weapon = table.getn(weapons[pc.job])
    for i = 0, count_weapon do
    	local weapon_vnum = weapons[pc.job][i]
    	say_item_vnum_inline(weapon_vnum, i, count_weapon)
    end

    Now we add it to our when, like this:

     

    		when button or info begin
    			say_title(locale(82))
    			say(locale(84))
    			wait()
    			say(locale(85))
    			
    			local weapons = {
    				[0] = {21900, 21903}
    				[1] = {21900, 21901, 21902}
    				[2] = {21900}
    				[3] = {21904, 21905}
    				[4] = {21906}
    			}
    			
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    			
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) donde
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    			
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    			
    			pc.give_item2(weapons[pc.job][sel])
    			
    			set_state(level_10)
    		end

    Now just do the same with the other states. Remember to change the vnum of the weapons.

    Note: this code is a guide and is not tested. I have written it impromptu but I hope it will be useful.

    Thank you for your time. This really helps me out... 

    Can you help me again? I dont know what this means

    Here is the Quest i tried to compile

    Spoiler
    quest young_weapon_heroes begin
    	state start begin
    		when login begin
    			set_state(level_1)
    		end
    	end
    	
    	state level_1 begin
    		when letter with pc.level >= 1 and pc.level < 10 begin --limit level
    			send_letter("Waffen für den Junghelden")
    		end
    		
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    			
    			local weapons = {
    				[0] = {21900, 21903}
    				[1] = {21900, 21901, 21902}
    				[2] = {21900}
    				[3] = {21904, 21905}
    			}
    			
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    			
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    			
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    			
    			set_state(level_10)
    		end
    	end
    	
    	state level_10 begin
    		when letter with pc.level >= 10 and pc.level < 20 begin --limit level
    			send_letter("Waffen für den Junghelden")
    		end
    		
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    			
    			local weapons = {
    				[0] = {21910, 21913}
    				[1] = {21910, 21911, 21912}
    				[2] = {21910}
    				[3] = {21914, 21915}
    			}
    			
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    			
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    			
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    			
    			set_state(level_20)
    		end
    	end
    	
    	state level_20 begin
    		when letter with pc.level >= 20 and pc.level < 30 begin --limit level
    			send_letter("Waffen für den Junghelden")
    		end
    		
    		when button or info begin
    			say_title("Waffen für den Junghelden")
    			
    			local weapons = {
    				[0] = {21920, 21923}
    				[1] = {21920, 21921, 21922}
    				[2] = {21920}
    				[3] = {21924, 21925}
    			}
    			
    			local count_weapon = table.getn(weapons[pc.job])
    			for i = 0, count_weapon do
    				local weapon_vnum = weapons[pc.job][i]
    				say_item_vnum_inline(weapon_vnum, i, count_weapon)
    			end
    			
    			local t_select = {}
    			for i = 1, table.getn(weapons[pc.job]) do
    				local weapon_vnum = weapons[pc.job][i]
    				table.insert(t_select, item_name(weapon_vnum))
    			end
    			table.insert(t_select, "Close")
    			
    			local sel = select_table(t_select)
    			if sel == table.getn(t_select) then
    				return
    			end
    
    			pc.give_item2(weapons[pc.job][sel])
    			
    			set_state(level_30)
    		end
    	end
    	
    	--Do the same until level 70.
    	state level_70 begin
    		when letter with pc.level >= 70 begin --limit level
    			send_letter(locale(82))
    		end
    		
    		when button or info begin
    			say_title(locale(82))
    			say(locale(84))
    			wait()
    			say(locale(85))
    			--GUI part
    			
    			--in case the character has accepted a weapon, then this is done:
    			set_state(__COMPLETE__) --This is so they don't claim infinite times the last weapon
    		end
    	end
    	
    	state __COMPLETE__ begin
    	end
    end

     

    When i try to compile the quest i got this error:

    Spoiler

    .png

  14. Hey Com,

    does someone have the quest official like?

    If not can someone help me writing one?

    Thats all i have for now... but i dont know how to get further...

    quest young_heroes begin
    	state start begin
    		when login or levelup with pc.get_level() == 1  begin
    			send_letter(gameforge.young_heroes.titel)
    		end
    	end
    	when button or info begin
    			say_title(gameforge.young_heroes.titel)
    				if pc . job == 0 then
    				say_item_vnum(21900)
    				say_item_vnum(21903)
    				if pc . job == 1 then
    				say_item_vnum(21901)
    				say_item_vnum(21902)
    				if pc . job == 2 then
    				say_item_vnum(21900)
    				if pc . job == 3 then
    				say_item_vnum(21904)
    				say_item_vnum(21905)
    	end
    end

    Someone know how to make a choice system for the player?

  15.  

    Hey all,

    Using the M2KSF Files and the Questcategory system was already implemented and it works fine, just the levelup Quest isn´t showing. 

    Like you can see here 

    Can someone tell me in which category it has to be?

    My Questcategory.txt

    Spoiler

    4    collect_quest_lv30
    4    collect_quest_lv40
    4    collect_quest_lv50
    4    collect_quest_lv60
    4    collect_quest_lv70
    4    collect_quest_lv80
    4    collect_quest_lv85
    4    collect_quest_lv90
    4    collect_quest_lv92
    4    collect_quest_lv94
    4    collect_quest_lv96
    2    levelup

    Here is my levelup Quest... Can't post code here

    Sorry for my bad english

    Spoiler

    yy07CEf.png

    • Not Good 1
×
×
  • 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.