• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Compiling Help wich cpp [kinda hard]

Dankoo

Active Member
Joined
Sep 4, 2010
Messages
1,007
Reaction score
27
Hello guys

I'm doing quest log for Killing in the name of... Quest

Here's the problem:

LUA:
		<mission name="Paw and Fur: Hydras" storageid="14021" startvalue="0" endvalue="2000">
			<missionstate id="0-1999" description="You already hunted |STORAGE:14021|/2000 hydras."/>
			<missionstate id="2000" description="You killed 2000 hydras. Report back to Grizzly Adams."/>
			<missionstate id="2001" description="You killed 2000 hydras. You can restart that task."/>
		</mission>

How do I set this line to show if player have storage between 0 and 1999?

<missionstate id="0-1999" description="You already hunted |STORAGE:14021|/2000 hydras."/>

Credits to Cykotitan for the original quest log, without |STORAGE:XXXX| code

Thanks ^_^^_^

PS: Just tried fromid and toid, and receive "missing id state for quest log bla bla"
 
Last edited:
Hmm... Is there a way to modify sources to work as actions.xml? Like 0-1999 or fromid="0" toid="1999"?

'cause if not, everybodys Killing in the name of... Quest log will have like 27k lines... Like cykotitan's one o.o

and this code won't be useful =/ http://otland.net/f35/parsing-storage-values-inside-quest-xml-89354/

I think this is the code that have to be modified

[cpp]bool Quests::parseQuestNode(xmlNodePtr p, bool checkDuplicate)
{
if(xmlStrcmp(p->name, (const xmlChar*)"quest"))
return false;

int32_t intValue;
std::string strValue;

uint32_t id = m_lastId;
if(readXMLInteger(p, "id", intValue) && id > 0)
{
id = intValue;
if(id > m_lastId)
m_lastId = id;
}[/cpp]

And this is actions.xml fromid and toid code:

[cpp]else if(readXMLString(p, "fromid", strValue) && readXMLString(p, "toid", endValue))
{
IntegerVec intVector = vectorAtoi(explodeString(strValue, ";")), endVector = vectorAtoi(explodeString(endValue, ";"));
if(intVector[0] && endVector[0] && intVector.size() == endVector.size())
{
int32_t tmp = 0;
for(size_t i = 0, size = intVector.size(); i < size; ++i)
{
tmp = intVector;
while(intVector <= endVector)
{
if(useItemMap.find(intVector) != useItemMap.end())
{
if(!override)
{
std::clog << "[Warning - Actions::registerEvent] Duplicate registered item with id: " << intVector <<
", in fromid: " << tmp << " and toid: " << endVector << std::endl;
intVector++;
continue;
}
else
delete useItemMap[intVector];
}

useItemMap[intVector++] = new Action(action);
}
}
}
else
std::clog << "[Warning - Actions::registerEvent] Malformed entry (from item: \"" << strValue <<
"\", to item: \"" << endValue << "\")" << std::endl;
}[/cpp]

Some more examples of fromid toid functions

Movements

[cpp]if(readXMLString(p, "fromid", strValue) && readXMLString(p, "toid", endStrValue))
{
intVector = vectorAtoi(explodeString(strValue, ";"));
endIntVector = vectorAtoi(explodeString(endStrValue, ";"));
if(intVector[0] && endIntVector[0] && intVector.size() == endIntVector.size())
{
for(size_t i = 0, size = intVector.size(); i < size; ++i)
{
bool equip = moveEvent->getEventType() == MOVE_EVENT_EQUIP;
addEvent(moveEvent, intVector, m_itemIdMap, override);
if(equip)
{
ItemType& it = Item::items.getItemType(intVector);
it.wieldInfo = moveEvent->getWieldInfo();
it.minReqLevel = moveEvent->getReqLevel();
it.minReqMagicLevel = moveEvent->getReqMagLv();
it.vocationString = moveEvent->getVocationString();
}

while(intVector < endIntVector)
{
addEvent(new MoveEvent(moveEvent), ++intVector, m_itemIdMap, override);
if(equip)
{
ItemType& tit = Item::items.getItemType(intVector);
tit.wieldInfo = moveEvent->getWieldInfo();
tit.minReqLevel = moveEvent->getReqLevel();
tit.minReqMagicLevel = moveEvent->getReqMagLv();
tit.vocationString = moveEvent->getVocationString();
}
}
}
}
else
std::clog << "[Warning - MoveEvents::registerEvent] Malformed entry (from item: \"" << strValue << "\", to item: \"" << endStrValue << "\")" << std::endl;
}[/cpp]

Items

[cpp]if(readXMLInteger(itemNode, "id", intValue))
parseItemNode(itemNode, intValue);
else if(readXMLString(itemNode, "fromid", strValue) && readXMLString(itemNode, "toid", endValue))
{
intVector = vectorAtoi(explodeString(strValue, ";"));
endVector = vectorAtoi(explodeString(endValue, ";"));
if(intVector[0] && endVector[0] && intVector.size() == endVector.size())
{
size_t size = intVector.size();
for(size_t i = 0; i < size; ++i)
{
parseItemNode(itemNode, intVector);
while(intVector < endVector)
parseItemNode(itemNode, ++intVector);
}
}
else
std::clog << "[Warning - Items::loadFromXml] Malformed entry (from: \"" << strValue << "\", to: \"" << endValue << "\")" << std::endl;
}
else
std::clog << "[Warning - Items::loadFromXml] No itemid found" << std::endl;
}[/cpp]
 
Last edited:
ofc not.. just use 2 storages 1 for checking monster count and other for checking quest completion.. also for pvp...
XML:
<mission name="Paw and Fur: Hydras" storageid="14021" startvalue="0" endvalue="2">
			<missionstate id="0" description="You already hunted |STORAGE:14022|/2000 hydras."/>
			<missionstate id="1" description="You killed 2000 hydras. Report back to Grizzly Adams."/>
			<missionstate id="2" description="You killed 2000 hydras. You can restart that task."/>
		</mission>

lil edit, here..

also..
LUA:
onkill..
if getPlayerStorageValue(cid,14022) < 1999 then
setPlayerStorageValue(cid,14022,getPlayerStorageValue(cid,14022)+1)
elseif getPlayerStorageValue(cid,14022) == 1999 then
setPlayerStorageValue(cid,14022,0)
setPlayerStorageValue(cid,14022,1)
end
end
 
Hm yes that would work :]

Is it very hard to adapt those functions I've posted above? just to know... I'll try here too, though I don't know a thing about cpp rs

I think items.cpp fromid toid function is the easiest to adapt, eh?
 
depends, it not the mostly hardest thing on world but its harder the in items cause items use ints (unless on unique ids and tfs 0.4 last revs)...



let i finish my dam function ongainexp and i take a look :S
nobody knows why this shit is not working
 
Hadouken!!
Hadouken.jpg
 

Similar threads

Back
Top