nakano15 Posted September 23, 2015 Group: Members Topic Count: 19 Topics Per Day: 0.01 Content Count: 102 Reputation: 8 Joined: 01/26/15 Last Seen: April 30, 2021 Share Posted September 23, 2015 Hey guys, I am back and with a new problem I've been having while scripting npcs on Ragnarok Online. This time, is with addrid. I am trying to make an script where events may randomly happen in a map and the player can gain something good depending on how much contribution gave to the event achievement. The problem is on the part of getting the list of players in the map, it basically does nothing. When the script is invoked by a player, it works fine, but when the npc invokes the script, it basically does nothing. deletearray(.players[0], 128); if(addrid(1, 0) == 1) { set(.players[getarraysize(.players)], getnpcid(0)); .@ArrayMaxSize = getarraysize(.players); if(.@ArrayMaxSize > 0) { for(.@i = 0; .@i < .@ArrayMaxSize; .@i++) { .@CharName$ = rid2name(.players[.@i]); detachrid; attachrid(.@CharName$); -- Rest of the script -- } detachrid; } } How can I fix this issue? This issue is bothering me have 3 days. Quote Link to comment Share on other sites More sharing options...
Moriarty Posted September 23, 2015 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 135 Reputation: 13 Joined: 06/20/12 Last Seen: April 14, 2018 Share Posted September 23, 2015 *attachrid(<account ID>) *detachrid; These commands allow the manipulation of the script's currently attached player. While 'attachrid' allows attaching of a different player by using its account id for the parameter RID, 'detachrid' makes the following commands run as if the script was never invoked by a player. The command returns 0 if the player cannot be attached (if the account is offline or does not exist), and 1 upon success. Maybe because you are using the wrong argument?And, addrid is somewhat confusing for me, in your place I would do a query_sql where char `last_map` = x, using SQL function RANDOM to randomize the result. Quote Link to comment Share on other sites More sharing options...
nakano15 Posted September 23, 2015 Group: Members Topic Count: 19 Topics Per Day: 0.01 Content Count: 102 Reputation: 8 Joined: 01/26/15 Last Seen: April 30, 2021 Author Share Posted September 23, 2015 *attachrid(<account ID>) *detachrid; These commands allow the manipulation of the script's currently attached player. While 'attachrid' allows attaching of a different player by using its account id for the parameter RID, 'detachrid' makes the following commands run as if the script was never invoked by a player. The command returns 0 if the player cannot be attached (if the account is offline or does not exist), and 1 upon success. Maybe because you are using the wrong argument? And, addrid is somewhat confusing for me, in your place I would do a query_sql where char `last_map` = x, using SQL function RANDOM to randomize the result. Eh, but I does not know how to use sql. And addrid is surelly confusing. Quote Link to comment Share on other sites More sharing options...
Moriarty Posted September 23, 2015 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 135 Reputation: 13 Joined: 06/20/12 Last Seen: April 14, 2018 Share Posted September 23, 2015 It's not hard to learn.Anyway, I already told you your problem with attachrid, use account id, not char name. Quote Link to comment Share on other sites More sharing options...
nakano15 Posted September 24, 2015 Group: Members Topic Count: 19 Topics Per Day: 0.01 Content Count: 102 Reputation: 8 Joined: 01/26/15 Last Seen: April 30, 2021 Author Share Posted September 24, 2015 Well... After getting angry at Addrid, I tried to do what you suggested, use SQL command by rummaging and googling codes. It worked, now my script works as it must. I even made a code file with functions using them so I does not need to rewrite them all the time, maybe later I'll release the file on this forum. Either way, thanks for the help. Quote Link to comment Share on other sites More sharing options...
Question
nakano15
Hey guys, I am back and with a new problem I've been having while scripting npcs on Ragnarok Online.
This time, is with addrid.
I am trying to make an script where events may randomly happen in a map and the player can gain something good depending on
how much contribution gave to the event achievement.
The problem is on the part of getting the list of players in the map, it basically does nothing.
When the script is invoked by a player, it works fine, but when the npc invokes the script, it basically does nothing.
How can I fix this issue? This issue is bothering me have 3 days.
Link to comment
Share on other sites
4 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.