Jump to content
Angelmelody

bonus_script by cydh

Recommended Posts

This script command is from rathena  created by cydh ,I convert it to herc

 

*bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};This command will attach a script to a player for a given duration, in seconds.After that time, the script will automatically expire. The same bonus cannot bestacked. By default, this bonus will be stored on `bonus_script` table when playerlogs out.Note that the maximum number of 'bonus_script' commands that can run simultaneouslyfor a player is 20 (MAX_PC_BONUS_SCRIPT in 'src/common/mmo.h').Flags: (Default is 0)	&1: Remove when dead.	&2: Removable by Dispell.	&4: Removable by Clearance.	&8: Remove when player logs out.Types:	This will be used to decide negative or positive buff for 'debuff_on_logout'.	0: Ignore the buff type and won't be removed if the flag is not &8 (Default)	1: Buff	2: DebuffStatus_icon: See "Status Icon" section in 'db/const.txt'. Default is SI_BLANK (-1).Example:	// Apple gives you +5 Str bonus for 1 minute when it's consumed.	512,Apple,Apple,0,15,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bStr,5; }",60; },{},{}
 

 

 

 

download: bonus script.patch

 

 

---- Table structure for table `bonus_script`--CREATE TABLE IF NOT EXISTS `bonus_script` (  `char_id` varchar(11) NOT NULL,  `script` varchar(1024) NOT NULL,  `tick` varchar(11) NOT NULL DEFAULT '0',  `flag` varchar(3) NOT NULL DEFAULT '0',  `type` char(1) NOT NULL DEFAULT '0',  `icon` varchar(3) NOT NULL DEFAULT '-1') ENGINE=InnoDB;
Edited by Angelmelody

Share this post


Link to post
Share on other sites

 

This script command is from rathena  created by cydh ,I convert it to herc

 

*bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};This command will attach a script to a player for a given duration, in seconds.After that time, the script will automatically expire. The same bonus cannot bestacked

 

do it accept -1 for infinite duration?

Edited by evilpuncker

Share this post


Link to post
Share on other sites

I used this quite a lot when I was still on rathena forum

but one thing that bugs me is ...

*bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};

 

This command will attach a script to a player for a given duration, in seconds.

After that time, the script will automatically expire. The same bonus cannot be

stacked. By default, this bonus will be stored on `bonus_script` table when player

logs out.

let's say I finished a quest, and I get a bonus bstr, 10;

then I went into an event, which gives another bonus bstr,10;

it doesn't stack

that part needs to be revise a little bit

 

@evilpuncker

seems no

dur = 1000 * abs(script_getnum(st,3));
http://www.cprogramming.com/fod/abs.html

 

I tried on rathena test server

prontera,162,180,5	script	asdf	100,{	bonus_script "{ bonus bStr,5; }",-1;	end;}
I get bonus +5 str for 1 second

 

 

the one who made this release should be fixing this

 

Share this post


Link to post
Share on other sites

i have a problem on this part .. can you help me please.. 

2d6kz8g.jpg

 

Why don't you ignore the part status_calc_pc(sd, SCO_NONE);

Share this post


Link to post
Share on other sites

i have a problem on this part .. can you help me please.. 

2d6kz8g.jpg

 

pc.c inside  pc_setoption function

pc.c@@ -8091,6 +8091,13 @@ int pc_setoption(struct map_session_data *sd,int type) 		clif->sc_end(&sd->bl,sd->bl.id,AREA,SI_WUGRIDER); 		status_calc_pc(sd,SCO_NONE); 	}+	+	if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) {+		if( type&OPTION_MADOGEAR && !(p_type&OPTION_MADOGEAR) )+			pc->bonus_script_clear(sd,BONUS_FLAG_REM_ON_MADOGEAR); // cydh bonus_script+		else if( !(type&OPTION_MADOGEAR) && p_type&OPTION_MADOGEAR )+			pc->bonus_script_clear(sd,BONUS_FLAG_REM_ON_MADOGEAR); // cydh bonus_script+	}  	if( (type&OPTION_MADOGEAR && !(p_type&OPTION_MADOGEAR)) 	|| (!(type&OPTION_MADOGEAR) && p_type&OPTION_MADOGEAR) ) {

Share this post


Link to post
Share on other sites

 

 

This script command is from rathena  created by cydh ,I convert it to herc

 

*bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};This command will attach a script to a player for a given duration, in seconds.After that time, the script will automatically expire. The same bonus cannot bestacked

 

do it accept -1 for infinite duration?

 

 temporary patch for infinite duration when duration set to -1

 

infinite duration.patch

Share this post


Link to post
Share on other sites

got warning with gcc on centos

pc.c: In function 'pc_bonus_script_clear':pc.c:10858: warning: suggest parentheses around && within ||char.c: In function 'bonus_script_save':char.c:5070: warning: format '%d' expects type 'int', but argument 5 has type 'uint64'char.c:5076: warning: too many arguments for format

Share this post


Link to post
Share on other sites

got warning with gcc on centos

pc.c: In function 'pc_bonus_script_clear':pc.c:10858: warning: suggest parentheses around && within ||char.c: In function 'bonus_script_save':char.c:5070: warning: format '%d' expects type 'int', but argument 5 has type 'uint64'char.c:5076: warning: too many arguments for format

 

 

 

windows dont have that warning,but I can try to fix

 

for 1st warning

pc.c in pc_bonus_script_clear function 

 

find

		if (&sd->bonus_script[i] && sd->bonus_script[i].script &&			(sd->bonus_script[i].flag&flag || //Remove bonus script based on e_bonus_script_flags			(sd->bonus_script[i].type &&			(flag&BONUS_FLAG_REM_BUFF && sd->bonus_script[i].type == 1) || //Remove bonus script based on buff type			(flag&BONUS_FLAG_REM_DEBUFF && sd->bonus_script[i].type == 2)))) //Remove bonus script based on debuff type
replace with
		if(&sd->bonus_script[i] && sd->bonus_script[i].script && 			(sd->bonus_script[i].flag&flag || //Remove bonus script based on e_bonus_script_flags				(sd->bonus_script[i].type && 					((flag&BONUS_FLAG_REM_BUFF && sd->bonus_script[i].type == 1) || //Remove bonus script based on buff type					 (flag&BONUS_FLAG_REM_DEBUFF && sd->bonus_script[i].type == 2) //Remove bonus script based on debuff type					)				)			)		  )
for another warning

Can you post line 5070 and 5076 in your char.c ?

Edited by Angelmelody

Share this post


Link to post
Share on other sites
5070 : StrBuf->Printf(&buf,"('%d','%s','%d','%d','%d',",cid,esc_script,bs.tick,bs.flag,bs.type);5076 : ShowInfo("Saved %d bonus_script for char_id: %dn",count,cid,bs.icon);

char.c.diff

Share this post


Link to post
Share on other sites

 

 

5070 : StrBuf->Printf(&buf,"('%d','%s','%d','%d','%d',",cid,esc_script,bs.tick,bs.flag,bs.type);5076 : ShowInfo("Saved %d bonus_script for char_id: %dn",count,cid,bs.icon);
char.c.diff

 

 

find

StrBuf->Printf(&buf,"('%d','%s','%d','%d','%d',",cid,esc_script,bs.tick,bs.flag,bs.type);

change to

StrBuf->Printf(&buf,"('%d','%s','%u','%d','%d',",cid,esc_script,bs.tick,bs.flag,bs.type);

 

find

ShowInfo("Saved %d bonus_script for char_id: %dn",count,cid,bs.icon);

change to

ShowInfo("Saved %d bonus_script for char_id: %dn",count,cid);

Share this post


Link to post
Share on other sites
char.c: In function 'bonus_script_save':char.c:5070: warning: format '%u' expects type 'unsigned int', but argument 5 has type 'uint64'

changed uint64 tick; to unsigned int tick; in mmo.h removed the warning (is it right? about compatible compiler, source here) but what the difference '%u' and '%d' ?

Edited by Litro

Share this post


Link to post
Share on other sites

 

char.c: In function 'bonus_script_save':char.c:5070: warning: format '%u' expects type 'unsigned int', but argument 5 has type 'uint64'
changed uint64 tick; to unsigned int tick; in mmo.h removed the warning (is it right? about compatible compiler, source here) but what the difference '%u' and '%d' ?
WRONG WAY..(by chantging uint64 to unsigned int, you are lowering the limit of that variable, which can cause undesirable effects.)

instead change that

%u

To

%" PRIu64 "

p.s: the priu64 should be outside the quotes, and not inside the quotes.

%d - int, supporting 2.14bil

%u - unsigned int, supporting 0-4.xx bil

Uint64 - supproting till billions of billions (correct this one, if I am wrong :P)

Share this post


Link to post
Share on other sites

WRONG WAY..(by chantging uint64 to unsigned int, you are lowering the limit of that variable, which can cause undesirable effects.)

instead change that

%u

To

%" PRIu64 "

p.s: the priu64 should be outside the quotes, and not inside the quotes.

%d - int, supporting 2.14bil

%u - unsigned int, supporting 0-4.xx bil

Uint64 - supproting till billions of billions (correct this one, if I am wrong :P)

 

i have change it back to uint64 tick; and change the code like this and warning not appear

StrBuf->Printf(&buf,"('%d','%s','%llu','%d','%d',",cid,esc_script,bs.tick,bs.flag,bs.type)

i use %llu since the format used same by %d or %s and it says the same for %" PRIu64 ", and the "p.s: the priu64 should be outside the quotes, and not inside the quotes",im not sure how to write it into the code..

Share this post


Link to post
Share on other sites

 

WRONG WAY..(by chantging uint64 to unsigned int, you are lowering the limit of that variable, which can cause undesirable effects.)

instead change that

%u

To

%" PRIu64 "

p.s: the priu64 should be outside the quotes, and not inside the quotes.

%d - int, supporting 2.14bil

%u - unsigned int, supporting 0-4.xx bil

Uint64 - supproting till billions of billions (correct this one, if I am wrong :P)

 

i have change it back to uint64 tick; and change the code like this and warning not appear

StrBuf->Printf(&buf,"('%d','%s','%llu','%d','%d',",cid,esc_script,bs.tick,bs.flag,bs.type)
i use %llu since the format used same by %d or %s and it says the same for %" PRIu64 ", and the "p.s: the priu64 should be outside the quotes, and not inside the quotes",im not sure how to write it into the code..

try this ? (I merge bs.icon into one line)

StrBuf->Printf(&buf,"('%d','%s','%"PRId64"','%"PRIu8"','%d','%d')",cid,esc_script,bs.tick,bs.flag,bs.type,bs.icon);

Edited by Angelmelody

Share this post


Link to post
Share on other sites

try this ? (I merge bs.icon into one line)

StrBuf->Printf(&buf,"('%d','%s','%"PRId64"','%"PRIu8"','%d','%d')",cid,esc_script,bs.tick,bs.flag,bs.type,bs.icon);

 

Then i have to replace 2 line right ?

 

Find :

StrBuf->Printf(&buf,"('%d','%s','%llu','%d','%d',",cid,esc_script,bs.tick,bs.flag,bs.type);StrBuf->Printf(&buf, "'%d')", bs.icon);

Into :

StrBuf->Printf(&buf,"('%d','%s','%"PRId64"','%"PRIu8"','%d','%d')",cid,esc_script,bs.tick,bs.flag,bs.type,bs.icon);
Edited by Litro

Share this post


Link to post
Share on other sites

 

try this ? (I merge bs.icon into one line)

StrBuf->Printf(&buf,"('%d','%s','%"PRId64"','%"PRIu8"','%d','%d')",cid,esc_script,bs.tick,bs.flag,bs.type,bs.icon);

 

Then i have to replace 2 line right ?

 

Find :

StrBuf->Printf(&buf,"('%d','%s','%llu','%d','%d',",cid,esc_script,bs.tick,bs.flag,bs.type);StrBuf->Printf(&buf, "'%d')", bs.icon);

Into :

StrBuf->Printf(&buf,"('%d','%s','%"PRId64"','%"PRIu8"','%d','%d')",cid,esc_script,bs.tick,bs.flag,bs.type,bs.icon);

humhum,  I think its no need to divide into two lines

 

ouch!..forgot to say, PRId64(for thoese who already patched #8) and PRIu64 (for those who dosnt patched #8) 

Edited by Angelmelody

Share this post


Link to post
Share on other sites

 

 

try this ? (I merge bs.icon into one line)

StrBuf->Printf(&buf,"('%d','%s','%"PRId64"','%"PRIu8"','%d','%d')",cid,esc_script,bs.tick,bs.flag,bs.type,bs.icon);

 

Then i have to replace 2 line right ?

 

Find :

StrBuf->Printf(&buf,"('%d','%s','%llu','%d','%d',",cid,esc_script,bs.tick,bs.flag,bs.type);StrBuf->Printf(&buf, "'%d')", bs.icon);

Into :

StrBuf->Printf(&buf,"('%d','%s','%"PRId64"','%"PRIu8"','%d','%d')",cid,esc_script,bs.tick,bs.flag,bs.type,bs.icon);

humhum,  I think its no need to divide into two lines

 

ouch!..forgot to say, PRId64(for thoese who already patched #8) and PRIu64 (for those who dosnt patched #8) 

 

will you update the first post with issues fixed? =D

Share this post


Link to post
Share on other sites

any update please?.. im having error when recompiling .... im using the latest revision

I m using fresh emulator and don't have this mod so can't maintain it now

Share this post


Link to post
Share on other sites

 

any update please?.. im having error when recompiling .... im using the latest revision

I m using fresh emulator and don't have this mod so can't maintain it now

 

I Have problems With rAmod

im tryed your mod to -1 fix) but i have problems 

If you dont Understand Say me pls I give you links with my elulator) try pls but this mod is very very important for me

Ошибка	7	error C2065: timer: необъявленный идентификатор (..srcmapscript.c)	C:UsersСерыйDesktopTiamat 9970srcmapscript.c	21270	1	map-serverОшибка	8	error C2223: выражение слева от "->gettick" должно указывать на структуру или объединение (..srcmapscript.c)	C:UsersСерыйDesktopTiamat 9970srcmapscript.c	21270	1	map-serverОшибка	9	error C1903: не удается восстановить после предыдущих ошибок; остановка компиляции (..srcmapscript.c)	C:UsersСерыйDesktopTiamat 9970srcmapscript.c	21270	1	map-serverПредупреждение	10	warning C4244: функция: преобразование "int64" в "unsigned int", возможна потеря данных (..srcmapstatus.c)	C:UsersСерыйDesktopTiamat 9970srcmapstatus.c	3235	1	map-serverОшибка	4	error C2065: timerdata: необъявленный идентификатор (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1974	1	map-serverОшибка	5	error C2223: выражение слева от "->tick" должно указывать на структуру или объединение (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1974	1	map-serverОшибка	6	error C1903: не удается восстановить после предыдущих ошибок; остановка компиляции (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1974	1	map-serverОшибка	1	error C2065: timerdata: необъявленный идентификатор (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1970	1	map-serverПредупреждение	2	warning C4047: ==: "int" отличается по уровням косвенного обращения от "void *" (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1970	1	map-serverОшибка	3	error C2223: выражение слева от "->tick" должно указывать на структуру или объединение (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1970	1	map-server
Edited by Fizik

Share this post


Link to post
Share on other sites

@@Fizik

this mod was converted to hercules source, so better use the one in rAthena since your emulator is not based on hercules

Share this post


Link to post
Share on other sites

@@Fizik

this mod was converted to hercules source, so better use the one in rAthena since your emulator is not based on hercules

Can you Help me i dont have mod for Rathena((( But this is very importand for me(( Help plsss

Share this post


Link to post
Share on other sites

 

 

any update please?.. im having error when recompiling .... im using the latest revision

I m using fresh emulator and don't have this mod so can't maintain it now

 

I Have problems With rAmod

im tryed your mod to -1 fix) but i have problems 

If you dont Understand Say me pls I give you links with my elulator) try pls but this mod is very very important for me

Ошибка	7	error C2065: timer: необъявленный идентификатор (..srcmapscript.c)	C:UsersСерыйDesktopTiamat 9970srcmapscript.c	21270	1	map-serverОшибка	8	error C2223: выражение слева от "->gettick" должно указывать на структуру или объединение (..srcmapscript.c)	C:UsersСерыйDesktopTiamat 9970srcmapscript.c	21270	1	map-serverОшибка	9	error C1903: не удается восстановить после предыдущих ошибок; остановка компиляции (..srcmapscript.c)	C:UsersСерыйDesktopTiamat 9970srcmapscript.c	21270	1	map-serverПредупреждение	10	warning C4244: функция: преобразование "int64" в "unsigned int", возможна потеря данных (..srcmapstatus.c)	C:UsersСерыйDesktopTiamat 9970srcmapstatus.c	3235	1	map-serverОшибка	4	error C2065: timerdata: необъявленный идентификатор (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1974	1	map-serverОшибка	5	error C2223: выражение слева от "->tick" должно указывать на структуру или объединение (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1974	1	map-serverОшибка	6	error C1903: не удается восстановить после предыдущих ошибок; остановка компиляции (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1974	1	map-serverОшибка	1	error C2065: timerdata: необъявленный идентификатор (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1970	1	map-serverПредупреждение	2	warning C4047: ==: "int" отличается по уровням косвенного обращения от "void *" (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1970	1	map-serverОшибка	3	error C2223: выражение слева от "->tick" должно указывать на структуру или объединение (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1970	1	map-server

  this symbol  '->' is the feature of hooking function  on Herc  and not compatible with rathena , you have  to manually covert 

  into the corresponding function on rathena

Edited by Angelmelody

Share this post


Link to post
Share on other sites

 

 

 

any update please?.. im having error when recompiling .... im using the latest revision

I m using fresh emulator and don't have this mod so can't maintain it now

 

I Have problems With rAmod

im tryed your mod to -1 fix) but i have problems 

If you dont Understand Say me pls I give you links with my elulator) try pls but this mod is very very important for me

Ошибка	7	error C2065: timer: необъявленный идентификатор (..srcmapscript.c)	C:UsersСерыйDesktopTiamat 9970srcmapscript.c	21270	1	map-serverОшибка	8	error C2223: выражение слева от "->gettick" должно указывать на структуру или объединение (..srcmapscript.c)	C:UsersСерыйDesktopTiamat 9970srcmapscript.c	21270	1	map-serverОшибка	9	error C1903: не удается восстановить после предыдущих ошибок; остановка компиляции (..srcmapscript.c)	C:UsersСерыйDesktopTiamat 9970srcmapscript.c	21270	1	map-serverПредупреждение	10	warning C4244: функция: преобразование "int64" в "unsigned int", возможна потеря данных (..srcmapstatus.c)	C:UsersСерыйDesktopTiamat 9970srcmapstatus.c	3235	1	map-serverОшибка	4	error C2065: timerdata: необъявленный идентификатор (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1974	1	map-serverОшибка	5	error C2223: выражение слева от "->tick" должно указывать на структуру или объединение (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1974	1	map-serverОшибка	6	error C1903: не удается восстановить после предыдущих ошибок; остановка компиляции (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1974	1	map-serverОшибка	1	error C2065: timerdata: необъявленный идентификатор (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1970	1	map-serverПредупреждение	2	warning C4047: ==: "int" отличается по уровням косвенного обращения от "void *" (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1970	1	map-serverОшибка	3	error C2223: выражение слева от "->tick" должно указывать на структуру или объединение (..srcmapchrif.c)	C:UsersСерыйDesktopTiamat 9970srcmapchrif.c	1970	1	map-server

  this symbol  '->' is the feature of hooking function  on Herc  and not compatible with rathena , you have  to manually covert 

  into the corresponding function on rathena

 

And what a symbol instead of '->' ???

Edited by Fizik

Share this post


Link to post
Share on other sites

Okey) all done
can give you an example, I would want that bonus has never lost
That's what I write but After reconnect bonus will be lost
,{ bonus_script "{ bonus bStr,50;  bonus bVit,50;  bonus bInt,50; }",-1,512,{},{}
Help pls) 

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.