Jump to content

Recommended Posts

Posted

Question about AG_ADVENTURE

If i wanted to add custom maps, or change the current one would that be possible and how?

I can't seem to find anything related to the code with the map listing on it.

Posted
4 hours ago, Zell said:

Where am I missing?

If i put CONQ_KILLNPC = 500 on my Script when killing a mob, the count its not working.

Counter type achievements work a bit differently; the target counter that you set (in achievement_db.yml) is your actual goal/condition. So first thing first, you want to add it to your achievement definition:

  - ID: 500001
    Group: "AG_BATTLE"
    Name: "Name"
    Target:
      Count: 500
    Score: 10

What you want to do isn't compatible with counter type achievements (you'd have to create a new group, pass it to AG_CHAT, and set the start value manually, etc). However you can do this easily via scripting instead:

OnPCKillNPC:
	if (CONQ_KILLNPC < 500) {
		CONQ_KILLNPC++;
		achievementupdate 500001, ACHIEVEINFO_COUNT1, CONQ_KILLNPC;
		
		if (CONQ_KILLNPC == 500) {
			achievementcomplete 500001;
		}
	}
	
	end;

Hmmm, it appears achievementupdate isn't included...! You can add this script function in your source:

//BUILDIN_DEF(achievementupdate,"iii?"),
BUILDIN_FUNC(achievementupdate) {
	struct map_session_data *sd;
	int i, achievement_id, type, value;

	achievement_id = script_getnum(st, 2);
	type = script_getnum(st, 3);
	value = script_getnum(st, 4);

	if (!script_charid2sd(5, sd)) {
		return SCRIPT_CMD_FAILURE;
	}

	if (achievement_search(achievement_id) == NULL) {
		ShowWarning("buildin_achievementupdate: Achievement '%d' doesn't exist.\n", achievement_id);
		return SCRIPT_CMD_FAILURE;
	}

	ARR_FIND(0, sd->achievement_data.count, i, sd->achievement_data.achievements[i].achievement_id == achievement_id);
	if (i == sd->achievement_data.count)
		achievement_add(sd, achievement_id);

	ARR_FIND(0, sd->achievement_data.count, i, sd->achievement_data.achievements[i].achievement_id == achievement_id);
	if (i == sd->achievement_data.count) {
		return SCRIPT_CMD_FAILURE;
	}

	if (type >= ACHIEVEINFO_COUNT1 && type <= ACHIEVEINFO_COUNT10)
		sd->achievement_data.achievements[i].count[type - 1] = value;
	else if (type == ACHIEVEINFO_COMPLETE)
		sd->achievement_data.achievements[i].complete = value ?  true : false;
	else if (type == ACHIEVEINFO_COMPLETEDATE)
		sd->achievement_data.achievements[i].completeDate = value;
	else if (type == ACHIEVEINFO_GOTREWARD)
		sd->achievement_data.achievements[i].gotReward = value ? true : false;
	else {
		ShowWarning("buildin_achievementupdate: Unknown type '%d'.\n", type);
		return SCRIPT_CMD_FAILURE;
	}

	achievement_update_achievement(sd, achievement_id, false);
	return SCRIPT_CMD_SUCCESS;
}

Best of luck ~!

  • Upvote 3
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...