Jump to content

AnnieRuru

Members
  • Posts

    2044
  • Joined

  • Last visited

  • Days Won

    51

Posts posted by AnnieRuru

  1. 52 minutes ago, TeoBeack said:

    It was really good, I am very grateful. Just one more doubt. how do I reset this pvp rank?

    type `@resetladder`, the *bindatcmd script command does it, currently only GM can do it

    or you want something like weekly reset ladder, or monthly reset ladder ?

    • Like 1
  2. 3 minutes ago, TeoBeack said:

    Google Translate:
    Yes, I got a script of your script on Hercules, because I'm having trouble finding a PVP with rank, I even found one that didn't use SQL, it had a store and everything, it was working well but it had an error when buying item on
    pvp store like, you could buy more I wasn’t spending the points I wasn’t spending zeny in short I wasn’t spending anything, nor was I even earning points.
    The emulator I'm using is rAthena.

    so bascially you want 2 things,
    1. you want a pvp store
    2. you are using rAthena

    https://gist.github.com/AnnieRuru/2b21eccc7e04a4bd6fb39a42c612a511

    introduce another player variable, and can be use in point shop
    this variable doesn't clash with points earn from ladder, and cannot be reset by GM

    • Like 1
  3. wait wait wait this is MY script...
    https://annieruru.blogspot.com/2019/01/another-approach-to-write-pvp-ladder.html

    for some reason you are using TXT style pvp ladder, which is .... well its plug and play, but its actually difficult to modify a value or reset the ladder later on
    that's why most server use SQL pvp ladder, not only because its easy to modify a value, but also can output the result onto the website
    you are requesting to reset the ladder on a TXT style ladder, you have to set another server variable and compare with another player variable for this to work

    I already did this before on hercules forum though
    https://upaste.me/c8d12185033897498 -> topic

    Download: https://gist.github.com/AnnieRuru/2b21eccc7e04a4bd6fb39a42c612a511

    btw, you are using hercules ? why you didn't change getcharid(CHAR_ID_ACCOUNT) into getcharid(3) and so on ?

     

      

    59 minutes ago, TeoBeack said:

    Esse adicionei certinho mais quando falo com o npc não acontece nada, Lembrado que esse script é TXT ele não contem sql.

    Google translate (from Portugese): This I added more correctly when I talk to the npc nothing happens, Remembering that this script is TXT it does not contain sql.
    Exactly !!

    • Like 1
  4. ok I take this chance to relearn how to make rathena custom instance script
    this is previous topic ->

    the very first thing I noticed is ... this YAML format .... I hate it so much

    [Error]: Failed to read INSTANCE_DB database file from 'db/import/instance_db.yml'.
    [Error]: end of sequence not found (Line 43: Column 4)

    to fix this issue, you have to add an extra line before the Body:

    Header:
      Type: INSTANCE_DB
      Version: 1
    
    
    Body:
      - Id: 34
        Name: Test Instance
        TimeLimit: 3600
        IdleTimeOut: 15
        Enter:
            Map: guild_vs2
            X: 49
            Y: 49

    WHat The F***

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

    2nd, IM_CHAR doesn't work .....

    another WHAT the F***

    EDIT: it seems only IM_PARTY works currently, all other types are broken

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

    ok anyway this topic ask for a party, IM_PARTY works at least .... fuh .....

    prontera,155,180,0	script	Test Instance	1_F_MARIA,{
    //	dispbottom "- "+ instance_mapname("guild_vs2") +" + "+ instance_id(IM_PARTY);
    	select "Create Instance", "Instance Enter";
    	if (@menu == 1) {
    		if (instance_create("Test Instance", IM_PARTY) < 0) {
    			mes "failed to create instance";
    			close;
    		}
    		mes "Instance create successful";
    		close;
    	}
    	if (!instance_id(IM_PARTY)) {
    		mes "instance not create yet";
    		close;
    	}
    	instance_enter "Test Instance";
    	end;
    }
    guild_vs2,49,49,5	script	test dialog	1_F_MARIA,{
    	dispbottom strnpcinfo(4);
    	mes sprintf("%d monsters on this map", 'amount);
    	next;
    	select "Destroy";
    	instance_destroy;
    	end;
    OnInstanceInit:
    	monster instance_mapname("guild_vs2"), 49,49, "--ja--", 1002, 10, instance_npcname(strnpcinfo(0))+"::OnMobDead";
    	'amount = 10;
    	end;
    OnMobDead:
    	--'amount;
    	if ( !'amount ) {
    		instance_announce 0, "all monster killed", bc_map;
    		.@party_id = instance_live_info(ILI_OWNER);
    		getpartymember .@party_id, 1;
    		getpartymember .@party_id, 2;
    		for (.@i = 0; .@i < $@partymembercount; ++.@i) {
    			if (isloggedin($@partymemberaid[.@i], $@partymembercid[.@i]))
    				getitem 512, 1, $@partymemberaid;
    		}
    		sleep 2000;
    		instance_destroy;
    	}
    	end;
    }

    it seems *instance_mapname can no longer be use to check which instance ID they are in
    but *instance_id is now fixed for rathena, not so bad

    time to update my blog

  5. hmm, it seems unit_attack function only trigger when 1st click on the monster
    if do a continues attack (/nc) it doesn't reset the timer

    try battle_check_target then
    https://github.com/AnnieRuru/Release/blob/master/plugins/deadbranch_timerdelete/deadbranch_timerdelete_0.2.diff

    @Bringer

     


    Edit for below -> @Bringer

    I've made the script according to the request of the topic starter, and has been mark solved

    what you want is If the mob doesn't been hit OR didn't attack a player for 5mins
    you are requesting additional feature, you should open a new topic

    in fact this message is consider backseat moderating, and I should get a warning =/

    • Upvote 1
  6. let's see

    prontera,155,187,5	script	dsasda	1_F_MARIA,{
    	.@map$ = strnpcinfo(4);
    	npctalk "I am currently in "+ .@map$;
    	sleep 1000;
    	if ( .@map$ == "prontera" )
    		unitwarp getnpcid(0), "morocc",156,93;
    	else if ( .@map$ == "morocc" )
    		unitwarp getnpcid(0), "prontera", 156,191;
    	end;
    }

    still works in latest rathena, means your script has bugs

    honestly from reading your script alone I can't tell what you are trying to do
    your description on your 1st post doesn't match what you are trying to do with your script

    3 hours ago, chronoscrowler said:

    and returns to original position after an hour. so far all attempts at tweaking the script doesn't execute the "return to original position" part.

    where is your *initnpctimer or *sleep ?

     

    3 hours ago, chronoscrowler said:

    if (gettime(5) == .@monthday[rand(28)] && gettime(3) == .@daytime[rand(14)])

    I totally don't understand this line, if you want your script to execute on the 1st day on each month, why do a check gettime(DT_DAYOFWEEK) again ?
    its like you are trying to make that condition false in purpose

     

    • Upvote 1
  7. Spoiler

    if want to use on npc script has to use OnPCStatCalcEvent

    
    // this is tested working on hercules
    prontera,155,185,5	script	jkfhsdf	1_F_MARIA,{
    	gympassmemory = 10;
    	recalculatestat;
    	end;
    OnPCStatCalcEvent:
    	if (gympassmemory == 10)
    		bonus bAddMaxWeight, -1000;
    	end;
    }

    if I still remember correctly, rathena's *recalculatestat is bug ... let me test a bit ...

    OH rathena finally remove this label, so long the legacy of this script event
    so nope, apparently I couldn't think of a way to reduce player's weight in npc scripts, other than write this directly in the source code

    --off topic--
    by the way what's your username on discord ?

     

    BIG EDIT:
    after discuss this issue in discord, finally I understand the gympassmemory come from official script
    https://github.com/rathena/rathena/blob/master/npc/other/gympass.txt

    to remove the weight learn from ALL_INCCARRY, the answer is just to remove this skill learn from your players

    .... what a bummer, totally different direction
    that's why I prefer to support over in discord, there are a lot of times members never explain properly on the forum

     

    solved in discord

    Quote

    AlmondToday at 7:09 AM

    Awesome this worked, skill "ALL_INCCARRY",0,SKILL_PERM_GRANT; stupid mee..
    [7:09 AM]
    yup thats the one!

     

    • Upvote 1
  8. answer all your question

    set MaxWeight, MaxWeight - 1000;

    yes,  I remember there was a bug report that merchant's increase weight limit doesn't work properly after using MaxWeight constant

    however after me suggesting adding `bAddMaxWeight` the problem is gone

    there shouldn't be any problem as the weight formula is calculate properly if using bAddMaxWeight -> eg: if they equip this item they immediately overweight if low strength

    bonus bAddMaxWeight, -1000;

     

  9. my discord is AnnieRuru#1609
    if you join hercules' discord channel my name appear as a staff

    regarding my PM box on rathena .... when I was a moderator on rathena, all moderator has increase PM box size limit, over 100
    and my PM box got bomb ... I mean I have over 140 PM conversations
    after demoted as retired staff the PM box size limit return back to 100, and now my rathena forum's PM box is over the limit of 100, so nobody can send me any PM hahaha

    I guess just readd the fixed party limit check back, I double check and it was in your script
    https://github.com/AnnieRuru/Release/blob/master/scripts/Battlegrounds/PartyVsParty/PartyVsParty_0.2r.txt

  10. prontera,155,185,5	script	fhdskdjf	1_F_MARIA,{
    	mes "select a stat to reduce by 10";
    	next;
    	.@s = select("Str","Agi","Vit","Int","Dex","Luk") -1;
    	for (.@i = 0; .@i < 10; ++.@i) {
    		if (readparam(.stat[.@s]) == 1)
    			break;
    		statusup2 .stat[.@s], -1;
    		StatusPoint += needed_status_point(.stat[.@s], 1);
    	}
    	close;
    OnInit:
    	setarray .stat, bStr, bAgi, bVit, bInt, bDex, bLuk;
    	end;
    }

     

    • Love 1
  11. 	setarray .@P1[0],50,501,1;
    	setarray .@P2[0],90,501,1;
    	setarray .@P3[0],90,501,1;
    	setarray .@P4[0],90,501,1;
    	setarray .@P5[0],90,501,1;
    	setarray .@P6[0],90,501,1;
    	setarray .@P7[0],90,501,1;
    	setarray .@Default[0],502,1,503,1,504,1,505,1;

    when it hit .@Default, this line will give me a whole set of item ID 502,503,504,505 ...  4 items

    if you want random then go F_Rand as usual

    setarray .@Default[0],F_Rand(502,503,504,505),1;

     

  12. ... same person ... ok I answer this one, my main forum is hercules so I wont be around forever

     

    the trick is ... add return; to all the functions containing title MAIL, this will effectively block all the codes of mail to run

     src/map/clif.cpp | 23 +++++++++++++++++++++++
     1 file changed, 23 insertions(+)
    
    diff --git a/src/map/clif.cpp b/src/map/clif.cpp
    index da270e2ff..13658d283 100644
    --- a/src/map/clif.cpp
    +++ b/src/map/clif.cpp
    @@ -15342,6 +15342,7 @@ void clif_parse_Check(int fd, struct map_session_data *sd)
     ///		1 = over weight
     ///		2 = fatal error
     void clif_Mail_setattachment( struct map_session_data* sd, int index, int amount, uint8 flag ){
    +	return;
     	int fd = sd->fd;
     
     #if PACKETVER < 20150513
    @@ -15397,6 +15398,7 @@ void clif_Mail_setattachment( struct map_session_data* sd, int index, int amount
     /// 09f2 <mail id>.Q <mail tab>.B <result>.B (ZC_ACK_ZENY_FROM_MAIL)
     /// 09f4 <mail id>.Q <mail tab>.B <result>.B (ZC_ACK_ITEM_FROM_MAIL)
     void clif_mail_getattachment(struct map_session_data* sd, struct mail_message *msg, uint8 result, enum mail_attachment_type type) {
    +	return;
     #if PACKETVER < 20150513
     	int fd = sd->fd;
     
    @@ -15433,6 +15435,7 @@ void clif_mail_getattachment(struct map_session_data* sd, struct mail_message *m
     ///     1 = recipinent does not exist
     /// 09ed <result>.B (ZC_ACK_WRITE_MAIL)
     void clif_Mail_send(struct map_session_data* sd, enum mail_send_result result){
    +	return;
     #if PACKETVER < 20150513
     	int fd = sd->fd;
     
    @@ -15457,6 +15460,7 @@ void clif_Mail_send(struct map_session_data* sd, enum mail_send_result result){
     ///     1 = failure
     // 09f6 <mail tab>.B <mail id>.Q (ZC_ACK_DELETE_MAIL)
     void clif_mail_delete( struct map_session_data* sd, struct mail_message *msg, bool success ){
    +	return;
     #if PACKETVER < 20150513
     	int fd = sd->fd;
     
    @@ -15486,6 +15490,7 @@ void clif_mail_delete( struct map_session_data* sd, struct mail_message *msg, bo
     ///     1 = failure
     void clif_Mail_return(int fd, int mail_id, short fail)
     {
    +	return;
     	WFIFOHEAD(fd,packet_len(0x274));
     	WFIFOW(fd,0) = 0x274;
     	WFIFOL(fd,2) = mail_id;
    @@ -15497,6 +15502,7 @@ void clif_Mail_return(int fd, int mail_id, short fail)
     /// 024a <mail id>.L <title>.40B <sender>.24B (ZC_MAIL_RECEIVE)
     /// 09e7 <result>.B (ZC_NOTIFY_UNREADMAIL)
     void clif_Mail_new(struct map_session_data* sd, int mail_id, const char *sender, const char *title){
    +	return;
     #if PACKETVER < 20150513
     	int fd = sd->fd;
     
    @@ -15522,6 +15528,7 @@ void clif_Mail_new(struct map_session_data* sd, int mail_id, const char *sender,
     ///     1 = close
     void clif_Mail_window(int fd, int flag)
     {
    +	return;
     	WFIFOHEAD(fd,packet_len(0x260));
     	WFIFOW(fd,0) = 0x260;
     	WFIFOL(fd,2) = flag;
    @@ -15540,6 +15547,7 @@ void clif_Mail_window(int fd, int flag)
     /// 0ac2 <packet len>.W <unknown>.B (ZC_ACK_MAIL_LIST3)
     ///		{ <type>.B <mail id>.Q <read>.B <type>.B <sender>.24B <expires>.L <title length>.W <title>.?B }*
     void clif_Mail_refreshinbox(struct map_session_data *sd,enum mail_inbox_type type,int64 mailID){
    +	return;
     #if PACKETVER < 20150513
     	int fd = sd->fd;
     	struct mail_data *md = &sd->mail.inbox;
    @@ -15733,6 +15741,7 @@ void clif_Mail_refreshinbox(struct map_session_data *sd,enum mail_inbox_type typ
     /// 0ac0 <mail id>.Q <unknown>.16B (CZ_OPEN_MAILBOX2)
     /// 0ac1 <mail id>.Q <unknown>.16B (CZ_REQ_REFRESH_MAIL_LIST2)
     void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd){
    +	return;
     #if PACKETVER < 20150513
     	struct mail_data* md = &sd->mail.inbox;
     
    @@ -15796,6 +15805,7 @@ void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd){
     ///		{  }*n
     // TODO: Packet description => for repeated block
     void clif_Mail_read( struct map_session_data *sd, int mail_id ){
    +	return;
     	int i, fd = sd->fd;
     
     	ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
    @@ -15911,6 +15921,7 @@ void clif_Mail_read( struct map_session_data *sd, int mail_id ){
     /// 0241 <mail id>.L (CZ_MAIL_OPEN)
     /// 09ea <mail tab>.B <mail id>.Q (CZ_REQ_READ_MAIL)
     void clif_parse_Mail_read(int fd, struct map_session_data *sd){
    +	return;
     #if PACKETVER < 20150513
     	int mail_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
     #else
    @@ -15929,6 +15940,7 @@ void clif_parse_Mail_read(int fd, struct map_session_data *sd){
     /// Allow a player to begin writing a mail
     /// 0a12 <receiver>.24B <success>.B (ZC_ACK_OPEN_WRITE_MAIL)
     void clif_send_Mail_beginwrite_ack( struct map_session_data *sd, char* name, bool success ){
    +	return;
     	PACKET_ZC_ACK_OPEN_WRITE_MAIL p = { 0 };
     
     	p.PacketType = rodexopenwrite;
    @@ -15940,6 +15952,7 @@ void clif_send_Mail_beginwrite_ack( struct map_session_data *sd, char* name, boo
     /// Request to start writing a mail
     /// 0a08 <receiver>.24B (CZ_REQ_OPEN_WRITE_MAIL)
     void clif_parse_Mail_beginwrite( int fd, struct map_session_data *sd ){
    +	return;
     	char name[NAME_LENGTH];
     
     	safestrncpy(name, RFIFOCP(fd, 2), NAME_LENGTH);
    @@ -15958,6 +15971,7 @@ void clif_parse_Mail_beginwrite( int fd, struct map_session_data *sd ){
     /// Notification that the client cancelled writing a mail
     /// 0a03 (CZ_REQ_CANCEL_WRITE_MAIL)
     void clif_parse_Mail_cancelwrite( int fd, struct map_session_data *sd ){
    +	return;
     	sd->state.mail_writing = false;
     }
     
    @@ -15965,6 +15979,7 @@ void clif_parse_Mail_cancelwrite( int fd, struct map_session_data *sd ){
     /// 0a14 <char id>.L <class>.W <base level>.W (ZC_CHECK_RECEIVE_CHARACTER_NAME)
     /// 0a51 <char id>.L <class>.W <base level>.W <name>.24B (ZC_CHECK_RECEIVE_CHARACTER_NAME2)
     void clif_Mail_Receiver_Ack( struct map_session_data* sd, uint32 char_id, short class_, uint32 level, const char* name ){
    +	return;
     	PACKET_ZC_CHECKNAME p = { 0 };
     
     	p.PacketType = rodexcheckplayer;
    @@ -15980,6 +15995,7 @@ void clif_Mail_Receiver_Ack( struct map_session_data* sd, uint32 char_id, short
     /// Request information about the recipient
     /// 0a13 <name>.24B (CZ_CHECK_RECEIVE_CHARACTER_NAME)
     void clif_parse_Mail_Receiver_Check(int fd, struct map_session_data *sd) {
    +	return;
     	static char name[NAME_LENGTH];
     
     	safestrncpy(name, RFIFOCP(fd, 2), NAME_LENGTH);
    @@ -15992,6 +16008,7 @@ void clif_parse_Mail_Receiver_Check(int fd, struct map_session_data *sd) {
     /// 09f1 <mail id>.Q <mail tab>.B (CZ_REQ_ZENY_FROM_MAIL)
     /// 09f3 <mail id>.Q <mail tab>.B (CZ_REQ_ITEM_FROM_MAIL)
     void clif_parse_Mail_getattach( int fd, struct map_session_data *sd ){
    +	return;
     	int i;
     	struct mail_message* msg;
     #if PACKETVER < 20150513
    @@ -16090,6 +16107,7 @@ void clif_parse_Mail_getattach( int fd, struct map_session_data *sd ){
     /// 0243 <mail id>.L (CZ_MAIL_DELETE)
     /// 09f5 <mail tab>.B <mail id>.Q (CZ_REQ_DELETE_MAIL)
     void clif_parse_Mail_delete(int fd, struct map_session_data *sd){
    +	return;
     #if PACKETVER < 20150513
     	int mail_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
     #else
    @@ -16134,6 +16152,7 @@ void clif_parse_Mail_delete(int fd, struct map_session_data *sd){
     /// Request to return a mail (CZ_REQ_MAIL_RETURN).
     /// 0273 <mail id>.L <receive name>.24B
     void clif_parse_Mail_return(int fd, struct map_session_data *sd){
    +	return;
     	int mail_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
     	//char *rec_name = RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[1]);
     	int i;
    @@ -16155,6 +16174,7 @@ void clif_parse_Mail_return(int fd, struct map_session_data *sd){
     /// 0247 <index>.W <amount>.L (CZ_MAIL_ADD_ITEM)
     /// 0a04 <index>.W <amount>.W (CZ_REQ_ADD_ITEM_TO_MAIL)
     void clif_parse_Mail_setattach(int fd, struct map_session_data *sd){
    +	return;
     	struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
     	uint16 idx = RFIFOW(fd,info->pos[0]);
     #if PACKETVER < 20150513
    @@ -16184,6 +16204,7 @@ void clif_parse_Mail_setattach(int fd, struct map_session_data *sd){
     /// Remove an item from a mail
     /// 0a07 <result>.B <index>.W <amount>.W <weight>.W
     void clif_mail_removeitem( struct map_session_data* sd, bool success, int index, int amount ){
    +	return;
     	PACKET_ZC_ACK_REMOVE_ITEM_MAIL p = { 0 };
     
     	p.PacketType = rodexremoveitem;
    @@ -16213,6 +16234,7 @@ void clif_mail_removeitem( struct map_session_data* sd, bool success, int index,
     /// 0a06 <index>.W <amount>.W (CZ_REQ_REMOVE_ITEM_MAIL)
     void clif_parse_Mail_winopen(int fd, struct map_session_data *sd)
     {
    +	return;
     #if PACKETVER < 20150513
     	int type = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]);
     
    @@ -16233,6 +16255,7 @@ void clif_parse_Mail_winopen(int fd, struct map_session_data *sd)
     /// 09ec <packet len>.W <recipient>.24B <sender>.24B <zeny>.Q <title length>.W <body length>.W <title>.?B <body>.?B (CZ_REQ_WRITE_MAIL)
     /// 0a6e <packet len>.W <recipient>.24B <sender>.24B <zeny>.Q <title length>.W <body length>.W <char id>.L <title>.?B <body>.?B (CZ_REQ_WRITE_MAIL2)
     void clif_parse_Mail_send(int fd, struct map_session_data *sd){
    +	return;
     #if PACKETVER < 20150513
     	struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
     

     

    • Love 2
    • MVP 1
  13. I love people who learns /lv gets a thumbs up from me
    ok from my understanding, you want the way that GMs can choose which 2 party to fight each other

    https://github.com/AnnieRuru/Release/blob/master/scripts/Battlegrounds/PartyVsParty/PartyVsParty_0.1r.txt

    PS: ... I wish this is hercules and I can use OnPCUseSkillEvent to have a cursor to select the player instead of typing out the player name

    I think your next reply might want to ask about how to set the party at a fix size ... ?

    • Love 1
  14. can only be done with source edits

     src/map/mob.cpp  |  9 +++++++++
     src/map/mob.hpp  |  1 +
     src/map/unit.cpp | 11 +++++++++++
     3 files changed, 21 insertions(+)
    
    diff --git a/src/map/mob.cpp b/src/map/mob.cpp
    index 3e0b54f37..686c30ac1 100644
    --- a/src/map/mob.cpp
    +++ b/src/map/mob.cpp
    @@ -708,6 +708,15 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const
     			//"I understand the "Aggressive" part, but the "Can Move" and "Can Attack" is just stupid" - Poki#3
     			sc_start4(NULL,&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE|MD_CANATTACK|MD_CANMOVE|MD_ANGRY, 0, 60000);
     	}
    +	
    +	if (md != NULL) {
    +		if (mob_id < 0) {
    +			md->special_state.deadbranch = 1;
    +			md->deletetimer = add_timer(gettick()+5000,mob_timer_delete,md->bl.id,0);
    +		}
    +		else
    +			md->special_state.deadbranch = 0;
    +	}
     
     	return (md) ? md->bl.id : 0; // id of last spawned mob
     }
    diff --git a/src/map/mob.hpp b/src/map/mob.hpp
    index 5b47b8c6f..37921599c 100644
    --- a/src/map/mob.hpp
    +++ b/src/map/mob.hpp
    @@ -189,6 +189,7 @@ struct mob_data {
     		unsigned int size : 2; //Small/Big monsters.
     		enum mob_ai ai; //Special ai for summoned monsters.
     		unsigned int clone : 1;/* is clone? 1:0 */
    +		unsigned int deadbranch : 1; /* summon from branch */
     	} special_state; //Special mob information that does not needs to be zero'ed on mob respawn.
     	struct s_MobState {
     		unsigned int aggressive : 1; //Signals whether the mob AI is in aggressive mode or reactive mode. [Skotlex]
    diff --git a/src/map/unit.cpp b/src/map/unit.cpp
    index 15632f201..b42668a1d 100644
    --- a/src/map/unit.cpp
    +++ b/src/map/unit.cpp
    @@ -2420,6 +2420,17 @@ int unit_attack(struct block_list *src,int target_id,int continuous)
     	if(ud->attacktimer != INVALID_TIMER)
     		return 0;
     
    +	if (target_id != 0) {
    +		struct block_list *target_bl = map_id2bl(target_id);
    +		if (target_bl->type == BL_MOB) {
    +			struct mob_data *md = map_id2md(target_id);
    +			if (md->special_state.deadbranch == 1 && md->deletetimer != INVALID_TIMER) {
    +				delete_timer(md->deletetimer, mob_timer_delete);
    +				md->deletetimer = add_timer(gettick() + 5000, mob_timer_delete, md->bl.id, 0);
    +			}
    +		}
    +	}
    +
     	// New action request received, delete previous action request if not executed yet
     	if(ud->stepaction || ud->steptimer != INVALID_TIMER)
     		unit_stop_stepaction(src);

    I tested with 5000 = 5 seconds, change them into 60000

    • Upvote 2
  15. can only be done with source edit

    let's see pc.cpp ...

    void pc_reg_received(struct map_session_data *sd)
    {
      ...
    	// pet
    	if (sd->status.pet_id > 0)
    		intif_request_petdata(sd->status.account_id, sd->status.char_id, sd->status.pet_id);

    hmm ... much harder than I thought, not only needs to modify pc.c, but because the pet database are saved in char-server, also needs to *hack* the char-server related files to trick that players has a pet from nothingness

     

    how about the other way round, start from char-server, after create a new character, auto-add a pet immediately

     src/char/char.cpp | 5 +++++
     1 file changed, 5 insertions(+)
    
    diff --git a/src/char/char.cpp b/src/char/char.cpp
    index 2fc2f854b..578c79131 100644
    --- a/src/char/char.cpp
    +++ b/src/char/char.cpp
    @@ -1495,6 +1495,11 @@ int char_make_new_char( struct char_session_data* sd, char* name_, int str, int
     	}
     
     	ShowInfo("Created char: account: %d, char: %d, slot: %d, name: %s\n", sd->account_id, char_id, slot, name);
    +	
    +	if ( Sql_Query( sql_handle, "insert into pet values (null, 1002, 'Poring', %d, %d, 1, 9001, 0, 250, 100, 0,0,0)", sd->account_id, char_id ) == SQL_ERROR )
    +		Sql_ShowDebug( sql_handle );
    +	if ( Sql_Query( sql_handle, "update `char` set pet_id = (select max(pet_id) from pet) where char_id = %d", char_id ) == SQL_ERROR )
    +		Sql_ShowDebug( sql_handle );
     	return char_id;
     }
     

    yeah, this patch working perfectly on rathena

  16. On 9/20/2020 at 8:33 PM, Psyche said:

    Heres the script. The purpose is give 4 equipment (Armor, Shield, Garments, and Shoes) to player with random refine +0 ~ +7 and random enchanted stone/orb.

    
    function	script	Test	{
    	setarray .Ref[0],0,1,2,3,4,5,6,7;
    	setarray .Orb[0],4700,4701,4702;
    	setarray .Armors[0],2301,2303,2305;
    	setarray .Shields[0],2101,2103;
    	setarray .Garments[0],2512,2501,2503,2505;
    	setarray .Shoes[0],2416,2401,2403,2405,2411;
    	
    	set .Rand1, rand( getarraysize(.Ref) );
    	set .Rand2, rand( getarraysize(.Orb) );
    	
    	set .RandA, rand( getarraysize(.Armors) );
    	set .RandB, rand( getarraysize(.Shields) );
    	set .RandC, rand( getarraysize(.Garments) );
    	set .RandD, rand( getarraysize(.Shoes) );
    	
    	getitembound2 .Armors[.RandA], 1, 1, .Ref[.Rand1], 0, 0, 0, 0, .Orb[.Rand2], 1;
    	getitembound2 .Shields[.RandB], 1, 1, .Ref[.Rand1], 0, 0, 0, 0, .Orb[.Rand2], 1;
    	getitembound2 .Garments[.RandC], 1, 1, .Ref[.Rand1], 0, 0, 0, 0, .Orb[.Rand2], 1;
    	getitembound2 .Shoes[.RandD], 1, 1, .Ref[.Rand1], 0, 0, 0, 0, .Orb[.Rand2], 1;
    
    	end;
    }

     

    prontera,155,185,5	script	jhfkjsdf	1_F_MARIA,{
    	getitembound2 F_Rand(2301,2303,2305), 1,1, rand(0,7), 0, 0,0,0, callsub(L_orbs), BOUND_ACCOUNT;
    	getitembound2 F_Rand(2101,2103), 1,1, rand(0,7), 0, 0,0,0, callsub(L_orbs), BOUND_ACCOUNT;
    	getitembound2 F_Rand(2512,2501,2503,2505), 1,1, rand(0,7), 0, 0,0,0, callsub(L_orbs), BOUND_ACCOUNT;
    	getitembound2 F_Rand(2416,2401,2403,2405,2411), 1,1, rand(0,7), 0, 0,0,0, callsub(L_orbs), BOUND_ACCOUNT;
    	end;
    L_orbs:
    	return F_Rand(4700,4701,4702);
    }

     

  17. then shouldn't use time limit, just set another npc variable for it

    prontera,150,185,0	script	test override	1_F_MARIA,{
    	.@difficulty = 3; // official script only has 3 digits ... sux ... maximum is 9 btw
    	if ( .start == 0 ) {
    		if ( getgmlevel() != 99 ) {
    			dispbottom "only GM can activate this event.";
    			end;
    		}
    		F_ShuffleNumbers 1, 9, .@r, .@difficulty;
    		for ( .@i = 0; .@i < .@difficulty; ++.@i )
    			.guess += .@r[.@i] * (10 ** .@i); // change 10**.@i into pow(10,.@i) for rathena
    		dispbottom "input this number -> "+ .guess;
    		.start = 1;
    		end;
    	}
    	else if ( .start == 1 ) {
    		input .@num;
    		if ( .start != 1 ) { // <--- THIS is what you need
    			dispbottom "the guessing time has over";
    			end;
    		}
    		if ( .@num != .guess ) {
    			// Let's do some MATH !!
    			if ( .@num < 10 ** (.@difficulty -1) || .@num >= 10 ** .@difficulty ) {
    				dispbottom "Number input requirement has not been fulfilled. Please enter a "+ .@difficulty +" digit number.";
    				end;
    			}
    			for ( .@i = 0; .@i < .@difficulty; ++.@i )
    				.@n[.@i] = .@num / ( 10**.@i ) % 10;
    			for ( .@i = 0; .@i < .@difficulty; ++.@i ) {
    				if ( .@n[.@i] == 0 ) {
    					dispbottom "Violation of number input parameter. Number 0 has been input.";
    					end;
    				}
    				if ( countstr( .@num +"", .@n[.@i] +"" ) > 1 ) {
    					dispbottom "Violation of number input parameter. Number has been input more than once.";
    					end;
    				}
    			}
    			for ( .@i = 0; .@i < .@difficulty; ++.@i ) {
    				if ( compare( .guess +"", .@n[.@i] +"" ) )
    					++.@has_number;
    				if ( charat( .@num +"", .@i ) == charat( .guess +"", .@i ) )
    					++.@correct_pos;
    			}
    			dispbottom "Your guess has "+ .@has_number +" digit of number that is on the answer, and "+ .@correct_pos +" digit having same position with the answer.";
    			end;
    		}
    		npctalk strcharinfo(0) +" has guess correctly";
    		getitem Apple, 1;
    		.start = .guess = 0;
    		end;
    	}
    }

     

    • Love 1
×
×
  • Create New...