Jump to content
  • 0

Instance map-only reward


Mistique

Question


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   0
  • Joined:  09/15/12
  • Last Seen:  

Hi all!

I'm using a custom instance of Alanye and I'm wondering if it's possible to set the reward function to not be given to characters outside of the instance maps? 

Right now, party members not in the map get the same reward as party members in it.  As you can imagine this is quite troublesome because they can just hoard the coins with double clients.

What should I be changing? Here are the reward scripts.

Thank you! Help would be much appreciated! ❤️ 

OnFinished:

	instance_announce instance_id(), "Congratulation! You have completed the challenge!",bc_map,"0x00ff99";
				sleep2 2000;						
				instance_announce instance_id(), "You'll soon be warped to Valhalla",bc_map,"0x00ff99";
				sleep2 2000;
				instance_destroy AA_INSTANCE_ID;
				getpartymember getcharid(1),2;
				copyarray .@partymemberaid, $@partymemberaid, $@partymembercount;
				detachrid;
				for ( set .@i, 0; .@i < $@partymembercount; set .@i, .@i +1 ) {
					if (attachrid(.@partymemberaid[.@i]))
					{
						callfunc("AddPointsFixed", getcharid(3), 1 * $difficulty_level);
						set AARENA, AARENA + 1;
						warp "valkyrie",49,48;
	
					}
				}
				
				getpartymember getcharid(1),2;
				for( set .@i, 0; .@i < $@partymembercount; set .@i, .@i+1 )
					if( attachrid( $@partymemberaid[.@i] ) && AA_INSTANCE_ID > 0){
						set AA_INSTANCE_ID, -1;
					}
			}

 

function	script	AddPointsFixed	{
if(instance_mapname(strcharinfo(3)) != instance_mapname("1@va") ){end;}
	set .@accountID, getarg(0);
	set .@amount, getarg(1);
 
	getitem 677, 3;
  	message rid2name(.@accountID), "[ Instance ] : You've obtained 3 Coin(s) for completing instance!";
	return;
}

 

Edited by Mistique
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

https://github.com/rathena/rathena/blob/120ffc122bf8b0d36ba2a9b6f7ad62ac75e2513e/doc/script_commands.txt#L8930

---------------------------------------

*instance_mapname("<map name>"{,<instance id>})

Returns the unique name of the instanced map. If no instance ID is specified,
the instance the script is attached to is used. If that fails, the command
returns an empty string instead.

---------------------------------------

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   0
  • Joined:  09/15/12
  • Last Seen:  

On 5/10/2019 at 9:23 AM, sader1992 said:

https://github.com/rathena/rathena/blob/120ffc122bf8b0d36ba2a9b6f7ad62ac75e2513e/doc/script_commands.txt#L8930


---------------------------------------

*instance_mapname("<map name>"{,<instance id>})

Returns the unique name of the instanced map. If no instance ID is specified,
the instance the script is attached to is used. If that fails, the command
returns an empty string instead.

---------------------------------------

 

Thanks Sader, I tried that! But I don't really want to define a fixed map name- instead have the reward function adapt whatever map is currently active as instance for the party. The function npc is working for different scripts/instances so I'm wondering if I can make it read multiple maps? i.e 1@tower, 2@new, 1@bnest, 1@nyd, etc?

Sorry for necro bumping but still looking for a solution for this. ? 

Still looking to get this fixed. Willing to pay if need be.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  81
  • Reputation:   14
  • Joined:  11/17/17
  • Last Seen:  

@Mistique Hi, try this code

function	script	AddPointsFixed	{
	.@map$ = instance_mapname(strcharinfo(3));
	if (compare(.@map$, "@")) {
		set .@accountID, getarg(0);
		set .@amount, getarg(1);
	 
		getitem 677, 3;
	  	message rid2name(.@accountID), "[ Instance ] : You've obtained 3 Coin(s) for completing instance!";
	}
	return;	
}

There are many ways to do this, but since each instance has different code, if you have a special instance, you have to do it separately.

Edited by rongmauhong
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   0
  • Joined:  09/15/12
  • Last Seen:  

28 minutes ago, rongmauhong said:

@Mistique Hi, try this code


function	script	AddPointsFixed	{
	.@map$ = instance_mapname(strcharinfo(3));
	if (compare(.@map$, "@")) {
		set .@accountID, getarg(0);
		set .@amount, getarg(1);
	 
		getitem 677, 3;
	  	message rid2name(.@accountID), "[ Instance ] : You've obtained 3 Coin(s) for completing instance!";
	}
	return;	
}

There are many ways to do this, but since each instance has different code, if you have a special instance, you have to do it separately.

Hey, thanks! I've tried it, but unfortunately it doesn't work. ? Both characters still get warped to valkyrie (even the one outside the instance map), but neither of them get an item rewards.

I should add the map does have a '@' in it like all instance maps, so that can't be the problem.

Edited by Mistique
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...