PDA

View Full Version : Added code for faction hits in quests


used_pawn
06-20-2003, 10:20 AM
Guess Im on a roll today :wink:

usage : faction(x)
where x is the 'id' value from the database table 'npc_faction'
thus, it acts like a faction hit, I thought this would be a handy way to do this (only have to remember one value to use multiple times) and still fully customizeable

../zone/parser.cpp :line 941 or thereabouts REPLACE this:

//else if (strstr(strlwr(arglist[0]),"faction")) {
// if (mob && mob->IsClient()) {
// int32 faction_id = atoi( )
// cout<<"Faction("<<faction_id<<","<<faction_value<<")"<<endl;
// //mob->CastToClient()->SetFactionLevel2(mob->GetID(), ), mob->GetClass(), mob->GetRace(), mob->GetDeity(), atoi(arglist[2]));
// }
//}


with this:

else if (strstr(strlwr(arglist[0]),"faction")) {
mob->CastToClient()->SetFactionLevel(mob->CastToClient()->CharacterID(),atoi(arglist[1]), mob->CastToClient()->GetClass(), mob->CastToClient()->GetRace(), mob->CastToClient()->GetDeity());
}


hope Im making someone happy :D
Now, time to update some content!!

Bigpull
06-20-2003, 11:46 AM
Hey i recognise that!! Totaly my fault left over from the " , wind32/linux wars =)

Should read thusly

else if (strstr(strlwr(arglist[0]),"faction")) {
if (mob && mob->IsClient()) {
sint32 faction_id = atoi(arglist[1]);
sint32 faction_value = atoi(arglist[2]);
mob->CastToClient()->SetFactionLevel2(mob->GetID(), faction_id, mob->GetClass(), mob->GetRace(), mob->GetDeity(), faction_value);
}
}


Btw if you use SetFactionLevel() instead of SetFactionLevel2() it's not quite the same thing, The first one handles all faction hits for a given npc, the later adds the specified value to the given faction id.

used_pawn
06-20-2003, 01:32 PM
aye, that is true... perhaps both should be used. Its much easier to define a faction 'hit' in the npc_faction database and be able to reuse that 'hit' with one number, rather than a whole set of commands... for me anyway :?

perhaps change my version to command 'factionhit' ?? :D