Jump to content
  • 0

Fatal error - Player not attached


DelghLay

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  07/11/17
  • Last Seen:  

Hello everyone, well my problem is i can't attach player in this line:
if (strcharinfo(3) == "mine_evt" && getequipid(EQI_COSTUME_HEAD_TOP) == 33008 && getequipid(EQI_HAND_R) == 33007) {

I've tried so many ways but doesn't work.

Thanks.

//=================== Announcer =====================

-	script	Announcerm	-1,{

OnMinute35:

	killmonster "mine_evt.gat","All";
	announce "xxxxxxxxxx.",bc_all,0xAA42F9;
	sleep 4000;
	announce "xxxxxxxxxxxx.",bc_all,0xAA42F9;
	enablenpc "Shadow Miner";
	sleep 4000;
	announce "xxxxxxxxxx.",bc_all,0xAA42F9;
	sleep 4000;
	announce "xxxxxxxxx.",bc_all,0xAA42F9; 
	sleep 60000;
	announce "xxxxxxxxxx.",bc_all,0xAA42F9;
	disablenpc "Shadow Miner";
	if(getmapusers("mine_evt") == 0) 
	{
		disablenpc "Minery";
		disablenpc "crystaltimer";
		announce "xxxxxxxxxxxxx.",bc_all,0xAA42F9;
		end;
	}

	donpcevent "Minery::OnEncen";
	end;

OnInit:

	disablenpc "Minery";
	disablenpc "Shadow Miner";
}

//============================= Warper =====================================

prontera,147,163,6	script	Shadow Miner	1169,{

mes "[^AA42F9Fiebre del Mineral^000000]";
mes "xxxxxxxxxxx:";
menu 	"XXX.",L_gomine,
		"YYYY.",L_nogo;

	L_gomine:
		mes "xxxxxxxxx.";
		specialeffect2 35;
		sleep2 100;
		specialeffect2 6;
		sleep2 1200;
		specialeffect2 71;
		specialeffect2 389;
		specialeffect2 36;
		specialeffect2 389;
		sleep2 825;
		warp "mine_evt",98,45;
		close;
			
	L_nogo:
		mes "xxxxxxxxxxx.";
		close;
	
}
//====================================================================

-	script	Minery	-1,{

OnEncen:
mapannounce "mine_evt","Shadow Miner: xxxxxxxx.",bc_all,0xAA42F9;
sleep 6000;
mapannounce "mine_evt","Shadow Miner: xxxxxxx.",bc_all,0xAA42F9;
sleep 6000;
mapannounce "mine_evt","Shadow Miner: xxxxxxx.",bc_all,0xAA42F9;
sleep 10000;
mapannounce "mine_evt","Shadow Miner: xxxxxxx.",bc_all,0xAA42F9;
sleep 10000;
mapannounce "mine_evt","Shadow Miner: xxxxxxx.",bc_all,0xAA42F9;
sleep 6000;
goto L_Comt;
end;

L_Comt:
	if(getmapusers("mine_evt") == 0) goto L_Noth;
	if(getmapusers("mine_evt") >= 1) {

	mapannounce "mine_evt","Shadow Miner: xxxxx",bc_all,0xAA42F9;
	sleep 2000;
	mapannounce "mine_evt","Shadow Miner: 5",bc_all,0xAA42F9;
	sleep 1000;
	mapannounce "mine_evt","Shadow Miner: 4",bc_all,0xAA42F9;
	sleep 1000;
	mapannounce "mine_evt","Shadow Miner: 3",bc_all,0xAA42F9;
	sleep 1000;
	mapannounce "mine_evt","Shadow Miner: 2",bc_all,0xAA42F9;
	sleep 1000;
	mapannounce "mine_evt","Shadow Miner: 1",bc_all,0xAA42F9;
	sleep 1000;
	mapannounce "mine_evt","Shadow Miner: Go!.",bc_all,0xAA42F9;
	playBGMall "mining";
	donpcevent "crystalsummoner::OnSumCr";
	donpcevent "crystaltimer::OnTierTm";
	end;
	}

	L_Noth:
	disablenpc "Minery";
	killmonster "mine_evt.gat","All";
	end;
}

//================= NPC TIMER ======================
-	script	crystaltimer	-1,{

OnTierTm:

	initnpctimer;
	end;

OnTimer1000:

	if (strcharinfo(3) == "mine_evt" && getequipid(EQI_COSTUME_HEAD_TOP) == 33008 && getequipid(EQI_HAND_R) == 33007) {
	end;
	} else {
	message strcharinfo(0),"You will be kick out for not complying with the rules of the event: use of equipment.";
	sleep2 3000;
	warp "prontera.gat",155,184;
	end;
	}

OnTimer10000:

	if (strcharinfo(3) == "mine_evt" && getequipid(EQI_COSTUME_HEAD_TOP) == 33008 && getequipid(EQI_HAND_R) == 33007) {
	end;
	} else {
	message strcharinfo(0),"You will be kick out for not complying with the rules of the event: use of equipment.";
	sleep2 3000;
	warp "prontera.gat",155,184;
	end;
	}
	
OnTimer20000:

	if (strcharinfo(3) == "mine_evt" && getequipid(EQI_COSTUME_HEAD_TOP) == 33008 && getequipid(EQI_HAND_R) == 33007) {
	end;
	} else {
	message strcharinfo(0),"You will be kick out for not complying with the rules of the event: use of equipment.";
	sleep2 3000;
	warp "prontera.gat",155,184;
	end;
	}

OnTimer30000:

	if (strcharinfo(3) == "mine_evt" && getequipid(EQI_COSTUME_HEAD_TOP) == 33008 && getequipid(EQI_HAND_R) == 33007) {
	end;
	} else {
	message strcharinfo(0),"You will be kick out for not complying with the rules of the event: use of equipment.";
	sleep2 3000;
	warp "prontera.gat",155,184;
	end;
	}
	
OnTimer40000:

	if (strcharinfo(3) == "mine_evt" && getequipid(EQI_COSTUME_HEAD_TOP) == 33008 && getequipid(EQI_HAND_R) == 33007) {
	end;
	} else {
	message strcharinfo(0),"You will be kick out for not complying with the rules of the event: use of equipment.";
	sleep2 3000;
	warp "prontera.gat",155,184;
	end;
	}
	
OnTimer50000:

	if (strcharinfo(3) == "mine_evt" && getequipid(EQI_COSTUME_HEAD_TOP) == 33008 && getequipid(EQI_HAND_R) == 33007) {
	end;
	} else {
	message strcharinfo(0),"You will be kick out for not complying with the rules of the event: use of equipment.";
	sleep2 3000;
	warp "prontera.gat",155,184;
	end;
	}

OnTimer60000:

	if (strcharinfo(3) == "mine_evt" && getequipid(EQI_COSTUME_HEAD_TOP) == 33008 && getequipid(EQI_HAND_R) == 33007) {
	end;
	} else {
	message strcharinfo(0),"You will be kick out for not complying with the rules of the event: use of equipment.";
	sleep2 3000;
	warp "prontera.gat",155,184;
	end;
	}
	
OnTimer70000:

	if (strcharinfo(3) == "mine_evt" && getequipid(EQI_COSTUME_HEAD_TOP) == 33008 && getequipid(EQI_HAND_R) == 33007) {
	end;
	} else {
	message strcharinfo(0),"You will be kick out for not complying with the rules of the event: use of equipment.";
	sleep2 3000;
	warp "prontera.gat",155,184;
	end;
	}

OnTimer80000:

	mapannounce "Shadow Miner: Se acabo jejeje, los devolvere a Prontera",bc_all,0xAA42F9;
	killmonster "mine_evt.gat","All";
	end;

OnTimer83500:
	mapwarp "mine_evt.gat","prontera.gat",155,184;
	disablenpc "Minery";
	disablenpc "Shadow Miner";
	stopnpctimer;
	setnpctimer 0;
	disablenpc "crystaltimer";
	end;	

}

//================= Crystal Respawn ======================

-	script	crystalsummoner	-1,{

OnSumCr:

if(getmapusers("mine_evt") == 0) goto L_2Nada;
monster "mine_evt.gat",0,0,"Gold Node",3512,80,"crystalbrek::OnCrystalKilled";
monster "mine_evt.gat",0,0,"Diamantinum Node",3511,5,"crystalbrek2::OnCrystalKilled";end;
L_2Nada:
disablenpc "Minery";
killmonster "mine_evt.gat","All";
end;
}

//================== Crystal 1 ======================

-	script	crystalbrek	-1,{

OnCrystalKilled:

	getitem 969,10;
	end;
}

//================== Crystal 2 ======================

-	script	crystalbrek2	-1,{

OnCrystalKilled:

	getitem 33005,1;
	end;
}

//================= Mapflags =======================

mine_evt	mapflag	nowarp
mine_evt	mapflag	nowarpto
mine_evt	mapflag	noteleport
mine_evt	mapflag	nosave
mine_evt	mapflag	nomemo
mine_evt	mapflag	nobranch
mine_evt	mapflag	noloot
mine_evt	mapflag	noskill
mine_evt	mapflag	nopenalty
mine_evt	mapflag	noreturn
mine_evt	mapflag	pvp	off

 

Link to comment
Share on other sites

12 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:  

You are not attaching any players to the npctimers... attachnpctimer (getcharid (0));....

You can't read char info if a character never started the timer or event...

 

Might need to re work this script

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  07/11/17
  • Last Seen:  

Can you show me with a little example?, i've read the docs but i cant understand how works this thing

Edited by DelghLay
grammar mistake
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:  

Well the only time the players interact with those NPC's are 2 instances...

A ) When they warp to the map

B ) When they kill something...

What I would suggest doing is storing the players that are warped to the map into an array

right before the warp...

set(.mine_players[getarraysize(.@mine_players)], getcharid(0));

This will give you a useable array of character id's that have joined the event...

 

On your crystaltimer npc... where you start the timer... instead of starting it with initnpctimer()... loop through each character that should still be in the mine map...

for(.@i = 0; .@i < getarraysize(getvariableofnpc(".mine_players")); .@i++) {

  // Make sure the users are still on the map...
  getmapxy(.@map$, .@x, .@y, UNITTYPE_PC);
  if (.@map$ == "mine_evt") {
   	// Still on the map...
    initnpctimer(getcharid(0)); // This will attach the NPC Timer to the character so you can run multiple rather than 1...
  }
                                                 
}

I haven't tested this so I can't be 100% sure, but that's something for what you are looking for...

 

Edited by Z3R0
Added UNITTYPE_PC
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  120
  • Reputation:   48
  • Joined:  07/23/13
  • Last Seen:  

48 minutes ago, Z3R0 said:

getmapxy(.@map$, .@x, .@y);

Bro I can 100% sure it will show error in this line since you are missing the unit type parameter.:lol:

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:  

Updated :D

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  07/11/17
  • Last Seen:  

ups, i got this error xd

error.jpg

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:  

Oh sorry one small glitch you have to specify the npc name to retrieve the variable from in getvariableofnpc... not something I have used in a while... look up the syntax in rathena script commands.. and put the npc name that has that variable of the players... so that you retrieve that variable from that npc

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  07/11/17
  • Last Seen:  

Thanks for the feedback, i've fixed  player time attacht problem (i think), but i cant solve this one, im so clumsy with variables and arrays, sorry

Sin título.jpg

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:  

Sorry I botched the code a bit... this is what happens when I can't test haha...

 

Getmapxy you need to include the charname... I think u can use charid... don't know..m to access char id... it will be...

 

getelementofarray ( getvariableofnpc (".mine_players", npc name), .@i) within the for loop...

 

When u initnpctimer you need to include char id... to replace getcharid (0) with the above code as well... or you can simply male that it's own var...

 

.@charid = getelementofarray ( getvariableofnpc (".mine_players", npc name), .@i); from within the for loop

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  07/11/17
  • Last Seen:  

On 27-07-2017 at 10:36 AM, Z3R0 said:

Problem Solved :D

for(.@i = 0; .@i < getarraysize(getvariableofnpc(.mine_players, "Shadow Miner")); .@i++) {
.@charid = getelementofarray(getvariableofnpc(.mine_players, "Shadow Mine"), .@i);
getmapxy(.@map$, .@x, .@y, UNITTYPE_PC,strcharinfo(0,.@charid));
if (.@map$ == "mine_evt") {
 
And This

if (strcharinfo(3,.@charid) == "mine_evt" && getequipid(EQI_HEAD_TOP,.@charid) == 33008 && getequipid(EQI_HAND_R,.@charid) == 33007) {

 

Edited by DelghLay
Wrong
Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  07/11/17
  • Last Seen:  

Thank you so much Emistry, both scripts works perfectly

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