Jump to content
  • 0

Bonus stat upon login


Gouki

Question


  • Group:  Members
  • Topic Count:  82
  • Topics Per Day:  0.06
  • Content Count:  241
  • Reputation:   12
  • Joined:  08/12/20
  • Last Seen:  

Hi guys,

Is it possible to make *bonus script work on OnPCLoginEvent and OnPCLogoutEvent? Basically what I want is it gives bonus stat upon login based on character variable set.

---------------------------------------

*bonus <bonus type>,<val1>;
*bonus2 <bonus type>,<val1>,<val2>;
*bonus3 <bonus type>,<val1>,<val2>,<val3>;
*bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
*bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;

These commands are meant to be used in item scripts. They will probably work
outside item scripts, but the bonus will not persist for long. They, as
expected, refer only to an invoking character.

You can find the full list of possible bonuses and which command to use for each
kind in 'doc/item_bonus.txt'.

---------------------------------------


I have tried using *statusup2, it works but it falls under the base status of the character which I would want it to be on the + side of the stats. and If I change it to Bonus instead of statusup2, nothing happens.
 

---------------------------------------

*statusup2 <stat>,<amount>{,<char_id>};

This command will change a specified stat of the invoking character by the
specified amount permanently. The amount can be negative. See 'statusup'.

	// This will decrease a character's Vit forever.
	statusup2 bVit,-1;
---------------------------------------


Code runs something like --
 

-	script	abcdefg	-1,{

OnPCLoginEvent: 
	if (#vit_up == 1) statusup2 bVit,30;
end;
	
OnPCLogoutEvent: 
	if (#vit_up == 1) statusup2 bVit,-30;
end;
}


Further research, there are couple of scripts I found however requires OnPCStatCalcEvent which I think is removed already around 2020 githash. --> 
Sample script that uses bonus script command from @Emistry on link below

Removed on June 6, 2020 -> https://github.com/rathena/rathena/issues/2450#issuecomment-639630185

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

Hi,

you can't use bonus directly, but as a workaround you can use bonus_script.
There are just two things to be aware of when using bonus_script, the first is that it requires a duration.
The second is that when there is another bonus script  that is exactly the same, the second will be ignored.

For the first problem you can use a duration of for example 1 day and extend the duration every midnight by another day using the flags that bonus_script provides. 
Also, it would be a good idea to use the flags to make sure that the script gets removed on logout, otherwise the duration stacking could cause you trouble later.

The second problem isn't that big either. There aren't that many bonus scripts, and those that are there by default are unique.
But in case there are bonus scripts that are the same, let's say you have this bonus script in two places, and they should both be applied uniquely:
 

bonus_script "{ bonus bVit, 30; }", 60;

You can put in any other command to make the script be considered unique, for example, you could change one of those bonus scripts to look like this:
 

bonus_script "{ bonus bVit, 30; sleep2 0; }", 60;

The sleep2 makes the script unique and since it sleeps for 0 seconds it does nearly nothing.

Here is an example of how a solution possibly could look like:
 

-	script	LoginBonusStats	-1,{
	OnHour00:
	addrid 0;
	
	OnPCLoginEvent:
		if (#vit_up == 1) bonus_script "{ bonus bVit, 30; }", 86400, 1032;
}

 

Edited by Winterfox
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...