CaioVictor Posted August 9, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 75 Reputation: 0 Joined: 05/26/12 Last Seen: November 27, 2013 Share Posted August 9, 2013 Hi rAthena ^^' First excuse my English.I want to know if there is some way of convering the monsters GID returned by killerrid in monster ID. I searched a lot but did not find anything to do that or something that would help me. I appreciate any help intention. Att, CaioVictor Quote Link to comment Share on other sites More sharing options...
Skorm Posted August 9, 2013 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted August 9, 2013 (edited) I don't think there is a way to convert Game ID to Mob ID... I have a topic that is similar to this... http://rathena.org/board/topic/84921-checkgid-attachgid/#entry215402 I could imagine a command like... getgidinfo(<gid>,<type>{,<object>}) etc... etc For something indirect you could use bg_monster with an event label. Then when the mob dies you could use OnEvent to return it's killerrid? If you wanted the monsters rid you would have to use OnNPCKillEvent with some condition exclusive to that monster and again being able to get the GID of a monster is a REALLY great way to single them out from all others... but currently we cannot do that. I had a request to fill killedrid on custom event activation but I don't know if they ever added it. They were going to add a new getmapxy that would allow the return of GID but I don't know if that has happened yet either. Anyways I hope this helps. Edited August 9, 2013 by Skorm Quote Link to comment Share on other sites More sharing options...
GmOcean Posted August 9, 2013 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 August 9, 2013 @CaioVictor - Hmm, isn't it already their normal ID, or is that only when it's killedrid? I'm not sure if this is the case but if it is the case, then i'm afraid that atm there isn't really a way to convert them into one another. Atleast not through normal monster spawns. If you wanted to though, you COULD do it using BGmonster command. And then saving the information along with it's normal MobID into a new array, and call the information when needed. Here's an example using somewhat advanced form of scripting to optimize. (Other wise you'd be looping for ever figuring shit out.). Saving the Information into an Array set .@GID$[0],""+ bg_monster(.gid,"<map_name>",<x>,<y>,"<mob_name>",<mob_id>,"<event_label>") +""; set .@GID[1],""+ <mob_id> +""; //Use the mob ID for the monster above. set .gid$[getarraysize(.gid$)],implode(.@GID$,"#"); end; Calling it back after player dies. OnPCDieEvent: if(killerrid == getcharid(0)){end;} for(set .@i,0; .@i< getarraysize(.gid$); set .@i,.@i+1) {if( compare(.gid$[.@i],killerrid) ) {explode(.@mobinfo$,.gid$[.@i],"#"); dispbottom "GID = "+ .@mobinfo$[0]; dispbottom "MobID = "+ .@mobinfo$[1]; end;} } Quote Link to comment Share on other sites More sharing options...
Skorm Posted August 9, 2013 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted August 9, 2013 (edited) Yeah pretty much but the example your using is weird because you're trying to set strings to integer variables and then compare killerrid... and Int to a string without using an atoi... or quotes before it to convert it to a string... A simple atoi(.gid$[.@i])==killerrid would've worked... Your example also shows you setting .@GID... why not just compare that .@GID[.@i] == killerrid. Sorry that was offtopic. prontera,100,100,1 script NPC 100,{ set(.TGT, (.MOB[.NPC]%getarraysize(.MOB))); set(.GID[getarraysize(.GID)],bg_monster(.@f,"prontera",100,100,"Poringz0rd",.TGT,"NPC::OnToughLuck")); set(.KID[getarraysize(.KID)],getcharid(0)); unitemote .GID[getarraysize(.GID)-1],e_no1; .NPC++; end; OnToughLuck: while(.@a++-1<getarraysize(.KID)) if(killerrid == .KID[.@a-1] && killedrid == .MOB[.@a-1]) { npctalk "Wow, you killed your monster!"; end; } while(.@b++-1<getarraysize(.GID)) if(!.GID[.@b-1]) { npctalk "Don't kill someone elses monster!!"; set(.GID[.@b-1],bg_monster(.@f,"prontera",100,100,"Poringz0rd",killedrid,"NPC::OnToughLuck")); end; } end; OnInit: setarray .MOB, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011; } Edited August 9, 2013 by Skorm Quote Link to comment Share on other sites More sharing options...
CaioVictor Posted August 9, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 75 Reputation: 0 Joined: 05/26/12 Last Seen: November 27, 2013 Author Share Posted August 9, 2013 Hi all ^^' I would love a command like "getgidinfo" xD Lionhardt and Skorm, your example is very good, the problem is that for my case would consume much processing =\ I will try to create a command like "getgidinfo" but the principle will do just to convert monster "GID" to "ID", then I'll try to create something more complete. This will be only way faster and consume less processing, right? Thank you all for the help! Att, CaioVictor. Quote Link to comment Share on other sites More sharing options...
GmOcean Posted August 9, 2013 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 August 9, 2013 @Skorm - Yea lol, i realized i could simply it even more by using Atoi, and make it cleaner, sometimes i over think things and don't see the reality of how easy it can be done.BUT i'm too lazy to re-write it since i gotta go out. So meh, someone else now has an idea and can now show their skills. Quote Link to comment Share on other sites More sharing options...
Skorm Posted August 9, 2013 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted August 9, 2013 Hi all ^^' I would love a command like "getgidinfo" xD Lionhardt and Skorm, your example is very good, the problem is that for my case would consume much processing =\ I will try to create a command like "getgidinfo" but the principle will do just to convert monster "GID" to "ID", then I'll try to create something more complete. This will be only way faster and consume less processing, right? Thank you all for the help! Att, CaioVictor. Yeah it really would be awesome I hope you come up with some Goodluck and more power to you... @Skorm - Yea lol, i realized i could simply it even more by using Atoi, and make it cleaner, sometimes i over think things and don't see the reality of how easy it can be done.BUT i'm too lazy to re-write it since i gotta go out. So meh, someone else now has an idea and can now show their skills. I think we all do that haha... Except for maybe Chapuche O_O;; Quote Link to comment Share on other sites More sharing options...
CaioVictor Posted August 9, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 75 Reputation: 0 Joined: 05/26/12 Last Seen: November 27, 2013 Author Share Posted August 9, 2013 (edited) Hi all ^^' Skorm, i'm trying this: BUILDIN_FUNC(mobgidtoid) { struct mob_data *md = (struct mob_data*)map_id2bl(script_getnum(st,2)); if(!md || (md->bl.type != BL_MOB)) { ShowError("buildin_mobgidtoid: Invalid monster <GID>.\n"); return -1; } script_pushint(st,(int)md->vd->class_); return 0; } It's working, but I don't know if it's 100% correct, could you check please? Att, CaioVictor. Edited August 9, 2013 by CaioVictor Quote Link to comment Share on other sites More sharing options...
Capuche Posted August 9, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted August 9, 2013 Your mod will return the class of a mob.. I don't get you request. Do you want the class (ie 1002 for poring) or the unique id (gid) of a mob ? OnNPCKillEvent return the class of a mob in killedrid. Quote Link to comment Share on other sites More sharing options...
CaioVictor Posted August 9, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 75 Reputation: 0 Joined: 05/26/12 Last Seen: November 27, 2013 Author Share Posted August 9, 2013 (edited) Hi Capuche ^^' The label "OnPCDieEvent" returns the variable "killerrid" with monster "GID", right?I need to convert this monster "GID" in monster "ID"(1002 = poring ID), due to this reason I built this command. But I don't know if it's 100% correct! Att, CaioVictor. Edited August 9, 2013 by CaioVictor Quote Link to comment Share on other sites More sharing options...
QQfoolsorellina Posted August 10, 2013 Group: Members Topic Count: 40 Topics Per Day: 0.01 Content Count: 587 Reputation: 105 Joined: 11/19/11 Last Seen: July 7, 2019 Share Posted August 10, 2013 script_pushint(st,(int)md->vd->class_); if you setting a mob to other mob SpriteID in mob_avail.txt , the code you write will return the view id not real monster id change to the below code would be better... script_pushint(st,(int)md->class_); Quote Link to comment Share on other sites More sharing options...
CaioVictor Posted August 10, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 75 Reputation: 0 Joined: 05/26/12 Last Seen: November 27, 2013 Author Share Posted August 10, 2013 Hi QQfoolsorellina ^^' Thanks for helping me.I made the change and tested, working properly, thanks! Att, CaioVictor. Quote Link to comment Share on other sites More sharing options...
Capuche Posted August 10, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted August 10, 2013 If you use sql for mob, you can use a query to retrieve the mob id by script OnPCDieEvent: if( killerrid > 3000000 ) { .@re$ = checkre(0) ? "_re" : "" ; query_sql "select `ID` from `mob_db"+ .@re$ +"` where `kName` = '"+ rid2name( killerrid ) +"'", .@mob_id; } end; it's better by source mod though Quote Link to comment Share on other sites More sharing options...
QQfoolsorellina Posted August 11, 2013 Group: Members Topic Count: 40 Topics Per Day: 0.01 Content Count: 587 Reputation: 105 Joined: 11/19/11 Last Seen: July 7, 2019 Share Posted August 11, 2013 If you use sql for mob, you can use a query to retrieve the mob id by script OnPCDieEvent: if( killerrid > 3000000 ) { .@re$ = checkre(0) ? "_re" : "" ; query_sql "select `ID` from `mob_db"+ .@re$ +"` where `kName` = '"+ rid2name( killerrid ) +"'", .@mob_id; } end; it's better by source mod though 1. killerrid > 3000000 was not mob 2. kName was not unique Quote Link to comment Share on other sites More sharing options...
Capuche Posted August 11, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted August 11, 2013 1. killerrid > 3000000 was not mob pc.c set the src id of the killer in killerrid, not the class pc_setparam(sd, SP_KILLERRID, src?src->id:0); src is a mob, the id is >= 110000000 src is a player, id >= 2000000 killerrid > 3000000 is a mob if you don't have 1000000 account id, no? 2/ I agree Quote Link to comment Share on other sites More sharing options...
CaioVictor Posted August 12, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 75 Reputation: 0 Joined: 05/26/12 Last Seen: November 27, 2013 Author Share Posted August 12, 2013 Thanks again xD I need this for a rank system that I am building. In this case, it is better to use mysql query or source mod? Since every time a character die will run this command. Att, CaioVictor. Quote Link to comment Share on other sites More sharing options...
Capuche Posted August 13, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted August 13, 2013 -it's better by source mod though Quote Link to comment Share on other sites More sharing options...
CaioVictor Posted August 14, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 75 Reputation: 0 Joined: 05/26/12 Last Seen: November 27, 2013 Author Share Posted August 14, 2013 Thanks Capuche ^^' I think it's finished now! Thank you all for the help, it was surely very important. Att, CaioVictor. Quote Link to comment Share on other sites More sharing options...
Question
CaioVictor
Hi rAthena ^^'
First excuse my English.
I want to know if there is some way of convering the monsters GID returned by killerrid in monster ID.
I searched a lot but did not find anything to do that or something that would help me.
I appreciate any help intention.
Att,
CaioVictor
Link to comment
Share on other sites
17 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.