Jump to content
  • 0

Need help with the script for invasion event


Ruhn

Question


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   1
  • Joined:  04/15/20
  • Last Seen:  

	OnOdinDead:
		killmonster "odin_tem03","OdinTempInvasion::OnInvasionOdin";
		killmonster "prontera","OdinTempInvasion::OnInvasionOdin";
		announce "["+ strcharinfo(0) +"] has slain "+ getmonsterinfo(killedrid, MOB_NAME), bc_all;

		// Reward tracking
		MVPKills = MVPKills + 3;
		dispbottom "---------------------------------------------------";
		dispbottom "You killed a total of "+MVPKills+" MVP"+((MVPKills == 1)?"":"s")+".";
		#mvp_points += 3;
		dispbottom "You've gained three points! Your total is ["+#mvp_points+"] MvP point(s).";
		dispbottom "---------------------------------------------------";

		// Drop items around boss location
		set @item_id, 512; // 
		set @drop_count, 10;
		set @x, 113;
		set @y, 71;
		set @i, 0;
		while (@i < @drop_count) {
			set @dx, @x + rand(-3,3);
			set @dy, @y + rand(-3,3);
			makeitem @item_id, 1, "odin_tem03", @dx, @dy;
			set @i, @i + 1;
		}

		// Drop items around boss
		set @item_id, 512;
		set @drop_count, 10;
		set @x, 113;
		set @y, 71;
		set @i, 0;
		while (@i < @drop_count) {
			set @dx, @x + rand(-3,3);
			set @dy, @y + rand(-3,3);
			makeitem @item_id, 1, "odin_tem03", @dx, @dy;
			set @i, @i + 1;
		}

		// Distribute rewards
		set @players, mobcountunitdmg(killedrid, 0);
		set @item_reward, 1;
		set @highest_dmg, 0;
		set @highest_dmg_id, 0;
		set @i, 0;
		while (@i < @players) {
			set @char_id, getunitdmginfo(killedrid, @i, 2);
			set @account_id, getunitdmginfo(killedrid, @i, 0);
			set @dmg, getunitdmginfo(killedrid, @i, 1);

			if (@dmg > @highest_dmg) {
				set @highest_dmg, @dmg;
				set @highest_dmg_id, @account_id;
			}

			if (attachrid(@char_id)) {
				getitem @item_id, @item_reward;
				detachrid;
			}
			set @i, @i + 1;
		}

		// Double reward to highest damage dealer
		if (attachrid(getcharid(3, @highest_dmg_id))) {
			getitem @item_id, @item_reward;
			detachrid;
		}

		// Double reward to last hitter (current player)
		getitem @item_id, @item_reward;

		end;
}

Why am I getting an error on this script? Can someone help me in fixing the script here?
See attached screenshot for the error.
image.png.e0642fc65ed636dcf35d63a8ebc94ef6.png

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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

The commands/functions getunitdmginfo and mobcountunitdmg are custom. These commands are not part of the default scripting commands, you need to add (or remove) them so the script can work.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   1
  • Joined:  04/15/20
  • Last Seen:  

6 hours ago, Racaae said:

The commands/functions getunitdmginfo and mobcountunitdmg are custom. These commands are not part of the default scripting commands, you need to add (or remove) them so the script can work.

do we have an alternative for those functions?

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