Jump to content
  • 0

Erase quest within same day, edit quest.cpp (SOLVED)


zeusc137

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  105
  • Reputation:   7
  • Joined:  04/11/22
  • Last Seen:  

I know erasequest uses the information from the player that executed the erasequest, in other words the player that interacted with the NPC script.

 

What about my script like the one below, but that call erasequest for all chars from all login:

 

-	script	ResetInstancesAtMidnight	-1,{
		
	OnHour00:
    erasequest 99999;
    announce "[Timer] Instance was reseted";

    end;
}

 

Any ideas are very welcome! I was trying to create my own "erasequest2" command but I didn't find a way to run sql there and get all the accountid:

 

/**
 * erasequest2 <ID>{,<char_id>};
 **/
BUILDIN_FUNC(erasequest)
{
	map_session_data* sd;

	// list of all player I get from SELECT accountid from ragnarok.login:


	if (!script_charid2sd(3, sd))
		return SCRIPT_CMD_FAILURE;

	if (quest_delete(sd, script_getnum(st, 2)) == -1) {
		script_reportsrc(st);
		script_reportfunc(st);
	}
	pc_show_questinfo(sd);

	return SCRIPT_CMD_SUCCESS;
}

 

Thanks in advance!

Edited by zeusc137
my problem was solved
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  105
  • Reputation:   7
  • Joined:  04/11/22
  • Last Seen:  

6 hours ago, crazyarashi said:

It would save you the trouble if you would just use the quest_db and make those quest reset at midnight.

Hey I found out a good way I can use your suggestion with TimeLimit and the end result will be as I wished.

I just changed this part of src/map/quest.cpp:

		// if (time_today >= (qi->time % 86400)) // Carry over to the next day
		if (time_today >= qi->time) // Don't Carry over to the next day
			day_shift = 1;


 

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  776
  • Reputation:   239
  • Joined:  02/11/17
  • Last Seen:  

It would save you the trouble if you would just use the quest_db and make those quest reset at midnight.

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  105
  • Reputation:   7
  • Joined:  04/11/22
  • Last Seen:  

3 hours ago, crazyarashi said:

It would save you the trouble if you would just use the quest_db and make those quest reset at midnight.

I tested this one, but the only problem is this scenario:

- Player starts instance at 11h30pm and finishes it before 11h50pm for example

- Then he stays up to go for the next round by just waiting a few minutes

- However instead of reseting at midnight of "that day" it needs to wait for +1 day, right?

 

I thought I could create a script/npc that call "erasequest2all" using OnTimer/OnClock, but it's getting very hard to understand the ".cpp" part of it and create my own "erasequest2all"...

I'm even considering writing a direct "UPDATE ragnarok.quest SET timer=mycustomtime WHERE quest_id IN ( MY_LIST_OF_QUESTS_TO_RESET )"

Would you go that far or maybe give me a different opinion?

 

Thank you very much so far! ❤️ 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...