Jump to content

Recommended Posts

No kind of adds these attributes, but I have no idea how to do that if you already have 5 to not add, 

say(item.get_value (0))

 returns 0, quest 

http://wklej.to/36Xux

. I do not know how to make a lock to 5 bonuses. Can you help?

Link to comment
https://metin2.dev/topic/2612-item2set_attr-in-source/#findComment-17610
Share on other sites

  • Developer

item.get_value(0) returns the item's value0 (item_proto).

There is a quest function that allows you to add attributes to an item, but there aren't quest functions to get the attributes of an item.

 

 

when you return 0 and server doesn't boot:

unknown.png

Link to comment
https://metin2.dev/topic/2612-item2set_attr-in-source/#findComment-17612
Share on other sites

item.get_attr(i):

int item_get_attr(lua_State* L){
	LPITEM item = CQuestManager::instance().GetCurrentItem();
	if (!lua_isnumber(L, 1)){
		lua_pushnumber(L,0);
	}
	int index = (int)lua_tonumber(L, 1);
	if (index <0 || index > 6){
		lua_pushnumber(L,0);
	}
	const TPlayerItemAttribute& values = item->GetAttribute(iAttrIndex);
	lua_pushnumber(L, values.bType);
	lua_pushnumber(L, values.sType);
	return 1;
}
Link to comment
https://metin2.dev/topic/2612-item2set_attr-in-source/#findComment-17627
Share on other sites

  • Premium

iMer's libgame item2.get_attr() & item2.set_attr()

int tItem2::get_attr(lua_State* L){
    CItem* item = CQuestManager::instance()->GetCurrentItem();
    if (!lua::IsNumber(L,1)||!item){
        return 0;
    }
    int attr_index = lua::ToNumber(L,1);
    if (attr_index <0 || attr_index > 6){
        return 0;
    }
    TPlayerItemAttribute attr=item->GetAttribute(attr_index);
    lua::PushNumber(L,attr.bType);
    lua::PushNumber(L,attr.sValue);
    return 2;
}
int tItem2::set_attr(lua_State* L){
    CItem* item = CQuestManager::instance()->GetCurrentItem();
    if (!lua::IsNumber(L,1)||!lua::IsNumber(L,2)||!lua::IsNumber(L,3)||!item){
        lua::PushBoolean(L,0);
        return 1;
    }
    int attr_index = lua::ToNumber(L,1);
    if (attr_index <0 || attr_index > 6){
        lua::PushBoolean(L,0);
        return 1;
    }
    item->SetForceAttribute(attr_index,lua::ToNumber(L,2),lua::ToNumber(L,3));
    lua::PushBoolean(L,1);
    return 1;
}
  • Love 2
Link to comment
https://metin2.dev/topic/2612-item2set_attr-in-source/#findComment-17629
Share on other sites

  • 3 years later...
  • Premium
On 21/08/2014 at 10:13 PM, Denis said:

item.get_attr(i):


int item_get_attr(lua_State* L){
	LPITEM item = CQuestManager::instance().GetCurrentItem();
	if (!lua_isnumber(L, 1)){
		lua_pushnumber(L,0);
	}
	int index = (int)lua_tonumber(L, 1);
	if (index <0 || index > 6){
		lua_pushnumber(L,0);
	}
	const TPlayerItemAttribute& values = item->GetAttribute(iAttrIndex);
	lua_pushnumber(L, values.bType);
	lua_pushnumber(L, values.sType);
	return 1;
}

 

On 21/08/2014 at 10:41 PM, Zonni said:

iMer's libgame item2.get_attr() & item2.set_attr()

 


int tItem2::get_attr(lua_State* L){
    CItem* item = CQuestManager::instance()->GetCurrentItem();
    if (!lua::IsNumber(L,1)||!item){
        return 0;
    }
    int attr_index = lua::ToNumber(L,1);
    if (attr_index <0 || attr_index > 6){
        return 0;
    }
    TPlayerItemAttribute attr=item->GetAttribute(attr_index);
    lua::PushNumber(L,attr.bType);
    lua::PushNumber(L,attr.sValue);
    return 2;
}
int tItem2::set_attr(lua_State* L){
    CItem* item = CQuestManager::instance()->GetCurrentItem();
    if (!lua::IsNumber(L,1)||!lua::IsNumber(L,2)||!lua::IsNumber(L,3)||!item){
        lua::PushBoolean(L,0);
        return 1;
    }
    int attr_index = lua::ToNumber(L,1);
    if (attr_index <0 || attr_index > 6){
        lua::PushBoolean(L,0);
        return 1;
    }
    item->SetForceAttribute(attr_index,lua::ToNumber(L,2),lua::ToNumber(L,3));
    lua::PushBoolean(L,1);
    return 1;
}

 

 

Where we add this? 

if pc.get_sex() == true and npc.get_sex() == false then
	npc.purge()
end

 

Link to comment
https://metin2.dev/topic/2612-item2set_attr-in-source/#findComment-94729
Share on other sites

  • 8 months later...
  • Active Member

Aveline has posted a topic which covers this, please check the following post: 

 

for brain_cells in xrange(brain):
  if brain_cells == 0:
    print("0x3703c7 Fatal error occurred. Please replace the brain.")
    break
  if brain_cells == "damaged":
    print("0x3703c7 Error occurred. Please repair damaged brain_cells")
    break
  
  print("brain_cells are at 100% capacity.")

 

Link to comment
https://metin2.dev/topic/2612-item2set_attr-in-source/#findComment-103735
Share on other sites

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.