Jump to content
  • 0

Fame through script


Stolao

Question


  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

I'm trying to adjust a characters fame from in game, i can access and view fame though readparam(59) however i cannot seem to set it.

can anyone assist me?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   72
  • Joined:  10/20/12
  • Last Seen:  

script_commands.txt

While these behave as variables, do not always expect to just set them - it is

not certain whether this will work for all of them. Whenever there is a command

or a function to set something, it's usually preferable to use that instead. The

notable exception is Zeny, which you can and often will address directly -

setting it will make the character own this number of Zeny.

If you already tested it, there seems to be no script driven solution.

So you should look for an example of raising fame in the src.

Example for pharmacy_10 in src/map/skill.c:

case 10:
	fame += battle_config.fame_pharmacy_10; // Success to prepare 10 Condensed Potions in a row
//[...]
if (fame)
	pc_addfame(sd,fame);
The needed function is pc_addfame. Now you can simply create a script function like this:

Add to src/custom/script.inc:

/// Increases fame of the attached character
///
/// addfame <fame points>;
BUILDIN_FUNC(addfame)
{
	int fame;
	struct map_session_data *sd = script_rid2sd(st);
	
	nullpo_retr(1, sd); //Player must be attached
	fame = script_getnum(st,2);
	
	if( fame < 0 )
	{
		ShowError("addfame: Fame must be positive. (Fame=%d).\n", fame);
		return 1;
	}

	pc_addfame(sd,fame);

	return SCRIPT_CMD_SUCCESS;
}

Add to src/custom/script_def.inc:

BUILDIN_DEF(addfame,"i"),
Keep in mind that every job will get the fame points. Even if it's a High Wizard. Edited by Jey
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

quick bump

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

was going to re-post this question but noticed its still active sooooo necro-bump

 

but seriously how the hell can i change this

 

Ive tried an SQL query and tried changing it though set and such

i can load it with readparam(59) but setting seems to elude me

 

any thoughts?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

script_commands.txt

While these behave as variables, do not always expect to just set them - it is

not certain whether this will work for all of them. Whenever there is a command

or a function to set something, it's usually preferable to use that instead. The

notable exception is Zeny, which you can and often will address directly -

setting it will make the character own this number of Zeny.

If you already tested it, there seems to be no script driven solution.

So you should look for an example of raising fame in the src.

Example for pharmacy_10 in src/map/skill.c:

case 10:
	fame += battle_config.fame_pharmacy_10; // Success to prepare 10 Condensed Potions in a row
//[...]
if (fame)
	pc_addfame(sd,fame);
The needed function is pc_addfame. Now you can simply create a script function like this:

Add to src/custom/script.inc:

/// Increases fame of the attached character
///
/// addfame <fame points>;
BUILDIN_FUNC(addfame)
{
	int fame;
	struct map_session_data *sd = script_rid2sd(st);
	
	nullpo_retr(1, sd); //Player must be attached
	fame = script_getnum(st,2);
	
	if( fame < 0 )
	{
		ShowError("addfame: Fame must be positive. (Fame=%d).\n", fame);
		return 1;
	}

	pc_addfame(sd,fame);

	return SCRIPT_CMD_SUCCESS;
}

Add to src/custom/script_def.inc:

BUILDIN_DEF(addfame,"i"),
Keep in mind that every job will get the fame points. Even if it's a High Wizard.

 

 

ty I removed the negative check for more functionality

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...