02 Feb, 2010, deathrow35 wrote in the 1st comment:
Votes: 0
Ok, so I am trying to add to Vassago's quest code. Anyways, I want the item not to be found on a char. I want the char to have to deliver something to a mob but i am writing a code so that the check to see if quest is completed is just not finding the obj on the char. I know not the best way but I have a code in that doesn't let them character get rid of obj unless is questmob or time runs out.
but anyways, here it is

else if (ch->questbox < 1 && ch->countdown > 0)
{

bool obj_found = FALSE;

for (obj = ch->carrying; obj != NULL; obj= obj_next)
{
obj_next = obj->next_content;

if (obj != NULL && obj->pIndexData->vnum != ch->questbox)
{
obj_found = TRUE;
break;
}
}
The only problem I seem to be having is not completing the quest. I am pretty sure the error is in this. Fixed everything else but can't seem to get it to recognize that the item to be deliverd isnt being carried anymore. I ahave messed with about everything in here to get it to work but can't
02 Feb, 2010, Crelin wrote in the 2nd comment:
Votes: 0
I can't completely understand what you're trying to do but if the code up there is supposed to see if the char is carrying the object then shouldn't the line
if (obj != NULL && obj->pIndexData->vnum != ch->questbox)
be
if (obj->pIndexData->vnum == ch->questbox)
to say that if the objects vnum does equal the questbox number then the object was found. (you can also get rid of the first part of the if check making sure the object isn't null since the for loop would end if the object was null anyways and therefore not even get to that check.)
02 Feb, 2010, deathrow35 wrote in the 3rd comment:
Votes: 0
yes, but to complete the quest i want it to see that the item is not being carried by the char. The PC will have delivered the oboject to a mob
02 Feb, 2010, Crelin wrote in the 4th comment:
Votes: 0
then my code change would still apply, just check for obj_found being false to reward any points and complete the quest.

else if (ch->questbox < 1 && ch->countdown > 0)
{

bool obj_found = FALSE;

for (obj = ch->carrying; obj != NULL; obj= obj_next)
{
obj_next = obj->next_content;

if (obj->pIndexData->vnum == ch->questbox)
{
obj_found = TRUE;
break;
}
}
if (obj_found == FALSE)
{
/*Point rewarding stuff*/


this is assuming that ch->questbox is the vnum of the quest object that was to be delivered.

Edit: On second look, if ch->questbox is the vnum of the object to be delivered then this code would never go through anyways since the overhead check wants ch->questbox to be less than 1 (and in dikurivatives, I've never seen a 0 or negative vnum). So what exactly is ch->questbox since you compare a vnum to it in the for loop.
02 Feb, 2010, deathrow35 wrote in the 5th comment:
Votes: 0
that worked for me, now think i just have a little problem with a bracket but should b#e able to get it. Anyways. i thought it was looking for # of questbox. but like i said i had switched a lot of that around to return false. I had it set at questbox > 0 most of the time, just recently switched to try it out. But thanks for the help. greatly appreciated
0.0/5