Jump to content
  • 0

delitem & countitem for whole party?


HristDead

Question


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.01
  • Content Count:  167
  • Reputation:   2
  • Joined:  08/01/12
  • Last Seen:  

Hi rA

I was wondering how to apply the countitem and delitem commands on every partymember instead of 1 player only?

example: Party exists out of 3 players, all players need to have 1 piece of TGC item (for example) ID 7227.

This part of the script is based on 1 player as you can see. Anyone can help me change it..?


menu "We have all the TCG!.",-,"Don't have enough yet.",MoreTime;
next;
if((countitem(7227) < 1) goto L_NotEnough;
mes "[TCG Person]";
mes "I will now take 1 TCG of each party member";
delitem 7227,1;
mes "Thank you";
close;

Thank you kindly!!

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1132
  • Joined:  05/27/12
  • Last Seen:  

https://rathena.svn.sourceforge.net/svnroot/rathena/trunk/doc/script_commands.txt

getpartymember, then loop through the array with attachrid.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

I was thinking that some general commande like :

foreach,map,cmd*,args*;

could be usefull to generate easy code.

(Well we already have them in C src but they ain't disponible for npc wich often create duplicate code like disguise; disguiseparty etc..)

All that change it's either to add a iterator or not and what to parse it with.

In other side something like this with probably be harder to validate for code review. (I mean like when server parsing npcs)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.01
  • Content Count:  167
  • Reputation:   2
  • Joined:  08/01/12
  • Last Seen:  

I got this so far, but it gives me a 'player not attached' message


- script Sealdrdetrsxglif -1,{

OnMobKilled:
announce "Shrine: trial passed.",bc_self;
sleep2 2000;
getpartymember getcharid(1),2;
for(set .@i,0; .@i<$@partymembercount; set .@i,.@i+1)
{attachrid $@partymemberaid[.@i];
getitem 7227,1; //Replace .itemid with actual itemid.
set @id,getcharid(1);
warpparty "prontera",100,100,@id;
end;
detachrid;
}
}

The item is being given though, but i dont get warped out... :(

Edited by HristDead
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10018
  • Reputation:   2370
  • Joined:  10/28/11
  • Last Seen:  

you can do it like this...

http://pastebin.com/raw.php?i=RevtQREG

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.01
  • Content Count:  167
  • Reputation:   2
  • Joined:  08/01/12
  • Last Seen:  

Thanks emistry i got it working. btw Do you know why it doesnt do a party warp in this?: http://rathena.org/board/topic/71617-delitem-countitem-for-whole-party/#entry141470

theres no error. T_T

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10018
  • Reputation:   2370
  • Joined:  10/28/11
  • Last Seen:  

you dont have monster to trigger the script ???

monster ............................"Sealdrdetrsxglif::OnMobKilled:";

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.01
  • Content Count:  167
  • Reputation:   2
  • Joined:  08/01/12
  • Last Seen:  

Fix thanks!

Edited by HristDead
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...