Former Staff Shisui 493 Posted March 31, 2015 Former Staff Share Posted March 31, 2015 Hi, How can make people that login for the first time to receive equiped items and the items are full bonus? Or even just with bonus. Which functions? Thanks. Link to comment Share on other sites More sharing options...
Former Staff Solution Shisui 493 Posted April 16, 2015 Author Former Staff Solution Share Posted April 16, 2015 Solved. Thanks to a good a friend. Link to comment Share on other sites More sharing options...
Premium MrLibya 558 Posted April 16, 2015 Premium Share Posted April 16, 2015 use eqiu function and set attr function If you're going to do something, then do it right. Link to comment Share on other sites More sharing options...
valessio 14 Posted April 16, 2015 Share Posted April 16, 2015 i m interessed in that can u please be so nice to explain us how can i let login start items to have for exemple sword +9 with 20% strong against zombie and 12 dexterity just for an exemple i m really interessed on how to do that type of initial starter set bonus Link to comment Share on other sites More sharing options...
Former Staff Shisui 493 Posted April 16, 2015 Author Former Staff Share Posted April 16, 2015 * Item module: - get_attribute | Return: Table1 | Args: byte AttrIndex[0..4] - set_attribute | Return: Boolean | Args: byte AttrIndex[0..4], byte AttrType[1..94], short AttrValue[-32768..32767] questlua_item.cpp Be carefull, in the code you can find a global config-variable! "g_iItemStackCount" replace with 200 or 250 or what you want. int item_get_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (!lua_isnumber(L, 1)) { sys_err("Wrong argument, need a number from range(0..%d)!", ITEM_ATTRIBUTE_MAX_NUM-2); lua_pushnumber(L, 0); return 1; } int iAttrIndex = (int)lua_tonumber(L, 1); if (iAttrIndex < 0 || iAttrIndex >= ITEM_ATTRIBUTE_MAX_NUM-2) { sys_err("Invalid index %d. Index out of range(0..%d)", iAttrIndex, ITEM_ATTRIBUTE_MAX_NUM-2); lua_pushnumber(L, 0); return 1; } const TPlayerItemAttribute& AttrItem = item->GetAttribute(iAttrIndex); lua_newtable(L); lua_pushnumber(L, AttrItem.bType); lua_rawseti(L, -2, 1); lua_pushnumber(L, AttrItem.sValue); lua_rawseti(L, -2, 2); return 1; } int item_set_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } if (!lua_isnumber(L, 1)) { sys_err("Wrong argument[AttrIdx] #1."); lua_pushboolean(L, false); return 1; } else if (!lua_isnumber(L, 2)) { sys_err("Wrong argument[AttrType] #2."); lua_pushboolean(L, false); return 1; } else if (!lua_isnumber(L, 3)) { sys_err("Wrong argument[AttrValue] #3."); lua_pushboolean(L, false); return 1; } int bAttrIndex = (int)lua_tonumber(L, 1); if (bAttrIndex < 0 || bAttrIndex >= ITEM_ATTRIBUTE_MAX_NUM-2) { sys_err("Invalid AttrIndex %d. AttrIndex out of range(0..4)", bAttrIndex); lua_pushboolean(L, false); return 1; } int bAttrType = (int)lua_tonumber(L, 2); if (bAttrType < 1 || bAttrType >= MAX_APPLY_NUM) { sys_err("Invalid AttrType %d. AttrType out of range(1..%d)", MAX_APPLY_NUM); lua_pushboolean(L, false); return 1; } if (item->HasAttr(bAttrType) && (item->GetAttribute(bAttrIndex).bType != bAttrType)) { sys_err("AttrType[%d] multiplicated.", bAttrType); lua_pushboolean(L, false); return 1; } int bAttrValue = (int)lua_tonumber(L, 3); if (bAttrValue < 1 || bAttrValue >= 32768) { sys_err("Invalid AttrValue %d. AttrValue should be between 1 and 32767!", bAttrValue); lua_pushboolean(L, false); return 1; } bool bRet = TRUE; int bAttrCount = item->GetAttributeCount(); if (bAttrCount <= 4 && bAttrCount >= 0) { if (bAttrCount < bAttrIndex) bAttrIndex = bAttrCount; item->SetForceAttribute(bAttrIndex, bAttrType, bAttrValue); } else bRet = FALSE; lua_pushboolean(L, bRet); return 1; } { "get_attribute", item_get_attribute }, { "set_attribute", item_set_attribute }, pc.give_item2_select(VNUMITEM,COUNT) item.set_attribute(bonus, bonus_id, percentage) For example, give item 17009 with 3000 hp. pc.give_item2_select(17009,1) item.set_attribute(0, 1, 3000) 1 1 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