pajodex Posted January 11, 2018 Group: Members Topic Count: 79 Topics Per Day: 0.03 Content Count: 439 Reputation: 173 Joined: 12/12/17 Last Seen: April 14 Share Posted January 11, 2018 Hi, Sorry I cant post the full script but I think the main problem is this part if(getcharid(1)) { party_delmember(); sleep 1; } party_create md5(gettimetick(2)+"A"); sleep 1; .PID[1] = getcharid(1); detachrid; attachrid .@teamA2[0]; if(getcharid(1)) { party_delmember(); sleep 1; } party_create md5(gettimetick(2)+"B"); sleep 1; .PID[2] = getcharid(1); detachrid; for(.@i = 1; .@i < .@num; .@i++) { attachrid .@teamA1[.@i]; if(getcharid(1)) { party_delmember(); sleep 1; } party_addmember .PID[1],getcharid(0); detachrid; attachrid .@teamA2[.@i]; if(getcharid(1)) { party_delmember(); sleep 1; } party_addmember .PID[2],getcharid(0); detachrid; } I'm having this error in console: [Error]: buildin_getcharid: fatal error ! player not attached! [Debug]: Function: getcharid (1 parameter): [Debug]: Data: number value=1 [Debug]: Source (NPC): MD at prontera (150,174) Quote Link to comment Share on other sites More sharing options...
1 Secrets Posted January 11, 2018 Group: Developer Topic Count: 36 Topics Per Day: 0.01 Content Count: 588 Reputation: 437 Joined: 01/26/16 Last Seen: Wednesday at 03:00 PM Share Posted January 11, 2018 Sleep detaches the player from the script. Just use sleep2 instead. Quote Link to comment Share on other sites More sharing options...
0 crazyarashi Posted January 11, 2018 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: 18 hours ago Share Posted January 11, 2018 you need to attach the party members :)) something like this .@party_id = getcharid(1); getpartymember .@party_id,1; getpartymember .@party_id,2; for( set .@i, 0; .@i < $@partymembercount; set .@i,.@i+1 ){ if(isloggedin($@partymemberaid[.@i],$@partymembercid[.@i])){ attachrid $@partymemberaid[.@i]; //your stuffs here } } Quote Link to comment Share on other sites More sharing options...
0 pajodex Posted January 11, 2018 Group: Members Topic Count: 79 Topics Per Day: 0.03 Content Count: 439 Reputation: 173 Joined: 12/12/17 Last Seen: April 14 Author Share Posted January 11, 2018 15 minutes ago, crazyarashi said: you need to attach the party members :)) something like this .@party_id = getcharid(1); getpartymember .@party_id,1; getpartymember .@party_id,2; for( set .@i, 0; .@i < $@partymembercount; set .@i,.@i+1 ){ if(isloggedin($@partymemberaid[.@i],$@partymembercid[.@i])){ attachrid $@partymemberaid[.@i]; //your stuffs here } } That "Your stuffs here" part should my recent edit go? Or the unedited one? Sorry, I kinda learn things the hard way. Quote Link to comment Share on other sites More sharing options...
0 pajodex Posted January 11, 2018 Group: Members Topic Count: 79 Topics Per Day: 0.03 Content Count: 439 Reputation: 173 Joined: 12/12/17 Last Seen: April 14 Author Share Posted January 11, 2018 6 hours ago, Secrets said: Sleep detaches the player from the script. Just use sleep2 instead. I tried using sleep2 but it gives me error in console. something like "buildin_func_sleep2 bla bla cannot attach bla bla" Quote Link to comment Share on other sites More sharing options...
0 pajodex Posted January 11, 2018 Group: Members Topic Count: 79 Topics Per Day: 0.03 Content Count: 439 Reputation: 173 Joined: 12/12/17 Last Seen: April 14 Author Share Posted January 11, 2018 (edited) This is crazy but I've messed it up quite a bit.. /hehe Here is how I did it now @party_id = getcharid(1); getpartymember .@party_id,1; getpartymember .@party_id,2; for( set .@i, 0; .@i < $@partymembercount; set .@i,.@i+1 ){ if(isloggedin($@partymemberaid[.@i],$@partymembercid[.@i])){ attachrid $@partymemberaid[.@i]; //your stuffs here if (attachrid(.@teamA1[0])) { //attachrid .@teamA1[0]; if(getcharid(1)) { party_delmember(); sleep2 1; } party_create md5(gettimetick(2)+"A"); sleep2 1; .PID[1] = getcharid(1); detachrid; } if (attachrid(.@teamA2[0])) { //attachrid .@teamA2[0]; if(getcharid(1)) { party_delmember(); sleep2 1; } party_create md5(gettimetick(2)+"B"); sleep2 1; .PID[2] = getcharid(1); detachrid; } for(.@i = 1; .@i < .@num; .@i++) { if (attachrid(.@teamA1[.@i])) { //attachrid .@teamA1[.@i]; if(getcharid(1)) { party_delmember(); sleep2 1; } party_addmember .PID[1],getcharid(0); detachrid; } if (attachrid(.@teamA2[.@i])) { //attachrid .@teamA2[.@i]; if(getcharid(1)) { party_delmember(); sleep2 1; } party_addmember .PID[2],getcharid(0); detachrid; } } end; // your stuff here } } Still getting [Error]: buildin_getcharid: fatal error ! player not attached! [Debug]: Function: getcharid (1 parameter): [Debug]: Data: number value=1 [Debug]: Source (NPC): MD at prontera (150,174) Sorry for really annoying rAthena x_x Edited January 11, 2018 by pajodex Quote Link to comment Share on other sites More sharing options...
0 Sehrentos Posted January 12, 2018 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 91 Reputation: 22 Joined: 10/24/14 Last Seen: November 1, 2024 Share Posted January 12, 2018 (edited) 16 hours ago, pajodex said: if (attachrid(.@teamA1[0])) { attachrid .@teamA1[0]; Hey, you don't need to attachrid twice it is already done in the IF statement. 16 hours ago, pajodex said: for(.@i = 1; .@i < .@num; .@i++) { if (attachrid(.@teamA1[0])) { attachrid .@teamA1[.@i]; Same here and i think it go like this? for(.@i = 1; .@i < .@num; .@i++) { if (attachrid(.@teamA1[.@i])) { // Your stuff here Note to attachrid: "The command returns 0 if the player cannot be attached (if the account is offline or does not exist), and 1 upon success." It's a good practice to do checks to avoid possible errors and help to find them. // Check party create was successful if (party_create(<party name>)) { // Success } // Check party delete member was successful if (party_delmember()) { // Success } // Check party add member was successful if (party_addmember(<party id>,<character id>)) { // Success } Edited January 12, 2018 by Sehrentos Fix typo Quote Link to comment Share on other sites More sharing options...
-1 Sehrentos Posted January 11, 2018 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 91 Reputation: 22 Joined: 10/24/14 Last Seen: November 1, 2024 Share Posted January 11, 2018 Hey, Have you tried to add in some checks like if player is offline before accessing hes RID status? 1 hour ago, pajodex said: attachrid .@teamA2[0]; if (attachrid(.@teamA2[0])) { // Success } Quote Link to comment Share on other sites More sharing options...
-1 pajodex Posted January 11, 2018 Group: Members Topic Count: 79 Topics Per Day: 0.03 Content Count: 439 Reputation: 173 Joined: 12/12/17 Last Seen: April 14 Author Share Posted January 11, 2018 Doesn't this part check if he's offline? attachrid .@teamA2[.@i]; Quote Link to comment Share on other sites More sharing options...
-1 Sehrentos Posted January 11, 2018 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 91 Reputation: 22 Joined: 10/24/14 Last Seen: November 1, 2024 Share Posted January 11, 2018 1 minute ago, pajodex said: Doesn't this part check if he's offline? No, that is the part where it tries to attach the member into your script. It can fail if you dont check if attach was successful. Quote Link to comment Share on other sites More sharing options...
-1 pajodex Posted January 11, 2018 Group: Members Topic Count: 79 Topics Per Day: 0.03 Content Count: 439 Reputation: 173 Joined: 12/12/17 Last Seen: April 14 Author Share Posted January 11, 2018 Sorry, I'm just new to this complex scripting (at least for me) but where do I put that? Quote Link to comment Share on other sites More sharing options...
-1 Sehrentos Posted January 11, 2018 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 91 Reputation: 22 Joined: 10/24/14 Last Seen: November 1, 2024 Share Posted January 11, 2018 2 minutes ago, pajodex said: Sorry, I'm just new to this complex scripting (at least for me) but where do I put that? Hi, add the above check i posted before to every "attachrid" command Quote Link to comment Share on other sites More sharing options...
-1 pajodex Posted January 11, 2018 Group: Members Topic Count: 79 Topics Per Day: 0.03 Content Count: 439 Reputation: 173 Joined: 12/12/17 Last Seen: April 14 Author Share Posted January 11, 2018 1 hour ago, Sehrentos said: Hi, add the above check i posted before to every "attachrid" command I dunno if I'm doing it right. This is how I did it: if (attachrid(.@teamA1[0])) { attachrid .@teamA1[0]; if(getcharid(1)) { party_delmember(); sleep 1; } party_create md5(gettimetick(2)+"A"); sleep 1; .PID[1] = getcharid(1); detachrid; } if (attachrid(.@teamA2[0])) { attachrid .@teamA2[0]; if(getcharid(1)) { party_delmember(); sleep 1; } party_create md5(gettimetick(2)+"B"); sleep 1; .PID[2] = getcharid(1); detachrid; } for(.@i = 1; .@i < .@num; .@i++) { if (attachrid(.@teamA1[0])) { attachrid .@teamA1[.@i]; if(getcharid(1)) { party_delmember(); sleep 1; } party_addmember .PID[1],getcharid(0); detachrid; } if (attachrid(.@teamA2[0])) { attachrid .@teamA2[.@i]; if(getcharid(1)) { party_delmember(); sleep 1; } party_addmember .PID[2],getcharid(0); detachrid; } but I'm getting this in console: [Error]: script:run_script_main: infinity loop ! [Debug]: Source (NPC): Mushroom Defense at prontera (150,174) Sorry for bugging you Quote Link to comment Share on other sites More sharing options...
Question
pajodex
Hi,
Sorry I cant post the full script but I think the main problem is this part
if(getcharid(1)) { party_delmember(); sleep 1; } party_create md5(gettimetick(2)+"A"); sleep 1; .PID[1] = getcharid(1); detachrid; attachrid .@teamA2[0]; if(getcharid(1)) { party_delmember(); sleep 1; } party_create md5(gettimetick(2)+"B"); sleep 1; .PID[2] = getcharid(1); detachrid; for(.@i = 1; .@i < .@num; .@i++) { attachrid .@teamA1[.@i]; if(getcharid(1)) { party_delmember(); sleep 1; } party_addmember .PID[1],getcharid(0); detachrid; attachrid .@teamA2[.@i]; if(getcharid(1)) { party_delmember(); sleep 1; } party_addmember .PID[2],getcharid(0); detachrid; }
I'm having this error in console:
[Error]: buildin_getcharid: fatal error ! player not attached! [Debug]: Function: getcharid (1 parameter): [Debug]: Data: number value=1 [Debug]: Source (NPC): MD at prontera (150,174)
Link to comment
Share on other sites
12 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.