Jump to content
  • 0

giveitem command in event


Tassadar

Question


  • Group:  Members
  • Topic Count:  52
  • Topics Per Day:  0.02
  • Content Count:  107
  • Reputation:   5
  • Joined:  07/21/16
  • Last Seen:  

Good Morning.

I would like to know how to give items to the participants of this event.
I'm afraid to use the giveitem command and it will reward the whole server.

How do I hold the giveitem at the participants?

Is it beyond this prize to draw a special item for one participant only? Randomly?

 

//===== rAthena Script =======================================
//= Devil Square
//===== By: ==================================================
//= Kirlein, Stillhard (translation), AnnieRuru (rewrite)
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
//= Devil Square, based on the event in MU Online.
//= Defeat three waves of monsters for treasure.
//===== Additional Comments: =================================
//= 1.0 First version, edited. [Euphy]
//============================================================

prontera,138,224,5	script	Devil Square Guardian#1	406,{
	set .@gm_level, 99; // GM level required to start/stop the event

	mes "[Devil Square Guardian]";
	mes "This is the entrance to ^FF0000Devil Square^000000.";
	mes "If you fail or die, the door will close and you must wait until the event starts again to re-enter.";
	next;
	switch(select("Enter.:Information.:" + ((getgmlevel() >= .@gm_level) ? "GM Menu." : "") + ":Cancel.")) {
	case 1:
		if (.start != 1) { // registration period
			mes "[Devil Square Guardian]";
			mes "Devil Square is now closed.";
			mes "It will open at these times:";
			mes "00:15 , 02:15 , 04:15 , 06:15"; // display your times here
			mes "08:15 , 10:15 , 12:15 , 14:15";
			mes "16:15 , 18:15 , 20:15 , 22:15";
			close;
		}
		if (BaseLevel < 70 || Zeny < 500000) { // requirements
			mes "[Devil Square Guardian]";
			mes "You do not meet the requirements to enter Devil Square.";
			mes " ";
			mes "Requirements:";
			mes " - Base Level 70";
			mes " - Registration fee 500,000z";
			close;
		}
		Zeny -= 20000;
		announce strcharinfo(0)+" has entered Devil Square.", bc_npc;
		percentheal 100,100;
		warp "ordeal_1-1",183,182;
		close;
	case 2:
		mes "[Devil Square Guardian]";
		mes "Inside, you will encounter 3 waves of monsters. The monsters will grow stronger with each wave.";
		next;
		mes "[Devil Square Guardian]";
		mes "If you defeat all the enemies, you will be given the opportunity to open 10 Treasure Chests with items, equipment, and rare cards inside!";
		close;
	case 3:
		mes "[Devil Square Guardian]";
		switch (.start) { // event states
			case 0: mes "Devil Square has not yet started."; break;
			case 1: mes "Devil Square is currently accepting participants."; break;
			case 2: mes "Devil Square Event is currently running on Round "+ .round +" with "+ .mob +" monsters remaining."; break;
		}
		next;
		switch(select("Start event.:Stop event.:Cancel.")) {
		case 1:
			mes "[Devil Square Guardian]";
			if (.start)
				mes "Devil Square has already started.";
			else {
				mes "Starting Devil Square...";
				donpcevent strnpcinfo(0)+"::OnStartEvent";
			}
			close;
		case 2:
			mes "[Devil Square Guardian]";
			if (!.start)
				mes "Devil Square has not yet started.";
			else {
				mes "Stopping Devil Square...";
				donpcevent strnpcinfo(0)+"::OnStopEvent";
			}
			close;
		case 3:
			break;
		}
		break;
	case 4:
		break;
	}
	mes "[Devil Square Guardian]";
	mes "Farewell.";
	close;

OnStartEvent:
OnClock0015:
OnClock0215:
OnClock0415:
OnClock0615:
OnClock0815:
OnClock1015:
OnClock1215:
OnClock1415:
OnClock1615:
OnClock1815:
OnClock2015:
OnClock2215:
	.start = 1;
	disablenpc "ord11-12"; //from npc/warps/pvp.txt
	disablenpc "Devil Square Guardian#2";
	mapannounce "ordeal_1-1","Devil Square is now closed.", bc_map;
	getmapxy .@map$, .@x, .@y, UNITTYPE_NPC;
	mapwarp "ordeal_1-1", .@map$, .@x, .@y;
	killmonsterall "ordeal_1-1";
	announce "Devil Square is OPEN. The event will begin in 5 minutes.", bc_all;
	sleep 60000;
	announce "Devil Square will begin in 4 minutes.", bc_all;
	sleep 60000;
	announce "Devil Square will begin in 3 minutes.", bc_all;
	sleep 60000;
	announce "Devil Square will begin in 2 minutes.", bc_all;
	sleep 60000;
	announce "Devil Square will begin in 1 minute.", bc_all;
	sleep 60000;
	announce "Devil Square has STARTED!", bc_all;
	if ( !getmapusers("ordeal_1-1") )
		goto OnStopEvent;
	.start = 2;
	.round = 1;
	.mob = 75;
	areamonster "ordeal_1-1",183,182,246,244,"[DS] SOLDIER SKELETON",1028,10,strnpcinfo(0)+"::OnDevilDead";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] ORC ARCHER",1189,15,strnpcinfo(0)+"::OnDevilDead";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] SANDMAN",1165,10,strnpcinfo(0)+"::OnDevilDead";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] ARCHER SKELETON",1016,15,strnpcinfo(0)+"::OnDevilDead";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] MINOROUS",1149,15,strnpcinfo(0)+"::OnDevilDead";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] REQUIEM",1164,10,strnpcinfo(0)+"::OnDevilDead";
	end;

OnDevilDead:
	.mob--;
	if ( .mob == 25 || .mob == 5 )
		announce "Devil Square : "+ .mob +" monsters remaining in round 1.", bc_map;
	else if ( .mob <= 0 ) {
		announce "Devil Square is entering round 2...", bc_map;
		goto OnDevil2;
	}
	end;

OnDevil2:
	.round = 2;
	.mob = 70;
	areamonster "ordeal_1-1",183,182,246,244,"[DS] GARGOYLE",1253,15,strnpcinfo(0)+"::OnDevilDead2";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] ALARM",1193,10,strnpcinfo(0)+"::OnDevilDead2";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] HIGH ORC",1213,10,strnpcinfo(0)+"::OnDevilDead2";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] INJUSTICE",1257,10,strnpcinfo(0)+"::OnDevilDead2";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] MIMIC",1191,15,strnpcinfo(0)+"::OnDevilDead2";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] WRAITH",1192,10,strnpcinfo(0)+"::OnDevilDead2";
	end;

OnDevilDead2:
	.mob--;
	if ( .mob == 25 || .mob == 5 )
		announce "Devil Square : "+ .mob +" monsters remaining in round 2.", bc_map;
	else if ( .mob <= 0 ) {
		announce "Devil Square is entering round 3...", bc_map;
		goto OnDevil3;
	}
	end;

OnDevil3:
	.round = 3;
	.mob = 58;
	areamonster "ordeal_1-1",183,182,246,244,"[DS] ANOLIAN",1206,15,strnpcinfo(0)+"::OnDevilDead3";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] WANDERER",1208,15,strnpcinfo(0)+"::OnDevilDead3";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] DEVIRUCHI",1109,10,strnpcinfo(0)+"::OnDevilDead3";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] JOKER",1131,15,strnpcinfo(0)+"::OnDevilDead3";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] MOONLIGHT",1150,2,strnpcinfo(0)+"::OnDevilDead3";
	areamonster "ordeal_1-1",183,182,246,244,"[DS] DARK ILLUSION",1302,1,strnpcinfo(0)+"::OnDevilDead3";
	end;

OnDevilDead3:
	.mob--;
	if ( .mob == 25 || .mob == 5 )
		announce "Devil Square : "+ .mob +" monsters remaining in the final round.", bc_map;
	else if ( .mob <= 0 ) {
		announce "Devil Square : CONGRATULATIONS. These 10 Treasure Chests are yours.", bc_map;
		goto OnDevil4;
	}
	end;

OnDevil4:
	.round = 4;
	.mob = 10;
	monster "ordeal_1-1",231,250,"Treasure Chest",1324,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",234,247,"Treasure Chest",1328,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",237,244,"Treasure Chest",1332,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",240,241,"Treasure Chest",1336,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",243,238,"Treasure Chest",1340,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",246,235,"Treasure Chest",1344,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",249,232,"Treasure Chest",1348,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",252,229,"Treasure Chest",1352,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",249,241,"Treasure Chest",1356,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",240,249,"Treasure Chest",1360,1,strnpcinfo(0)+"::OnTreasureDead";
	end;

OnTreasureDead:
	.mob--;
	announce "Devil Square : "+ strcharinfo(0) +" has opened the Treasure Chest at Devil Square.", bc_all;
	if ( .mob <= 0 )
		goto OnStopEvent;
	end;

OnStopEvent:
	killmonsterall "ordeal_1-1";
	enablenpc "ord11-12"; //from npc/warps/pvp.txt
	enablenpc "Devil Square Guardian#2";
	.start = .round = .mob = 0;
	end;
}

ordeal_1-1,246,245,7	script	Devil Square Guardian#2	406,{
	mes "[Exit]";
	mes "Farewell.";
	close2;
	warp "SavePoint",0,0;
	end;
}

ordeal_1-1	mapflag	nowarp
ordeal_1-1	mapflag	nowarpto
ordeal_1-1	mapflag	noteleport
ordeal_1-1	mapflag	monster_noteleport
ordeal_1-1	mapflag	nosave	SavePoint
ordeal_1-1	mapflag	nomemo
ordeal_1-1	mapflag	nobranch
ordeal_1-1	mapflag	nopenalty
ordeal_1-1	mapflag	noicewall

Thanks for the help.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

Change this part..

OnDevilDead3:
	.mob--;
	if ( .mob == 25 || .mob == 5 )
		announce "Devil Square : "+ .mob +" monsters remaining in the final round.", bc_map;
	else if ( .mob <= 0 ) {
		announce "Devil Square : CONGRATULATIONS. These 10 Treasure Chests are yours.", bc_map;
		goto OnDevil4;
	}
	end;

OnDevil4:
	.round = 4;
	.mob = 10;
	monster "ordeal_1-1",231,250,"Treasure Chest",1324,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",234,247,"Treasure Chest",1328,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",237,244,"Treasure Chest",1332,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",240,241,"Treasure Chest",1336,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",243,238,"Treasure Chest",1340,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",246,235,"Treasure Chest",1344,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",249,232,"Treasure Chest",1348,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",252,229,"Treasure Chest",1352,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",249,241,"Treasure Chest",1356,1,strnpcinfo(0)+"::OnTreasureDead";
	monster "ordeal_1-1",240,249,"Treasure Chest",1360,1,strnpcinfo(0)+"::OnTreasureDead";
	end;

OnTreasureDead:
	.mob--;
	announce "Devil Square : "+ strcharinfo(0) +" has opened the Treasure Chest at Devil Square.", bc_all;
	if ( .mob <= 0 )
		goto OnStopEvent;
	end;

into this one
 

OnDevilDead3:
	.mob--;
	if ( .mob == 25 || .mob == 5 )
		announce "Devil Square : "+ .mob +" monsters remaining in the final round.", bc_map;
	else if ( .mob <= 0 ) {
		announce "Devil Square : CONGRATULATIONS. You can open a treasure chest as a reward.", bc_map;
		goto OnDevil4;
	}
	end;

OnDevil4:
	monster "ordeal_1-1",238,240,"Treasure Chest",1324,1,strnpcinfo(0)+"::OnTreasureDead";
	end;

OnTreasureDead:
	getitem 501,1; //This is the reward
	announce "Devil Square : "+ strcharinfo(0) +" has opened the Treasure Chest at Devil Square.", bc_all;
	warp "SavePoint",0,0;
	sleep 2000;
	monster "ordeal_1-1",238,240,"Treasure Chest",1324,1,strnpcinfo(0)+"::OnTreasureDead";
	if(!getmapusers("ordeal_1-1"))
		goto OnStopEvent;
	end;

This will give all the participants a prize whenever they hit the treasure box.
Also i don't quite understand if you want 1 player to get special item.

Edited by Haruka Mayumi
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  52
  • Topics Per Day:  0.02
  • Content Count:  107
  • Reputation:   5
  • Joined:  07/21/16
  • Last Seen:  

Thanks, I'll test it.

In this way you did only appear a chest and when someone kills the chest receives the prize and is teleported out?
 

OnDevilDead3:
	.mob--;
	if ( .mob == 25 || .mob == 5 )
		announce "Devil Square : "+ .mob +" monsters remaining in the final round.", bc_map;
	else if ( .mob <= 0 ) {
		announce "Devil Square : CONGRATULATIONS. You can open a treasure chest as a reward.", bc_map;
		goto OnDevil4;
	}
	end;

I can not leave it like this?

OnTreasureDead:
	.mob--;
	getitem 501,1; //This is the reward
	announce "Devil Square : "+ strcharinfo(0) +" has opened the Treasure Chest at Devil Square.", bc_all;
	if ( .mob <= 0 )
		goto OnStopEvent;
	end

thanks for helping.


 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

if you leave it like that. 1 player can take all the box, so others won't be able to get any prize.

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