Feefty Posted November 12, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Share Posted November 12, 2012 what is the best way to use this? because sometimes it stop working. i also added sleep2 500; before the actual script run. buildin_rid2name: invalid RID Quote Link to comment Share on other sites More sharing options...
goddameit Posted November 12, 2012 Group: Members Topic Count: 60 Topics Per Day: 0.01 Content Count: 562 Reputation: 219 Joined: 11/22/11 Last Seen: August 3, 2024 Share Posted November 12, 2012 (edited) maybe you should tell us your ''sometimes'' or we can't help you easily. Edited November 13, 2012 by goddameit Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 12, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 12, 2012 rid2name(killerrid); rid2name(killedrid); As for the actual label... I can't remember if either killerrid or killedrid is attached to the script right away. But that would only help determine if your use of sleep2 was correct. As for your script not working, can't help you there if you don't show us the script.. After all, we're not mind readers. Quote Link to comment Share on other sites More sharing options...
Ryokem Posted November 12, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted November 12, 2012 (edited) I can't remember if either killerrid or killedrid is attached to the script right away. But that would only help determine if your use of sleep2 was correct. As for your script not working, can't help you there if you don't show us the script.. After all, we're not mind readers. killedrid --> variable set upon killing someone (when "OnPCKillEvent" triggers). killerrid --> variable set upon dying (when "OnPCDieEvent" triggers). Edited November 12, 2012 by Ryokem Quote Link to comment Share on other sites More sharing options...
Feefty Posted November 12, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Author Share Posted November 12, 2012 (edited) OnPCDieEvent also stopped working. its working fine when its not crowded in the pvp room and sometimes its not working for some players and sometimes it works. its kinda messy. here's my script OnPCDieEvent: sleep2 100; getmapxy(@map$,@x,@y,0); for (set .@j,0; .@j<getarraysize(.RiftMaps$); set .@j,.@j+1) { if (@map$ == .RiftMaps$[.@j] && getcharid(2) != getcharid(2, rid2name(killerrid))) { if (BaseLevel >= 99) { if (@map$ == "guild_vs1") { query_sql("UPDATE `char` SET `deaths` = deaths + 1 WHERE `char_id` = "+getcharid(0)); } query_sql("SELECT `riftpoints` FROM `char` WHERE `char_id` = "+getcharid(0), @riftpoints); // get killed rank set @killedRank, getRank_(@riftpoints); if (compare(@map$, "g_cas")) { set @lost, .RiftPointsLost[@killedRank]*2; } else { set @lost, .RiftPointsLost[@killedRank]; } if (@riftpoints >= @lost) { set @minus, @riftpoints-@lost; } else { set @minus, 0; } // update rift points query_sql("UPDATE `char` SET `riftpoints` = "+@minus+", `riftpoints_last_timestamp` = NOW() WHERE `char_id` = "+getcharid(0)); query_sql("SELECT `riftpoints` FROM `char` WHERE `char_id` = "+getcharid(0), @newRiftPoints); } // announce the killing announce strcharinfo(0)+" "+.RiftRank$[getRank(getcharid(0))]+" was killed by "+rid2name(killerrid)+"'s attack.",bc_area; dispbottom("You have died."); if (BaseLevel >= 99) { dispbottom("Total Rift Points: "+ Cm(@newRiftPoints)); if (@map$ == "guild_vs1") { dispbottom("Kills: "+getRecord("kills", getcharid(0))+" Deaths: "+getRecord("deaths", getcharid(0))); } if (getRank_(@riftpoints) > getRank_(@newRiftPoints)) { dispbottom("You have been demoted to "+ .RiftRank$[getRank_(@newRiftPoints)]); } } } } end; OnPCKillEvent: sleep2 500; getmapxy(@map$,@x,@y,0); for (set .@j,0; .@j<getarraysize(.RiftMaps$); set .@j,.@j+1) { if (@map$ == .RiftMaps$[.@j] && getcharid(2) != getcharid(2, rid2name(killedrid))) { if (@map$ == "guild_vs1") { query_sql("UPDATE `char` SET `kills` = kills + 1 WHERE `char_id` = "+getcharid(0)); } // if player below level 99 if (BaseLevel < 99) { dispbottom("You must be level 99 or higher to start gaining Rift Points."); break; } query_sql("SELECT `riftpoints` FROM `char` WHERE `char_id` = "+getcharid(0, rid2name(killedrid)), @riftpoints); // get my current rift points query_sql("SELECT `riftpoints` FROM `char` WHERE `char_id` = "+getcharid(0), @currentRiftPoints); // get killed rank set @killedRank, getRank_(@riftpoints); set @gain, .RiftPointsGain[@killedRank]; if (getgroupid() == 1) { set @gain, (@gain+((@gain*30)/100)); } if (KillPlayer$ == rid2name(killedrid)) { set @gain, (@gain-((@gain*70)/100)); } if (compare(@map$, "g_cas")) { set @gain, @gain*2; } set KillPlayer$, rid2name(killedrid); // update rift points query_sql("UPDATE `char` SET `riftpoints` = riftpoints + "+@gain+", `riftpoints_last_timestamp` = NOW() WHERE `char_id` = "+getcharid(0)); // get my new rift points query_sql("SELECT `riftpoints` FROM `char` WHERE `char_id` = "+getcharid(0), @newRiftPoints); // display messages dispbottom("You have gained "+Cm(@gain)+" Rift Points."); dispbottom("You have defeated "+rid2name(killedrid)+" "+.RiftRank$[getRank(getcharid(0, rid2name(killedrid)))]+"."); dispbottom("Total Rift Points: "+ Cm(@newRiftPoints)); if (@map$ == "guild_vs1") { dispbottom("Kills: "+getRecord("kills", getcharid(0))+" Deaths: "+getRecord("deaths", getcharid(0))); } if (getRank_(@currentRiftPoints) < getRank_(@newRiftPoints)) { dispbottom("You have been promoted to "+ .RiftRank$[getRank_(@newRiftPoints)]); if (getRank_(@newRiftPoints) >= 9) { announce strcharinfo(0)+" has been promoted to "+.RiftRank$[getRank_(@newRiftPoints)], b_all; } } sleep2 60000; set KillPlayer$, ""; break; } } end; Edited November 13, 2012 by Arcenciel Codeboxed Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 12, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 12, 2012 My only guess is that perhaps the OnPCKillEvent & OnPCDieEvent work the same as the variables in getpartymember. In other words, the label runs each instance one by one. If this is the case, then your sleep, command is basically telling the script instance behind it to do its thing. Thus screwing up information and whatnot. But this is only just speculation, but for debugging sake, remove your sleep2 commands and see if you still have a problem. Quote Link to comment Share on other sites More sharing options...
Feefty Posted November 12, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Author Share Posted November 12, 2012 My only guess is that perhaps the OnPCKillEvent & OnPCDieEvent work the same as the variables in getpartymember. In other words, the label runs each instance one by one. If this is the case, then your sleep, command is basically telling the script instance behind it to do its thing. Thus screwing up information and whatnot. But this is only just speculation, but for debugging sake, remove your sleep2 commands and see if you still have a problem. i did have the problem before the sleep2 that's why i did add them there and it still didn't work. i might just rewrite it because this is my first script. Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 12, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 12, 2012 Well, what is this, ' getRank_() ' command i keep seeing you use? I'm fairly certain that's not part of rA's svn, so is it a custom command or is that supposed to be a variable array. In which case your syntax is wrong, and it should look like this: ' getRank_[ ] ' but that's assuming it is indeed a variable array, and not a custom command. Quote Link to comment Share on other sites More sharing options...
Feefty Posted November 12, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Author Share Posted November 12, 2012 Well, what is this, ' getRank_() ' command i keep seeing you use? I'm fairly certain that's not part of rA's svn, so is it a custom command or is that supposed to be a variable array. In which case your syntax is wrong, and it should look like this: ' getRank_[ ] ' but that's assuming it is indeed a variable array, and not a custom command. it's a custom function. Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 12, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 12, 2012 Okay then, let's assume the function is working properly. That being said, your variable .RaiftMap$[ ] and .RiftRank[ ], those ARE apart of the same NPC right? Becuase .variables are npc specific unless you use the command ' getvariableofnpc '. And if that's not the issue here, do you have any errors on your map-serv? But, all in all, i can't do a 100% check of this script since i'm using my phone, and well, i don't really have an RO emulator on here lol. Quote Link to comment Share on other sites More sharing options...
Feefty Posted November 12, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Author Share Posted November 12, 2012 (edited) Okay then, let's assume the function is working properly. That being said, your variable .RaiftMap$[ ] and .RiftRank[ ], those ARE apart of the same NPC right? Becuase .variables are npc specific unless you use the command ' getvariableofnpc '. And if that's not the issue here, do you have any errors on your map-serv? But, all in all, i can't do a 100% check of this script since i'm using my phone, and well, i don't really have an RO emulator on here lol. when i run the server there's no errors. it only happens when the random killing and dying starts Edited November 12, 2012 by Feefty Quote Link to comment Share on other sites More sharing options...
Variant Posted November 12, 2012 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 52 Reputation: 6 Joined: 01/06/12 Last Seen: December 12, 2017 Share Posted November 12, 2012 Well, GMOcean is right, you should remove the sleep regardless. If the killer kills multiple people within that .5 s limit, then that already messes things up. If players log out immediately after dying too, before the sleep finishes, it'd mess up also. In other words, it'll cause you more grief to debug with those in there. Try having a debugmes(killerrid); and debugmes(killedrid); in PCDieEvent and PCKillEvent respectively, right as the event starts (where sleep2 is). You'll get some string/integer conversion warnings, you can just ignore them. Your console would show something like: [Debug] 12345678 [Debug] 12323123 Whenever someone died. And you should be able to monitor what's going on with the RID that way. It might also help to comment your script so you can easily understand your logic if you come back to read it later, might also help you find the issue. Quote Link to comment Share on other sites More sharing options...
Feefty Posted November 12, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Author Share Posted November 12, 2012 Well, GMOcean is right, you should remove the sleep regardless. If the killer kills multiple people within that .5 s limit, then that already messes things up. If players log out immediately after dying too, before the sleep finishes, it'd mess up also. In other words, it'll cause you more grief to debug with those in there. Try having a debugmes(killerrid); and debugmes(killedrid); in PCDieEvent and PCKillEvent respectively, right as the event starts (where sleep2 is). You'll get some string/integer conversion warnings, you can just ignore them. Your console would show something like: [Debug] 12345678 [Debug] 12323123 Whenever someone died. And you should be able to monitor what's going on with the RID that way. It might also help to comment your script so you can easily understand your logic if you come back to read it later, might also help you find the issue. thanks, ill try that Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 12, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 12, 2012 buildin_rid2name: invalid RID comes from script.c BUILDIN_FUNC(rid2name) { struct block_list *bl = NULL; int rid = script_getnum(st,2); if((bl = map_id2bl(rid))) { ......... } else { ShowError("buildin_rid2name: invalid RID\n"); script_pushconststr(st,"(null)"); } return 0; }] how to reproduce - script lfhdsfkjs -1,{ OnPCKillEvent: sleep2 500; announce strcharinfo(0) +" killed "+ rid2name(killedrid), 0; end; } get dual client and summon 1 poring cast lord of vermillion kill both of them ... player and poring at once and you get that error if somehow the poring dies a bit later than killing a player a player was set killedrid into account_id, but killing a mob is set killedrid into mob_id, thus you get this bug so means you have to remove your sleep2 ... but seriously ... I'm more interested to know how can your server can get event_queue_full ... unless you are not using rathena ? Quote Link to comment Share on other sites More sharing options...
Ryokem Posted November 12, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted November 12, 2012 but seriously ... I'm more interested to know how can your server can get event_queue_full ...unless you are not using rathena ? That's why after each OnPCKillEvent label, there should be immediately a condition to end the script if not killing the right object. Or rather... abusing of infinite loops or sql queries haha! xD Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 13, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 13, 2012 (edited) Well, all in all, there is no need for OnPCDieEvent, since in an OnPCKillEvent, both killerrid & killedrid are both character IDs (That is before you activate a sleep command, and let another instance run thus changing the id). So leave it as it may, you can simply just use attachrid(killerrid) & attachrid(killedrid) to do each labels task respectively. Edit: Btw, are the killerrid & killedrid labels still backwards as ever? e.g: killedrid = killer | killerrid = killed Atleast i know in eAthena that was the case, not sure if it still is here. In which case I say, change around lol, because if it is the way it was in the past it's so confusing @.@; Edited November 13, 2012 by GmOcean Quote Link to comment Share on other sites More sharing options...
Variant Posted November 13, 2012 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 52 Reputation: 6 Joined: 01/06/12 Last Seen: December 12, 2017 Share Posted November 13, 2012 (edited) but seriously ... I'm more interested to know how can your server can get event_queue_full ... unless you are not using rathena ? I was always under the assumption that calling several different event queues in different scripts lead to the queue being full. For example, if you have several scripts that trigger when a player dies, then each event, even though they're all PCDieEvents, get added to the queue separately. Did rAthena change that recently? Edit: Btw, are the killerrid & killedrid labels still backwards as ever? e.g: killedrid = killer | killerrid = killed Atleast i know in eAthena that was the case, not sure if it still is here. In which case I say, change around lol, because if it is the way it was in the past it's so confusing @.@; killerrid = Person who killed the player, killedrid = Person who the player just killed, last I made a script that used them. Relatively recently. Yeah, it would be more efficient to trigger only a single event and attachrid to swap between the two. You could also avoid the issue of killing multiple people at once and only being credited for a single kill while using sleep2 if you used OnPCDieEvent. Edited November 13, 2012 by Variant Quote Link to comment Share on other sites More sharing options...
Feefty Posted November 13, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Author Share Posted November 13, 2012 Well, all in all, there is no need for OnPCDieEvent, since in an OnPCKillEvent, both killerrid & killedrid are both character IDs (That is before you activate a sleep command, and let another instance run thus changing the id). So leave it as it may, you can simply just use attachrid(killerrid) & attachrid(killedrid) to do each labels task respectively. Edit: Btw, are the killerrid & killedrid labels still backwards as ever? e.g: killedrid = killer | killerrid = killed Atleast i know in eAthena that was the case, not sure if it still is here. In which case I say, change around lol, because if it is the way it was in the past it's so confusing @.@; i thought attachrid can only attach the account id? *attachrid(<account ID>) or it does attach the char id of the current online char in that account id? Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 13, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 13, 2012 It attaches the accountID, however the player currently logged in is the one affected. Besides, killerrid & killedrid = acct_ids Quote Link to comment Share on other sites More sharing options...
Feefty Posted November 13, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Author Share Posted November 13, 2012 It attaches the accountID, however the player currently logged in is the one affected. Besides, killerrid & killedrid = acct_ids i didn't know that. Thanks! Quote Link to comment Share on other sites More sharing options...
Question
Feefty
what is the best way to use this?
because sometimes it stop working.
i also added sleep2 500; before the actual script run.
buildin_rid2name: invalid RID
Link to comment
Share on other sites
19 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.