Jump to content
  • 0

Need help script summon monster [SOLVED]


Yaziid91

Question


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  66
  • Reputation:   0
  • Joined:  04/20/19
  • Last Seen:  

askald,166,237,1	script	The Dimensions Tournament.	110,{
set .@npc$,"^F904EA[ Human King ]^000000";
{
switch( select( "I would like more information", "Let's go" ) ) {
	case 1:
			mes .@npc$;
			mes "In a remote corner of the world of Midgard, a mysterious rift has opened, connecting our world to another dimension populated by fearsome human warriors. These warriors, coming from a parallel universe called Terra Nova, have skills and powers different from those known in Midgard. ";
			next;
			mes .@npc$;
			mes "Their abilities often surpass those of our world's greatest heroes. An ancient prophecy says that these interdimensional warriors would be drawn to tournaments of strength and honor. So the king of Prontera, eager to test the bravery and skill of the adventurers of Midgard, organized a great tournament called The Tournament of Dimensions.";
			next;
			mes .@npc$;
			mes "Each of these warriors has a unique strength and ability that makes them formidable. However, each victory against one of these fighters guarantees the winning hero a reward of";
			next;
			mes .@npc$;
			mes "Registration for the tournament is open to all adventurers brave enough to challenge these fighters from another world. Rumors have it that the ultimate winner will receive not only a vast fortune in zeny, but also an artifact from Terra Nova, an item of immeasurable power capable of changing the course of Midgard's history.";
			close;			
			
		case 2:
			mes .@npc$;
			mes "I'm counting on you !";
			next;
			warp "cell_game",150,143;	
			end;
			close;
				
	}
	close;
	end;
	}
	}	

Hello, I would like to create a script that allows one player at a time to enter a room. Inside, there is an NPC that lets the player choose a monster to summon in exchange for an item. If the monster is defeated, it drops zeny.

Thanks

Edited by Yaziid91
SOLVED
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 1

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

Hello

//===== rAthena Script =======================================
//= https://rathena.org/board/topic/142407-need-help-script-summon-monster/
//= Modified from AnnieRuru's Private MVP & Branch Room
//============================================================

askald,166,237,1	script	The Dimensions Tournament	110,{
	set .@npc$,"^F904EA[ Human King ]^000000";

	switch( select( "I would like more information", "Let's go" ) ) {
		case 1:
			mes .@npc$;
			mes "In a remote corner of the world of Midgard, a mysterious rift has opened, connecting our world to another dimension populated by fearsome human warriors.";
			next;
			mes .@npc$;
			mes "These warriors, coming from a parallel universe called ^FF7700Terra Nova^000000, have skills and powers different from those known in Midgard. ";
			next;
			mes .@npc$;
			mes "Their abilities often surpass those of our world's greatest heroes. An ancient prophecy says that these interdimensional warriors would be drawn to tournaments of strength and honor.";
			next;
			mes .@npc$;
			mes "So the king of Prontera, eager to test the bravery and skill of the adventurers of Midgard, organized a great tournament called The ^FF0000Tournament of Dimensions^000000.";
			next;
			mes .@npc$;
			mes "Each of these warriors has a unique strength and ability that makes them formidable. However, each victory against one of these fighters guarantees the winning hero a reward of";
			next;
			mes .@npc$;
			mes "Registration for the tournament is open to all adventurers brave enough to challenge these fighters from another world.";
			next;
			mes .@npc$;
			mes "Rumors have it that the ultimate winner will receive not only a vast fortune in zeny, but also an artifact from Terra Nova, an item of immeasurable power capable of changing the course of Midgard's history.";
			close;	
		case 2:
			mes .@npc$;
			if (.warped) {
				mes "I already sent a hero through the rift.";
				mes "We need to wait for their return so I can send someone else.";
				close;
			}
			mes "I'm counting on you !";
			close2;
			warp "cell_game",150,143;	
			.warped = true;
			initnpctimer;
			end;
		}
	end;

OnTimer30000:
	stopnpctimer;
	if (getmapusers("cell_game"))
		initnpctimer;
	else
		.warped = false;	
	end;
}

cell_game,155,150,5	script	Human King?	110,{
	if ( mobcount( "this", strnpcinfo(3)+"::OnMobDead" ) ) {
		npctalk strnpcinfo(1) + " : Defeat the Warrior!";
		end;
	}
	mes "^808080[ Human King? ]^000000";
	mes "You are here, finally!";
	next;
	switch ( select( "Tournament of Dimensions", "Return to our world") ) {
	case 1:
		if ( mobcount( "this", strnpcinfo(3)+"::OnMobDead" ) ) {
			mes "^808080[ Human King? ]^000000";
			mes "I cannot summon another MVP when there are monsters around.";
			close;
		} else if ( .cost_id ) {
			mes "^808080[ Human King? ]^000000";
			mes "The cost to summon an Warrior is "+ F_InsertComma(.cost_amt) + " " + mesitemlink(.cost_id) + ".";;
			next;
			set .@menu, select(.mvpid_menu$) -1;
			mes "^808080[ Human King? ]^000000";
			if (countitem(.cost_id) < .cost_amt ) {
				mes "You don't have the item.";
				close;
			}
		} else {
			set .@menu, select(.mvpid_menu$) -1;
			mes "^808080[ Human King? ]^000000";
		}
		mes "Please get ready.";
		specialeffect EF_MAP_MAGICZONE4;
		close2;
		if ( countitem(.cost_id) < .cost_amt ) end;
		delitem .cost_id, .cost_amt;
		monster "this", 0, 0, "--ja--", .mvpid[.@menu], 1, strnpcinfo(3)+"::OnMobDead";
		sleep 3000;
		removespecialeffect EF_MAP_MAGICZONE4;
		end;
	case 2:
		mes "^808080[ Human King? ]^000000";
		mes "Are you sure you want to leave?";
		next;
		if ( select( "Yes:No") == 1 )
			warp .respawnmap$, .respawnx, .respawny;
		close;
	}

OnMobDead:
	.@i  = rand(.zeny_reward_min, .zeny_reward_max);
	Zeny += .@i;
	mapannounce strnpcinfo(4), strnpcinfo(1) + " : The Warrior dropped " + F_InsertComma(.@i) + "z!", 0;
	end;

OnInit:

//	Config ---------------------------------------------------------------------------------------

	set .cost_id, 909;	// Item ID to summon an MVP
	set .cost_amt, 6;	// Item amount to summon an MVP

	.zeny_reward_min = 100000; // Minimum Zeny reward
	.zeny_reward_max = 999999; // Maximum Zeny reward

	setarray .mvpid[0],
		1647,// Assassin Cross Eremes
		1649,// High Priest Magaleta
		1651,// High Wizard Katrinn
		1646,// Lord Knight Seyren
		1650,// Sniper Shecil
		1648,// Whitesmith Harword
		1658;//	Ygnizem

	// Respawn point when players leave
	set .respawnmap$, "askald";
	set .respawnx, 162;
	set .respawny, 237;

//	Config Ends ------------------------------------------------------------------------
	.@size = getarraysize( .mvpid );
	for ( .@i = 0; .@i < .@size; .@i++ )
		.mvpid_menu$ = .mvpid_menu$ + getmonsterinfo( .mvpid[.@i], MOB_NAME ) +":";

	mapannounce strnpcinfo(4), "An administrator has refreshed the server. Please re-register this room.", bc_map;
	mapwarp strnpcinfo(4), .respawnmap$, .respawnx, .respawny;
	end;
}

 

Link to comment
Share on other sites

  • 1

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

4 hours ago, Yaziid91 said:

I would like to know if it is possible to summon each monster only once per hour.

It is possible, using a variable to track when the monster was summoned.

cell_game,155,150,5	script	Human King?	4_M_MINISTER,{
	if ( mobcount( "this", strnpcinfo(3)+"::OnMobDead" ) ) {
		npctalk strnpcinfo(1) + " : Defeat the Warrior!";
		end;
	}
	mes "^808080[ Human King? ]^000000";
	mes "You are here, finally!";
	next;
	switch ( select( "Tournament of Dimensions", "Return to our world") ) {
	case 1:
		for ( .@i = 0; .@i < getarraysize( .mvpid ); .@i++ ) {
			if (getd("TournamentD_" + .mvpid[.@i]) < gettimetick(2)) {
				.@mvpid_menu$ += strmobinfo(1, .mvpid[.@i]);
				.@ok = true;
			}
			.@mvpid_menu$ += ":";
		}
		if (.@ok == false) {
			for ( .@i = 0; .@i < getarraysize( .mvpid ); .@i++ )
				.@my_coldown[.@i] = getd("TournamentD_" + .mvpid[.@i]);
			mes "^808080[ Human King? ]^000000";
			mes "You defeated all available warriors!";
			mes "You can participate again when a warrior resurfaces in ^0000FF" + Time2Str(min(.@my_coldown)) + "^000000.";
			close;
		}

		if ( .cost_id ) {
			mes "^808080[ Human King? ]^000000";
			if (.itemlink)
				mes "The cost to summon a Warrior is "+ F_InsertComma(.cost_amt) + " " + mesitemlink(.cost_id) + ".";
			else
				mes "The cost to summon a Warrior is ^0000FF"+ F_InsertComma(.cost_amt) + " " + getitemname(.cost_id) + "^000000.";
			next;
			set .@menu, select(.@mvpid_menu$) -1;
			mes "^808080[ Human King? ]^000000";
			if (countitem(.cost_id) < .cost_amt ) {
				mes "You don't have the item.";
				close;
			}
		} else {
			set .@menu, select(.@mvpid_menu$) -1;
			mes "^808080[ Human King? ]^000000";
		}
		mes "Please get ready.";
		specialeffect EF_MAP_MAGICZONE4;
		close2;
		if ( countitem(.cost_id) < .cost_amt ) end;
		delitem .cost_id, .cost_amt;
		monster "this", 0, 0, "--en--", .mvpid[.@menu], 1, strnpcinfo(3)+"::OnMobDead";
		setd "TournamentD_" + .mvpid[.@menu], gettimetick(2) + .cooldown;
		sleep 3000;
		removespecialeffect EF_MAP_MAGICZONE4;
		end;
	case 2:
		mes "^808080[ Human King? ]^000000";
		mes "Are you sure you want to leave?";
		next;
		if ( select( "Yes", "No") == 1 )
			warp .respawnmap$, .respawnx, .respawny;
		close;
	}

OnMobDead:
	.@i  = rand(.zeny_reward_min, .zeny_reward_max);
	Zeny += .@i;
	mapannounce strnpcinfo(4), strnpcinfo(1) + " : The Warrior dropped " + F_InsertComma(.@i) + "z!", 0;
	end;

OnInit:

//	Config ---------------------------------------------------------------------------------------

	.itemlink = false;	//use item link system?
	.cooldown = 3000;	//seconds to wait to summon again (3000=1 hour)
	.cost_id = 909;		// Item ID to summon
	.cost_amt = 6;		// Item amount to summon
	.zeny_reward_min = 100000; // Minimum Zeny reward
	.zeny_reward_max = 999999; // Maximum Zeny reward

	setarray .mvpid[0],
		1647,// Assassin Cross Eremes
		1649,// High Priest Magaleta
		1651,// High Wizard Katrinn
		1646,// Lord Knight Seyren
		1650,// Sniper Shecil
		1648,// Whitesmith Harword
		1658;//	Ygnizem

	// Respawn point when players leave
	set .respawnmap$, "askald";
	set .respawnx, 162;
	set .respawny, 237;

//	Config Ends ------------------------------------------------------------------------

	mapannounce strnpcinfo(4), "An administrator has refreshed the server. Please re-register this room.", bc_map;
	mapwarp strnpcinfo(4), .respawnmap$, .respawnx, .respawny;
	end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  66
  • Reputation:   0
  • Joined:  04/20/19
  • Last Seen:  

Thank you, it works very well. I had to hide the line //

mes "The cost to summon a Warrior is "+ F_InsertComma(.cost_amt) + " " + mesitemlink(.cost_id) + ".";

I don't know why this caused a problem here.

I would like to know if it is possible to summon each monster only once per hour.

Edited by Yaziid91
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  66
  • Reputation:   0
  • Joined:  04/20/19
  • Last Seen:  

Thanks you dear all is work !

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