Jump to content
  • 0

Help Russian Roulette NPC [Error]: buildin_strcharinfo: fatal error ! player not attached!


lelouchxv

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  120
  • Reputation:   8
  • Joined:  09/16/18
  • Last Seen:  

Hi im using this russian roulette script when im using sleep2 the npc is working fine but there is a map server error

[Error]: buildin_sleep2: no unit is attached
[Debug]: Source (NPC): Asiong Salonga at izlude (120,96)

 

But when i use sleep this error show in the map server and the npc is not gonna work

 

[Error]: buildin_strcharinfo: fatal error ! player not attached!
[Debug]: Function: strcharinfo (1 parameter):
[Debug]: Data: number value=0
[Debug]: Source (NPC): Asiong Salonga at izlude (120,96)
[Debug]: Source (NPC): Asiong Salonga at izlude (120,96)

Here is the script thae im using

//========================================================================================
//Title: Asiong Salonga | Russian Roulette
//Version: 1.0
//Author: Ghost
//Created: 12/24/2011
//Released: 12/24/2011
//Compatibility: rAthena | eAthena
//rAthena Topic: http://rathena.org/board/topic/58222-ghosts-scripts/
//Required File: http://www.mediafire.com/?ry9k4uolxlmj4kv
//Reference: http://en.wikipedia.org/wiki/Russian_roulette
//Note: Thanks to Z3R0, Arcenciel, and `KeiKun for helping me on making this script.
//©2011-2012 Ghost
//========================================================================================
izlude,120,96,6,	script	Asiong Salonga	731,{
//--Configuration
goto Asiong;
OnInit:
set .NPC$, "[Asiong Salonga]"; //What is the NPC name?
set .GMLevel, 90; //What is the minimum gm level to activate the event?
set .GetSkull, 1; //Do you want to get the skulls of the dead after winning? 1: Enabled | 0:Disable
set .Zeny, 0; //How much zeny you want the winner to get? | 0:Disable
setarray .ItemID[0], 7179; //What is the Item ID of the prize? | 0:Disable
setarray .ItemAmount[0],100; //How many pieces of the prize?
setarray .DeathDialog$[0], "Sayonara!", "Hasta la vista, baby!", "Die!"; //What do you want the NPC will say when someone dies?
setarray .AliveDialog$[0], "You lucky bastard!", "Bloody hell!", "Why can't you die!"; //What do you want the NPC will say when someone lives?
end;
//--End
Asiong:
mes .NPC$;
mes "Russian Roulette is a potentially lethal game of chance in which participants place a single round in a revolver, spin the cylinder, place the muzzle against their head and pull the trigger.";
if(.play == 2){ close; }
switch(select("Play:"+((getgmlevel() >= .GMLevel)?"Activate":"")+"")){
case 1:
	if((.play == 1) && (.pReg < .maxplayer)){
		for(set .@i, 0; .@i < .maxplayer; set .@i, .@i + 1){
			if(.playerlist$[.@i] == strcharinfo(0)){ 
			next;
			mes .NPC$;
			mes "You are already registered!"; 
			close;
			}
		}
	set .playerlist$[.pReg], strcharinfo(0);
	set .pReg, .pReg + 1;
	announce "["+.pReg+"/"+.maxplayer+"] "+strcharinfo(0)+" is registered.",bc_all;
	if(.pReg == .maxplayer){ goto PlayRR; }
	close;
	}
	else if((.pReg == .maxplayer) && (.play == 1)){
	next;
	mes .NPC$;
	mes "No open slot available.";
	close;
	}
	next;
	mes .NPC$;
	mes "Event has not yet started.";
	close;
case 2:
	next;
	mes .NPC$;
	mes "What is the maximum player?";
	input .maxplayer;
	if(.maxplayer < 2){ dispbottom "Max player must be greater than 1."; close; }
	set .maxplayer, .maxplayer;
	set .play, 1;
	announce "[Russian Roulette] Registration is open. "+.maxplayer+" players needed!",bc_all;
	close;
}
close;

PlayRR:
	close2;
	detachrid;
	copyarray .copiedplayer$[0], .playerlist$[0], 128;
	set .play, 2;
	announce "[Russian Roulette] Thrilling trigger pulls are about to start!",bc_all;
	announce "Active Player Listing",bc_all,0xFFFFFF;
	for(set .@i, 0; .@i < getarraysize(.playerlist$); set .@i, .@i + 1){
		set .@j, .@j + 1;
		announce ""+.@j+". "+.playerlist$[.@i]+"",bc_all,0xFFFFFF;
		sleep 1000;
	}
	announce "Do not disconnect. You will be disqualified!",bc_all,0xFFFFFF;
	callsub OnSpin;
close;

OnSpin:
	set .spin, rand(0, .pReg - 1);
	attachrid(getcharid(3, .playerlist$[.spin]));
	callsub OnCheck;
	mapannounce "izlude", .NPC$ +" The revolver is spinning . . .",bc_map;
	sleep 3000;
	mapannounce "izlude", .NPC$ +" Revolver slowly stopped spinning . . .",bc_map;
	sleep 2000;
	mapannounce "izlude", .NPC$ +" The revolver is pointing to "+ strcharinfo(0) +" . . .",bc_map;
	sleep 3000;
	mapannounce "izlude", .NPC$ +" Pull the trigger now "+ strcharinfo(0),bc_map;
	callsub OnCheck;
	callsub OnShoot;
	sleep 3000;
	callsub OnSpin;
return;
	
OnShoot:
if(rand(1, 3) == 1){
	soundeffectall "Revolver.wav", 0;
	sleep 2300;
	specialeffect2 669;
	specialeffect2 531;
	percentheal -100, -100;
	deletearray .playerlist$[.spin], 1;
	set .pReg, .pReg - 1;
	mapannounce "izlude", "["+.pReg+"/"+.maxplayer+"] "+strcharinfo(0)+" is out!",bc_map,0xFF0000;
	mapannounce "izlude", ""+.NPC$+" "+.deathdialog$[rand(1, getarraysize(.deathdialog))]+"", bc_map,0xFF0000;
} else {
	soundeffectall "Revolver.wav", 0;
	sleep 2300;
	specialeffect2 675;
	specialeffect2 522 + rand(1,14);
	mapannounce "izlude", ""+.NPC$+" "+.alivedialog$[rand(1, getarraysize(.alivedialog))]+"", bc_map,0xFF0000;
} return;

OnCheck:
if(.pReg <= 0){
	announce .NPC$ +" No winner! They all disappear!",bc_all;
	callsub CleanUp;
}
else if((.pReg == 1) && (.maxplayer <= 2) && (getarraysize(.disqualified$))){
	announce .NPC$ +" No winner! A player has been disqualified in 2 player mode.",bc_all;
	callsub CleanUp;
}
else if((.pReg == 1) && (.maxplayer >= 2)){
	announce .NPC$ +" We got a winner! Congratulations "+strcharinfo(0)+"!",bc_all;
	if(.GetSkull){
		for(set .@i, 0; .@i < .maxplayer; set .@i, .@i + 1){
			if(strcharinfo(0) != .copiedplayer$[.@i]){
			getnameditem 7420, .copiedplayer$[.@i];
			}
		}
	}
for(set .@i, 0; .@i < getarraysize(.ItemID); set .@i, .@i + 1){
	if(.ItemID){ getitem .ItemID[.@i], .ItemAmount[.@i]; }
}
if(.Zeny){ set Zeny, Zeny + .Zeny; }
callsub CleanUp;
} return;

OnPCLogoutEvent:
if(.play){
	setarray .disqualified$[.@l], strcharinfo(0);
	set .@l, .@l + 1;
	for(set .@i, 0; .@i < .maxplayer; set .@i, .@i + 1){
		if(.playerlist$[.@i] == strcharinfo(0)){
		deletearray .playerlist$[.@i], 1;
		set .pReg, .pReg - 1;
		announce "["+.pReg+"/"+.maxplayer+"] "+strcharinfo(0)+" has disqualified.",bc_all,0xFF0000;
		break;
		}
	}
}
end;

//--Clean Variables
CleanUp:
set .play, 0;
set .pReg, 0;
set .maxplayer, 0;
deletearray .playerlist$, 128;
deletearray .copiedplayer$, 128;
deletearray .disqualified$, 128;
end;
//--End
} 

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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

OnSpin:
	set .spin, rand(0, .pReg - 1);
	attachrid(getcharid(3, .playerlist$[.spin]));
	.@name$ = strcharinfo(0);
	callsub OnCheck;
	mapannounce "izlude", .NPC$ +" The revolver is spinning . . .",bc_map;
	sleep 3000;
	mapannounce "izlude", .NPC$ +" Revolver slowly stopped spinning . . .",bc_map;
	sleep 2000;
	mapannounce "izlude", .NPC$ +" The revolver is pointing to "+ .@name$ +" . . .",bc_map;
	sleep 3000;
	mapannounce "izlude", .NPC$ +" Pull the trigger now "+ .@name$,bc_map;
	callsub OnCheck;
	callsub OnShoot;
	sleep 3000;
	callsub OnSpin;
	return;

try this

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  120
  • Reputation:   8
  • Joined:  09/16/18
  • Last Seen:  

[Debug]: Function: specialeffect2 (1 parameter): [Debug]: Data: number value=669 [Debug]: Source (NPC): Asiong Salonga at prontera (172,175)

this is what it shows next @Emistry

1 hour ago, Emistry said:
OnSpin:
	set .spin, rand(0, .pReg - 1);
	attachrid(getcharid(3, .playerlist$[.spin]));
	.@name$ = strcharinfo(0);
	callsub OnCheck;
	mapannounce "izlude", .NPC$ +" The revolver is spinning . . .",bc_map;
	sleep 3000;
	mapannounce "izlude", .NPC$ +" Revolver slowly stopped spinning . . .",bc_map;
	sleep 2000;
	mapannounce "izlude", .NPC$ +" The revolver is pointing to "+ .@name$ +" . . .",bc_map;
	sleep 3000;
	mapannounce "izlude", .NPC$ +" Pull the trigger now "+ .@name$,bc_map;
	callsub OnCheck;
	callsub OnShoot;
	sleep 3000;
	callsub OnSpin;
	return;

try this

 

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