Jump to content

Achievement System


Aleos

Recommended Posts


  • Group:  Developer
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  547
  • Reputation:   270
  • Joined:  11/08/11
  • Last Seen:  

Since aleos did not mention it explicitly:

We require GCC 5 or newer from now on. Otherwise you will get a ton of warnings for yaml.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  311
  • Reputation:   46
  • Joined:  11/06/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  657
  • Reputation:   662
  • Joined:  11/12/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  411
  • Reputation:   260
  • Joined:  04/25/12
  • Last Seen:  

Thanks tokei!

Works like a charm.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

On 7/28/2017 at 3:46 PM, Lemongrass said:

Since aleos did not mention it explicitly:

We require GCC 5 or newer from now on. Otherwise you will get a ton of warnings for yaml.

can you help updating guide on get started docs i'm getting confused as how to install gcc5 and use it as default compiler https://github.com/rathena/rathena/wiki/Install-on-Centos

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...