Avertus 1 Posted August 21, 2014 Share Posted August 21, 2014 Hi, have you item2.set_attr function of imer's lib? It seems to me that it was a topic already on the forum but can not find. Link to comment Share on other sites More sharing options...
Developer PACI 921 Posted August 21, 2014 Developer Share Posted August 21, 2014 Why do you want item2.set_attr ? You've item.set_value which works exactly in the same way. when you return 0 and server doesn't boot: Link to comment Share on other sites More sharing options...
Avertus 1 Posted August 21, 2014 Author Share Posted August 21, 2014 But what you provided is quite a different function, it sets your value, and I want the attributes. Link to comment Share on other sites More sharing options...
Developer PACI 921 Posted August 21, 2014 Developer Share Posted August 21, 2014 It sets attributes... Just try it. item.set_value(0, apply.MAX_HP, 2000) when you return 0 and server doesn't boot: Link to comment Share on other sites More sharing options...
Avertus 1 Posted August 21, 2014 Author Share Posted August 21, 2014 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 Share on other sites More sharing options...
Developer PACI 921 Posted August 21, 2014 Developer Share Posted August 21, 2014 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: Link to comment Share on other sites More sharing options...
Avertus 1 Posted August 21, 2014 Author Share Posted August 21, 2014 Exactly, and for this I need item2.set_attr Link to comment Share on other sites More sharing options...
Denis 1474 Posted August 21, 2014 Share Posted August 21, 2014 item2.set_attr = item.set_value 2 Link to comment Share on other sites More sharing options...
Developer PACI 921 Posted August 21, 2014 Developer Share Posted August 21, 2014 What you need is get_attr. item2.set_attr = item.set_value ^ this. when you return 0 and server doesn't boot: Link to comment Share on other sites More sharing options...
Avertus 1 Posted August 21, 2014 Author Share Posted August 21, 2014 All the same, you can? I remember well that such a tutorial was on board? Link to comment Share on other sites More sharing options...
Developer PACI 921 Posted August 21, 2014 Developer Share Posted August 21, 2014 No, it's not the same. You've to specify correctly what you want, otherwise it'll be hard to help you. Anyway, check iMer's lib source, it'll probably help you. when you return 0 and server doesn't boot: Link to comment Share on other sites More sharing options...
Avertus 1 Posted August 21, 2014 Author Share Posted August 21, 2014 Well, only with my knowledge of c ++ will issue a transfer to the source. Link to comment Share on other sites More sharing options...
Denis 1474 Posted August 21, 2014 Share Posted August 21, 2014 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 Share on other sites More sharing options...
Premium Zonni 230 Posted August 21, 2014 Premium Share Posted August 21, 2014 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; } 2 Link to comment Share on other sites More sharing options...
Premium EnKor 42 Posted November 10, 2017 Premium Share Posted November 10, 2017 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 Share on other sites More sharing options...
Dean 84 Posted July 21, 2018 Share Posted July 21, 2018 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 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