Angelmelody 221 Posted August 3, 2014 (edited) 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 August 22, 2014 by Angelmelody 2 icabit and evilpuncker reacted to this Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted August 3, 2014 Nice, why not make PR*Pull Request) of this? Quote Share this post Link to post Share on other sites
evilpuncker 504 Posted September 3, 2014 (edited) 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 September 3, 2014 by evilpuncker Quote Share this post Link to post Share on other sites
AnnieRuru 957 Posted September 3, 2014 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 Quote Share this post Link to post Share on other sites
Jedzkie 58 Posted September 3, 2014 i have a problem on this part .. can you help me please.. Why don't you ignore the part status_calc_pc(sd, SCO_NONE); Quote Share this post Link to post Share on other sites
Angelmelody 221 Posted September 4, 2014 i have a problem on this part .. can you help me please.. 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) ) { 1 Quazi reacted to this Quote Share this post Link to post Share on other sites
Angelmelody 221 Posted September 4, 2014 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 2 Only4fun and evilpuncker reacted to this Quote Share this post Link to post Share on other sites
Litro 45 Posted September 8, 2014 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 Quote Share this post Link to post Share on other sites
Angelmelody 221 Posted September 8, 2014 (edited) 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 typereplace 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 warningCan you post line 5070 and 5076 in your char.c ? Edited September 8, 2014 by Angelmelody Quote Share this post Link to post Share on other sites
Litro 45 Posted September 9, 2014 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 Quote Share this post Link to post Share on other sites
Angelmelody 221 Posted September 9, 2014 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 findStrBuf->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); Quote Share this post Link to post Share on other sites
Litro 45 Posted September 9, 2014 (edited) 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 September 9, 2014 by Litro Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted September 9, 2014 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 ) 1 Angelmelody reacted to this Quote Share this post Link to post Share on other sites
Litro 45 Posted September 9, 2014 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 ) 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.. Quote Share this post Link to post Share on other sites
Angelmelody 221 Posted September 9, 2014 (edited) 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 ) 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 September 9, 2014 by Angelmelody Quote Share this post Link to post Share on other sites
Litro 45 Posted September 9, 2014 (edited) 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 September 9, 2014 by Litro Quote Share this post Link to post Share on other sites
Angelmelody 221 Posted September 9, 2014 (edited) 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 September 9, 2014 by Angelmelody Quote Share this post Link to post Share on other sites
evilpuncker 504 Posted February 27, 2015 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 Quote Share this post Link to post Share on other sites
Angelmelody 221 Posted May 3, 2015 any update please?.. im having error when recompiling .... im using the latest revisionI m using fresh emulator and don't have this mod so can't maintain it now Quote Share this post Link to post Share on other sites
Fizik 2 Posted June 1, 2015 (edited) any update please?.. im having error when recompiling .... im using the latest revisionI 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 June 1, 2015 by Fizik Quote Share this post Link to post Share on other sites
evilpuncker 504 Posted June 1, 2015 @@Fizik this mod was converted to hercules source, so better use the one in rAthena since your emulator is not based on hercules Quote Share this post Link to post Share on other sites
Fizik 2 Posted June 1, 2015 @@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 Quote Share this post Link to post Share on other sites
Angelmelody 221 Posted June 1, 2015 (edited) any update please?.. im having error when recompiling .... im using the latest revisionI 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 June 1, 2015 by Angelmelody Quote Share this post Link to post Share on other sites
Fizik 2 Posted June 1, 2015 (edited) any update please?.. im having error when recompiling .... im using the latest revisionI 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 June 1, 2015 by Fizik Quote Share this post Link to post Share on other sites
Fizik 2 Posted June 2, 2015 Okey) all donecan give you an example, I would want that bonus has never lostThat'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) Quote Share this post Link to post Share on other sites