Jump to content
  • 0

Addrid is trolling me


nakano15

Question


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   8
  • Joined:  01/26/15
  • Last Seen:  

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.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   13
  • Joined:  06/20/12
  • Last Seen:  

 
*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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   8
  • Joined:  01/26/15
  • Last Seen:  

 

 
*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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   13
  • Joined:  06/20/12
  • Last Seen:  

It's not hard to learn.

Anyway, I already told you your problem with attachrid, use account id, not char name.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   8
  • Joined:  01/26/15
  • Last Seen:  

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...