Jump to content
  • 0

Party-based script


Aisha

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   2
  • Joined:  06/27/17
  • Last Seen:  

I know a little about rA coding and etc, and i want to learn more.

Can someone show me how to record each party member's respective class ID, into maybe an array? Or anything as long as you can access it again later in the script.

Thank you, and this will server as my base for my script, you can make the example as simple as you can, no need to elaborate, i just need to know how you initiate the checking and saving of the class IDs thanks

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

All you really need is the aid...

 

// don't know if party array clears so I clear it anyways

deletearray($@partymemberaid[0], getarraysize($@partymemberaid));

getpartymember(getchardid(1), 2); 

// type 2 gives u aid...

// Immediately copy this array because it's global and can be overwritten

copyarray( .@newarray, $@partymemberaid[0], getarraysize($@partymemberaid));

// you don't need $@party member count because getarraysize(.@newarray) will be the same value...

// u can attach script to each member looping from 0 to size of newarray

// attachrid( .@newarray[.@index] );

 

Once the script is attached to each player, you can use Class just as you would if they were talking g to the npc...

Then store that info into an array

set( .classes[getarraysize(.classes)], Class);

*** note sorry this isn't in code box... I couldn't find the option via mobile browsing ***

Edited by Z3R0
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   2
  • Joined:  06/27/17
  • Last Seen:  

On the last portion, that is the first time I am seeing set being used like that. I will have to read up on it. Though if you can explain what it is doing, would appreciate it.

Because from what I can understand, it is counting its own array size, but I am not sure as to where the array itself is initialized, or is that the part where info is being added? Sorry, a bit confused by your example.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

9 hours ago, Aisha said:

On the last portion, that is the first time I am seeing set being used like that. I will have to read up on it. Though if you can explain what it is doing, would appreciate it.

Because from what I can understand, it is counting its own array size, but I am not sure as to where the array itself is initialized, or is that the part where info is being added? Sorry, a bit confused by your example.

 

sure :D it's a way to set an array with an unknown array size... 

when any variable doesn't exist it's value is 0... so getarraysize(.@notset) == 0.... on first iteration...

after you set something to it it's array size becomes 1... then 2... then 3... and thus making the array .@notset[0], .@notset[1] .@notset[2] because 

getarraysize() gives you the TOTAL number of items in teh array... and since arrays start at 0, and when it's first used it doesn't have a size, it creates a proper array...

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   2
  • Joined:  06/27/17
  • Last Seen:  

Thanks! I understand how it works now. I will try to see if I can make the NPC work, if not, might post progress here and ask for assistance.

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