Jump to content
  • 0

Detect if the players inside the map are all dead


Bisuke

Question


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  177
  • Reputation:   10
  • Joined:  04/02/12
  • Last Seen:  

Is there a way where I can script my event where it detects if the players inside the map "guild_vs1" are still alive every x number of seconds?

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

set map1,getmapusers("guildvs3");
OnMinute01:
OnMinute02:
OnMinute05:
OnMinute10:
OnMinute15:
OnMinute20:
OnMinute25:
OnMinute30:
OnMinute35:
OnMinute40:
OnMinute45:
OnMinute50:
OnMinute55:
OnMinute00:
announce "Total of "+.@map1+" Players in this Map.",0;
if(map1 >= 0);
mes "All ther players in map is dead!";
end;

 

Edited by Cyro
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

22 minutes ago, Bisuke said:

Is there a way where I can script my event where it detects if the players inside the map "guild_vs1" are still alive every x number of seconds?

I dont know what event is that but you can use getmapuser to get the number of players inside :)) and if someone die just use OnPCDieEvent to warp them out :))
 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  177
  • Reputation:   10
  • Joined:  04/02/12
  • Last Seen:  

17 minutes ago, crazyarashi said:

I dont know what event is that but you can use getmapuser to get the number of players inside :)) and if someone die just use OnPCDieEvent to warp them out :))
 

The Thing is, I don't want to warp them out of the map. It's a survival event, and players are allowed to resurrect other players. However, I want to create a script that will active as soon as all the players are dead, the event will be closed and all the dead players will be warped out.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

8 minutes ago, Bisuke said:

The Thing is, I don't want to warp them out of the map. It's a survival event, and players are allowed to resurrect other players. However, I want to create a script that will active as soon as all the players are dead, the event will be closed and all the dead players will be warped out.

isnt it working?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

Try

-	script	tesqweqweast	-1,{
OnInit:
	initnpctimer;
	end;

OnTimer5000:
	stopnpctimer;
	deletearray .players;
	addrid(5,1,"guild_vs1");
	.players[getarraysize(.players)] = getcharid(3);
	detachrid;
	while( .@i < getarraysize(.players) ){
		if( attachrid( .players[.@i] ) )
			if( HP && compare( strcharinfo(3),"guild_vs1" ) )
				.@alive++;
		.@i++;
	}
	if( .@alive ){
		initnpctimer;
		end;
	}
	deletearray .players;
	announce "Players are all the dead",0;
	mapwarp "guild_vs1","prontera",155,181;
	end;
}

 

Edited by Technoken
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  177
  • Reputation:   10
  • Joined:  04/02/12
  • Last Seen:  

23 hours ago, Technoken said:

Try


-	script	tesqweqweast	-1,{
OnInit:
	initnpctimer;
	end;

OnTimer5000:
	stopnpctimer;
	deletearray .players;
	addrid(5,1,"guild_vs1");
	.players[getarraysize(.players)] = getcharid(3);
	detachrid;
	while( .@i < getarraysize(.players) ){
		if( attachrid( .players[.@i] ) )
			if( HP && compare( strcharinfo(3),"guild_vs1" ) )
				.@alive++;
		.@i++;
	}
	if( .@alive ){
		initnpctimer;
		end;
	}
	deletearray .players;
	announce "Players are all the dead",0;
	mapwarp "guild_vs1","prontera",155,181;
	end;
}

 

Thank you for this reply, but I tried this code and it seems that the code is not working. :)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

 

15 minutes ago, Bisuke said:

Thank you for this reply, but I tried this code and it seems that the code is not working. :)

I just test the script and it's working fine with me. However, it only run once.

If you are going to insert the code inside your custom npc you should have a script that executed initnpctimer whenever the event starts. Also maybe increase the Timer to 30000(30 secs), so it won't be checking too fast.

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

You could instead run a while loop using addrid(1) and check if HP > 0

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  177
  • Reputation:   10
  • Joined:  04/02/12
  • Last Seen:  

Oh, I see, Thank you again, @Technoken and @Stolao This weekend, I will try again your codes, I haven't had the time to test it properly because of my schedule. I'll let you know the results.

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