Jump to content
  • 0

need help item script for item DB


mirabell

Question


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  197
  • Reputation:   19
  • Joined:  11/20/11
  • Last Seen:  

I'm trying this but i don't see any difference in SP or HP recovery 

if(BaseLevel<=50) {  bonus bMaxHPrate,100; bMaxSPrate,100;}

Basically im trying to make a item that will recover lower levels hp and sp  quickly till max level 50. I tried this and I tested the sp and hp recovery and it was the same no difference so maybe i did something wrong ?. Thank you

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  746
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

47 minutes ago, mirabell said:

I'm trying this but i don't see any difference in SP or HP recovery 

if(BaseLevel<=50) {  bonus bMaxHPrate,100; bMaxSPrate,100;}

Basically im trying to make a item that will recover lower levels hp and sp  quickly till max level 50. I tried this and I tested the sp and hp recovery and it was the same no difference so maybe i did something wrong ?. Thank you

Description Maximum SP + 15%
SP Recovery + 3%
Item Script
{ bonus bMaxSPrate,15; bonus bSPrecovRate,3; },{},{}
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

bonus bMaxHPrate,100; bMaxSPrate,100; will increase the max HP and SP

Try to look at https://github.com/rathena/rathena/blob/master/doc/item_bonus.txt#L152

You could use these bonuses depending of what you really want to achieve

bonus bHPrecovRate,n;   		Natural HP recovery ratio + n%
bonus bSPrecovRate,n;   		Natural SP recovery ratio + n%
bonus2 bHPRegenRate,n,t;		Gain n HP every t milliseconds
bonus2 bSPRegenRate,n,t;		Gain n SP every t milliseconds
bonus2 bRegenPercentHP,n,t;		Gain n% of max HP every t milliseconds
bonus2 bRegenPercentSP,n,t;		Gain n% of max SP every t milliseconds

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  197
  • Reputation:   19
  • Joined:  11/20/11
  • Last Seen:  

what im trying to do is

make a item that when you sit it regens your hp and sp fast but if you stand it stops

i tried this:

 if ( Sitting == 1 ){ bonus2 bSPRegenRate,50,500; bonus2 bHPRegenRate,50,500; }; 

But it doesn't work unless equipped  while sitting and when standing it doesnt detect it. I also tried to do it in call function

function	script	sit_regen	{

if ( Sitting == 1 ){
	bonus2 bSPRegenRate,50,500;
	bonus2 bHPRegenRate,50,500;
} else {
 	end;
}
return;
}

but didnt work either

Edited by mirabell
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

IDK if there's a script that could check if character is sitting.

Anyways try to add this to your source
script.c

/*==========================================
 * isSitting {<char_id>}
 * Checks if attached character is sitting
 *------------------------------------------*/
BUILDIN_FUNC(isSitting)
{
	TBL_PC *sd;

	if (!script_charid2sd(2,sd))
		return SCRIPT_CMD_FAILURE;
	
	if( pc_issit(sd) )
		script_pushint(st,1);
	else
		script_pushint(st,0);
	return SCRIPT_CMD_SUCCESS;
}

BUILDIN_DEF(isSitting,"?"),

 

Then try this item bonus

if ( isSitting ){ bonus2 bSPRegenRate,50,500; bonus2 bHPRegenRate,50,500; }; 

 

Didn't test it though. Let me know if it's working or no.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  197
  • Reputation:   19
  • Joined:  11/20/11
  • Last Seen:  

ok thanks ill try it today

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  197
  • Reputation:   19
  • Joined:  11/20/11
  • Last Seen:  

On 4/3/2017 at 1:52 AM, Technoken said:

IDK if there's a script that could check if character is sitting.

Anyways try to add this to your source
script.c


/*==========================================
 * isSitting {<char_id>}
 * Checks if attached character is sitting
 *------------------------------------------*/
BUILDIN_FUNC(isSitting)
{
	TBL_PC *sd;

	if (!script_charid2sd(2,sd))
		return SCRIPT_CMD_FAILURE;
	
	if( pc_issit(sd) )
		script_pushint(st,1);
	else
		script_pushint(st,0);
	return SCRIPT_CMD_SUCCESS;
}

BUILDIN_DEF(isSitting,"?"),

 

Then try this item bonus


if ( isSitting ){ bonus2 bSPRegenRate,50,500; bonus2 bHPRegenRate,50,500; }; 

 

Didn't test it though. Let me know if it's working or no.

It compiled with no error BUT mapserver  errored when loading it to a item

[Error]:
script error on item_db2_re line 72
    need '('
*   72 :  if ( isSitting ')'{ bonus2 bSPRegenRate,50,500; bonus2 bHPRegenRate,50,500; };

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

2 hours ago, mirabell said:

It compiled with no error BUT mapserver  errored when loading it to a item


[Error]:
script error on item_db2_re line 72
    need '('
*   72 :  if ( isSitting ')'{ bonus2 bSPRegenRate,50,500; bonus2 bHPRegenRate,50,500; };

 

Sorry it should be like this.

if ( isSitting() ) { bonus2 bSPRegenRate,50,500; bonus2 bHPRegenRate,50,500; };

 
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  197
  • Reputation:   19
  • Joined:  11/20/11
  • Last Seen:  

4 minutes ago, Technoken said:

Sorry it should be like this.


if ( isSitting() ) { bonus2 bSPRegenRate,50,500; bonus2 bHPRegenRate,50,500; };


 

thats odd i edit my post and said that i figure out it was

if ( isSitting() ) { bonus2 bSPRegenRate,50,500; bonus2 bHPRegenRate,50,500; };

but i still have the same issue as when i did it with a call function. when the player equip the item it has no effect, but if you equip the item while sitting down it works BUT if you stand up the effect continues no matter if you sit or stand. I guess it didnt save

Edited by mirabell
forgot to add
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

Maybe try to use OnPCStatCalcEvent. Idk if OnPCStatCalcEvent is triggered when the player sits. Just try it.

Like 

OnPCStatCalcEvent:
	if( isSitting ) {
		if( getequipisequiped(EQI_HEAD_TOP) )
			if( getequipid(EQI_HEAD_TOP) == <ITEM ID> )
				callfunc <function here>;
	}
	end;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  197
  • Reputation:   19
  • Joined:  11/20/11
  • Last Seen:  

13 minutes ago, Technoken said:

Maybe try to use OnPCStatCalcEvent. Idk if OnPCStatCalcEvent is triggered when the player sits. Just try it.

Like 


OnPCStatCalcEvent:
	if( isSitting ) {
		if( getequipisequiped(EQI_HEAD_TOP) )
			if( getequipid(EQI_HEAD_TOP) == <ITEM ID> )
				callfunc <function here>;
	}
	end;

 

didnt work, tho from what i am starting to understand, item_db script seems to  only be checked once when equipped and  only updates when an event happens like level up or job changes. I think that maybe issitting need to be able to refresh item db like leveling up, job change or anyways that itemdb script is checked and updated. Cause it seem to only do the effect when already sitting down and wont update at all afterward.

Edited by mirabell
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

Maybe someone here can help you. I think it needs another src mod to make it work..

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  197
  • Reputation:   19
  • Joined:  11/20/11
  • Last Seen:  

thanks for trying to help me

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