Jump to content
  • 0

Treasure Box with progress bar after mvp is killed


CyanZoldyck

Question


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.01
  • Content Count:  31
  • Reputation:   0
  • Joined:  01/09/21
  • Last Seen:  

Hi script Gods! I would like to ask assistance if my request is possible. I'd like to make it that Treasure Boxes will drop instead of items after MVP has been killed. And upon opening the treasure boxes, it will display a 10 seconds progress bar before you can open it and get the reward.

I've been using and modified GM Poring King's script for my simple MVP Boss invasion. Hope you can help me on this

//================================================Name======================================================
									// Goblin Invasion NPC (Official Release Name)
//===============================================Version====================================================
//												  1.2 
//===============================================Author=====================================================
//					 ____ _____  ______  __ __   __  _______    __   _____ __   __  _______
//					|  __ \ _  \|  __  \|  |  \ |  |/  ___  \  |  | /  /  |  \ |  |/  ___  \
//					| |__| | \  \ |__|  |  |   \|  |  |  _\_/  |  |/  /|  |   \|  |  |  _\_/
//					|   __/   | |      /|  |       |  | |_  \  |     | |  |    |  |  | |_  \
//					|  |\  \_/  /  |\  \|  |  |\   |   \_/  |  |  |\  \|  |  |\   |   \_/  |
//					|__| \_____/|__| \__\__|__| \__|\______/   |__| \__\__|__| \__|\______/
//----------------------------------------Script Last Update 2020-------------------------------------------
//==============================================Changelog===================================================
									// 1.0 *
									//		- Initial Release
									// 1.1
									//		- Added Host Event by GMAccess
									// 1.2
									//		- Remove all error from Latest rAthena
									//		- Maximize script
									//		- Fix some dialog of NPC
									//		- Added Mapflag for the Event Map 
//==========================================================================================================
firstcity,211,121,4	script	Invasion NPC	459,{

set .gm,50;//GM Level to access the GM Menu. Default: 50

	// GM menu 
	//It allows GMs Level 50 or more to Start and Stop invasions.
	if (getgmlevel()>.gm) {
		if (.mobs_left) {
			mes "[Invasion]";
			mes "An invasion is in progress..";
			mes "Location: " + .Map$;
			mes "^FF0000"+.mobs_left+"^000000 Goblins left";
			mes " ";
			mes "Stop invasion?";
			if(select("No:Yes")==1) close;
			donpcevent "Invasion NPC::OnTimer1805000";
			mes "Invasion stopped";
			announce "The Invasion has been stopped by "+strcharinfo(0),bc_all;
			close;
		}
		mes "[Invasion]";
		mes "Please customize the Invasion event before starting it.";
		mes "Note - The Goblin Leader drops x5 of the prize.";
		Main:
		next;
		mes "[Invasion]";
			switch(select("Item [" + getitemname(.ItemID) + "]:Start Event")) {
		case 1:
			mes "Which item would you like the World Boss to drop?";
			mes "Please input the item ID:";
			input .ItemID;
			goto Main;
		case 2:
			mes "Starting the event now...";
			close2;
			goto OnStart;
	}
	
	// If a player clicks the NPC, it displays:
	
	mes "[Invasion]";
	mes .mobs_left+" have invaded "+.Map$[.rand_map]+"!";
	close;
	
			/////////////////////////
			//The actual NPC Script//
			/////////////////////////
OnClock2200:
OnStart:
		set .mobs_left, 1;
		sleep 1000;
		set $@ran, rand(1,6);
		if ($@ran == 6) set .Map$,"1@def02";
		if ($@ran == 5) set .Map$,"1@def02";
		if ($@ran == 4) set .Map$,"1@def02";
		if ($@ran == 3) set .Map$,"1@def02";
		if ($@ran == 2) set .Map$,"1@def02";
		if ($@ran == 1) set .Map$,"1@def02";
		sleep 1000;
		announce "[ Rune-Midgard Guard ]: We have trouble here in the World Boss town " + .Map$ + "!", bc_all;
		sleep 5000;
		announce "[ Rune-Midgard Guard ]: Everyone, we need your help to get rid of World Boss! Please join!", bc_all;
		monster .Map$,0,0,"Bakonawa",2320,1,"Invasion NPC::OnMyMobDead";
		set .mobs_left, 1;
		initnpctimer;
		end;
	
	
OnTimer10800000:	// 3 hours later, kills all the mobs.
				killmonster .Map$,"Invasion NPC::OnMyMobDead";
				set .mobs_left, 0;
				goto OnStop;
				stopnpctimer;

OnStop://When the event is stopped by a GM, or all monsters dead.
			killmonster .Map$,"Invasion NPC::OnMyMobDead";
			killmonster .Map$,"Invasion NPC::OnSpecialMobDead";
			announce "World Boss has ended.",bc_all;
			end;

OnMyMobDead: //When a World Boss is killed
			set .mobs_left, .mobs_left-1;
			if (.mobs_left==0) {
				announce "[ Rune-Midgard Guard ]: Everyone, thankyou for helping to get rid of the World Boss!", bc_all;
				getitem .ItemID,1; //Change the [5] to the amount you wish to hand out.
				donpcevent "Invasion NPC::OnStop";

			} else {
				//announce "["+.mobs_left+"/200] mobs left.",bc_map;
			}
			end;
			}
			end;
}

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.01
  • Content Count:  31
  • Reputation:   0
  • Joined:  01/09/21
  • Last Seen:  

 

Anyone can help please please /sob

Hi @raccae thanks for responding!

I am trying to study and apply the solution you provided but I am getting this error after compiling

image.png.bac8a997023a88fa34f70fb4a30d8442.png

 

Here's the lines that I added as you advised after the World Boss Script

image.png.a33f14066194a6932ac32a7617d5459e.png

 

I am checking my doc\script_commands.txt as @Emistry advised on this topic https://rathena.org/board/topic/129505-error-function-cloaknpc/ and everything seems to be fine on script commands

 

Update: So I've been testing it here and there and finally able to make it work.

I replace the line:

cloakoffnpc;

to this:

cloakoffnpc "World Boss Treasure#wb";

Thank you Sir @Racaae This is what exactly what I'm looking for and it works like charm. /kis2/thx

Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  250
  • Reputation:   114
  • Joined:  06/02/12
  • Last Seen:  

Hi!

Find:

getitem .ItemID,1; //Change the [5] to the amount you wish to hand out.

Replaee with:

getunitdata killedgid, .@data;
unitwarp getnpcid(0, "World Boss Treasure#wb"), mapid2name(.@data[UMOB_MAPID]), .@data[UMOB_X], .@data[UMOB_Y];
donpcevent "World Boss Treasure#wb::OnReward";

 

Then add this NPC at the end of the file:

Spoiler
prontera,0,0,0	script	World Boss Treasure#wb	4_TREASURE_BOX,{
	if (inarray(.wb_treasure[0], getcharid(3)) != -1) {
		mes "^FF0000The treasure box is empty.";	
		close;
	}
	if (checkweight(1201,1) == 0 || MaxWeight - Weight < 1000) {
		mes "- Currently you're carrying -";
		mes "- too many items with you. -";
		mes "- Please try again after you -";
		mes "- lose some weight. -";
		close;
	}
	progressbar "ffff00", 10;
	specialeffect EF_COIN;
	setarray .wb_treasure[getarraysize(.wb_treasure)], getcharid(3);
	
	//Change the [20] to the amount you wish to hand out
	getitem getvariableofnpc(.ItemID,"Invasion NPC"), 20;
	end;

OnReward:
	deletearray .wb_treasure[0];
	cloakoffnpc;
	initnpctimer;
	end;

OnTimer60000:
	cloakonnpc;
	stopnpctimer;
	end;
}

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.01
  • Content Count:  31
  • Reputation:   0
  • Joined:  01/09/21
  • Last Seen:  

Question: How can I populate the Treasure boxes? I would like it to be 3 or 4 treasure boxes and how can I make it spawn scattered on the area where the Boss dies instead of putting it in the exact cell location of the boss? 

 

Update: So once again, I was able to find answer/solution to my problem. We can consider this issue resolved.

Edited by CyanZoldyck
Resolved
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...