Jump to content
  • 0

How to add more Tier Reward? Help pls!


Musika6988

Question


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

Can anyone please help me on how to add more Sets of Tier Reward in this script?

I got everything all working fine, it's just that, I want this to be like, everytime OnBoxKill 1324, a random set of Tier Rewards will be shown instead of the same set over and over.

Instead of every OnBoxKill 1324: setarray .tier_reward_0,7227,30804,30805,30806,30000,30001; that is the only Set of Tier Reward it has..

was hoping that it has a random % chance maybe of selecting different Set of Tier Rewards to be distributed for Ex::

setarray .tier_reward_1,7227,7227,7227,7227,7227,7227;

setarray .tier_reward_2,30804,30804,30804,30804,30804,30804;

setarray .tier_reward_4,30805,30805,30805,30805,30805,30805;

Something like that?

And, how do I include the name of the Party Leader on the:

announce "[World Boss] The "+getpartyname(getcharid(1))+" Hunting Party killed the World Boss! Congratulations!", bc_all, 0xFF0000;

Thanks in advanced!
   

-    script    WorldBoss    -1,{

OnTalk:
    .@party_id = getcharid(1);
    .@map$ = strcharinfo(3);
    .@label$ = @label$;
    
    if( getcharid(0) != getpartyleader( .@party_id,2 ) ){
        message strcharinfo(0),"You're not Party Leader.";
        monster .@map$,rand(.@x,.@x-3),rand(.@y-3,.@y),"--ja--",1324,1,.@label$;
        end;
    }else{
        mes "[Loot Distributor]";
        mes "Please ensure you distribute the Rewards. If you cancelled this, your party might not able to receive any rewards.";
        next;
        mes "Reward List :";
        for( .@i = 0; .@i < @size; .@i++ )
            mes "^777777 ~ "+getitemname( @reward[.@i] )+"^000000";
        if( prompt( "Distribute Loots","Dispose Loots" ) == 1 ){
            getpartymember .@party_id;
            getpartymember .@party_id,1;
            .@party_size = $@partymembercount;
            copyarray .@party_aid[0],$@partymemberaid[0],.@party_size;
            copyarray .@party_name$[0],$@partymembername$[0],.@party_size;
            for( .@i = 0; .@i < $@partymembercount; .@i++ ){
                if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
                    .@party_name_menu$ = .@party_name_menu$ + $@partymembername$[.@i];
                .@party_name_menu$ = .@party_name_menu$ +":";
            }
            for( .@i = 0; .@i < @size; .@i++ ){
                next;
                mes "^777777 ~ "+getitemname( @reward[.@i] )+"^000000";
                if( prompt( "Cast Loots" ) == 1 ){
                    .@name = rand( .@party_size );
                    message .@party_name$[.@name],"Gained "+getitemname( @reward[.@i] )+" ( Distributed Randomly )";
                }
                getitem @reward[.@i],1,.@party_aid[.@name];
            }
        }
        mes "Congratulations!";
        mapannounce .@map$,"All Rewards have been distributed.",0;
        end;
    }

OnClock1159:
OnClock2359:
    set .RandMap,rand( getarraysize( .Map$ ) );
    set .RandMVP,rand( getarraysize( .MVP ) );
    killmonster .Map$,"All";
    .@mins = .sleep / 60000;
    announce "[World Boss] A rift on time and space is about to be opened! A World Boss will appear in " + .@mins + " minute! Prepare your Hunting Party!", bc_all, 0xFF0000;
    sleep .sleep;
    monster .Map$[ .RandMap ],0,0,"World Boss",.MVP[ .RandMVP ],1,strnpcinfo(0)+"::OnKilled";
    announce "[World Boss] A World Boss "+getmonsterinfo( .MVP[ .RandMVP ],0 )+" appeared in "+.Map$[ .RandMap ]+" to wreck havoc!! Form a Hunting Party and stop it!!", bc_all, 0xFF0000;    end;
    end;
    
OnKilled:
    announce "[World Boss] The "+getpartyname(getcharid(1))+" Hunting Party killed the World Boss! Congratulations!", bc_all, 0xFF0000;
    getmapxy(.@map$,.@x,.@y,0);
    monster .@map$,rand(.@x,.@x-3),rand(.@y-3,.@y),"--ja--",1324,1,.npc_name$+"::OnBoxKill";
    end;

OnBoxKill:
    deletearray @reward;
    @label$ = .npc_name$+"::OnBoxKill";
    @size = getd( ".tier_reward_"+.tier+"_size" );
    copyarray @reward[0],getd( ".tier_reward_"+.tier+"[0]" ),@size;
    doevent "WorldBoss::OnTalk";
    end;

OnInit:
    // tier reward
    setarray .tier_reward_0,7227,30804,30805,30806,30000,30001;
    .tier_reward_0_size = getarraysize( .tier_reward_0 );
    setarray .Map$[0],"prontera","morocc","geffen","payon","alberta","aldebaran","xmas","comodo","yuno","amatsu","gonryun","umbala","louyang","ayothaya","eibroch","hugel","rachel","veins","moscovia";
    setarray .MVP[0],3165,3166,3167,3169,3175,3177;
    .sleep = 60000;         // 60000ms = 1min
    .npc_name$ = strnpcinfo(0);    
    setmapflag .map$,mf_partylock;
    setmapflag .map$,mf_nomobloot;
    setmapflag .map$,mf_nomvploot;
    end;
}

 

Link to comment
Share on other sites

18 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

On 13.2.2018 at 1:35 PM, Musika6988 said:

I got this error Sir Sehrentos..

Ops, there was a typo in the sample. Here is fixed version:

@size = getarraysize(getd(".tier_reward_"+@range));
copyarray @reward[0], getd(".tier_reward_"+@range+"[0]"), @size;

And i think the setarray should be like this:

setarray .tier_reward_0[0],7227,30804,30805,30806,30000,30001;
setarray .tier_reward_1[0],7227,7227,7227,7227,7227,7227;
setarray .tier_reward_2[0],30804,30804,30804,30804,30804,30804;
setarray .tier_reward_4[0],30805,30805,30805,30805,30805,30805;

2. How come it does not give all the rewards?

Script only reward one random party member. Reward is also random from the .tier_reward_0-3

Or did you mean to give all rewards from the .tier_reward_X array and not just one? If so, im sorry i got the wrong idea.

I'm currently unable to test it, because i don't have a running emulator.

 

Edited by Sehrentos
Typo
Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

Hi!

Suggestion 1. This needs a fallback. If you cancel this prompt, then .@name does not exist.

Quote

if ( prompt( "Cast Loots" ) == 1 ) {
    .@name = rand( .@party_size );
    message .@party_name$[.@name],"Gained "+getitemname( @reward[.@i] )+" ( Distributed Randomly )";
}
getitem @reward[.@i],1,.@party_aid[.@name];

Suggestion 2. For the random tier set you can try this

OnInit:
    // tier rewards
    setarray .tier_reward_0,7227,30804,30805,30806,30000,30001;
    setarray .tier_reward_1,7227,7227,7227,7227,7227,7227;
    setarray .tier_reward_2,30804,30804,30804,30804,30804,30804;
    setarray .tier_reward_3,30805,30805,30805,30805,30805,30805;
OnBoxKill:
    deletearray @reward;
    @label$ = .npc_name$+"::OnBoxKill";
    //@size = getd( ".tier_reward_"+.tier+"_size" );
    //copyarray @reward[0],getd( ".tier_reward_"+.tier+"[0]" ),@size;
	
    // Select random tier set range 0-3
    @range = rand(4);
    @size = getarraysize(getd(".tier_reward_"+@range));
    copyarray @reward[0], getd(".tier_reward_"+@range+"[0]"), @size;

    doevent "WorldBoss::OnTalk";
    end;

Suggestion 3. For the party leader name. With this you can add .@leader_name$ in the announce string.

.@party_id = getcharid(1);
.@party_name$ = getpartyname(.@party_id);
.@leader_id = getpartyleader(.@party_id, 2);
.@leader_name$ = strcharinfo(0, .@leader_id);
announce "[World Boss] The "+.@party_name$+" Hunting Party killed the World Boss! Congratulations!", bc_all, 0xFF0000;

I hope these help

Edited by Sehrentos
Fix typo2
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

20 hours ago, Sehrentos said:

Hi!

Suggestion 1. This needs a fallback. If you cancel this prompt, then .@name does not exist.

Suggestion 2. For the random tier set you can try this


OnInit:
    // tier rewards
    setarray .tier_reward_0,7227,30804,30805,30806,30000,30001;
    setarray .tier_reward_1,7227,7227,7227,7227,7227,7227;
    setarray .tier_reward_2,30804,30804,30804,30804,30804,30804;
    setarray .tier_reward_3,30805,30805,30805,30805,30805,30805;

OnBoxKill:
    deletearray @reward;
    @label$ = .npc_name$+"::OnBoxKill";
    //@size = getd( ".tier_reward_"+.tier+"_size" );
    //copyarray @reward[0],getd( ".tier_reward_"+.tier+"[0]" ),@size;
	
    // Select random tier set range 0-3
    @range = rand(4);
    @size = getarraysize(getd(".tier_reward_"+@range);
    copyarray @reward[0], getd(".tier_reward_"+@range+"[0]"), @size);

    doevent "WorldBoss::OnTalk";
    end;

Suggestion 3. For the party leader name. With this you can add .@leader_name$ in the announce string.


.@party_id = getcharid(1);
.@party_name$ = getpartyname(.@party_id);
.@leader_id = getpartyleader(.@party_id, 2);
.@leader_name$ = strcharinfo(0, .@leader_id);
announce "[World Boss] The "+.@party_name$+" Hunting Party killed the World Boss! Congratulations!", bc_all, 0xFF0000;

I hope these help

THANK YOU SOO MUCH SIR SEHRENTOS!! EMMA GIVE THIS A TRY!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

6otg9G5.png

I got this error Sir Sehrentos..

And..

How come it does not give all the rewards?

Some reward goes missing and other PT Member didn't get any reward at all.

 

Edited by Musika6988
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

23 hours ago, Sehrentos said:

Ops, there was a typo in the sample. Here is fixed version:


@size = getarraysize(getd(".tier_reward_"+@range));
copyarray @reward[0], getd(".tier_reward_"+@range+"[0]"), @size;

And i think the setarray should be like this:


setarray .tier_reward_0[0],7227,30804,30805,30806,30000,30001;
setarray .tier_reward_1[0],7227,7227,7227,7227,7227,7227;
setarray .tier_reward_2[0],30804,30804,30804,30804,30804,30804;
setarray .tier_reward_4[0],30805,30805,30805,30805,30805,30805;

2. How come it does not give all the rewards?

Script only reward one random party member. Reward is also random from the .tier_reward_0-3

Or did you mean to give all rewards from the .tier_reward_X array and not just one? If so, im sorry i got the wrong idea.

I'm currently unable to test it, because i don't have a running emulator.

 

Ow okay Sir Sehrentos! Thanks for this emma try this out!

My other problem now is that, it doesnt give any rewards anymore after I cast the loots with my party members. It only says on the screen "Gained TCG" but it doesn't give any items at all.. Anyways, I'll wait for your update just incase! Thanks so much for helping out on this!^_^

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

6 hours ago, Musika6988 said:

bump for this~

Hey

Does your console provide any error messages ?

Can i see your edited version of the file ?

Here is mine:

-	script	WorldBoss	-1,{

OnTalk:
	.@party_id = getcharid(1);
	.@map$ = strcharinfo(3);
	.@label$ = @label$;
	
	if( getcharid(0) != getpartyleader( .@party_id,2 ) ){
		message strcharinfo(0), "You're not Party Leader.";
		monster .@map$, rand(.@x,.@x-3), rand(.@y-3,.@y), "--ja--", 1324, 1, .@label$;
		end;
	} else {
		mes "[Loot Distributor]";
		mes "Please ensure you distribute the Rewards. If you cancelled this, your party might not able to receive any rewards.";
		next;
		mes "Reward List :";
		for( .@i = 0; .@i < @size; .@i++ )
			mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
		if( prompt( "Distribute Loots", "Dispose Loots" ) == 1 ){
			getpartymember .@party_id;
			getpartymember .@party_id,1;
			.@party_size = $@partymembercount;
			copyarray .@party_aid[0], $@partymemberaid[0], .@party_size;
			copyarray .@party_name$[0], $@partymembername$[0], .@party_size;
			for( .@i = 0; .@i < $@partymembercount; .@i++ ){
				if( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
					.@party_name_menu$ = .@party_name_menu$ + $@partymembername$[.@i];
				.@party_name_menu$ = .@party_name_menu$ + ":";
			}
			for( .@i = 0; .@i < @size; .@i++ ){
				next;
				mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
				.@name = rand( .@party_size );
				if( prompt( "Cast Loots" ) == 1 ) {
					//.@name = rand( .@party_size );
					message .@party_name$[.@name], "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
					getitem @reward[.@i], 1, .@party_aid[.@name];

					// DEBUG
					debugmes .@label$ + " Cast Loots! reward=" + @reward[.@i] + ", party_aid=" + .@party_aid[.@name];
				}
				//getitem @reward[.@i],1,.@party_aid[.@name];
			}
		}
		mes "Congratulations!";
		mapannounce .@map$, "All Rewards have been distributed.", 0;
		end;
	}

OnClock1159:
OnClock2359:
	set .RandMap, rand( getarraysize( .Map$ ) );
	set .RandMVP, rand( getarraysize( .MVP ) );
	killmonster .Map$, "All";
	.@mins = .sleep / 60000;
	announce "[World Boss] A rift on time and space is about to be opened! A World Boss will appear in " + .@mins + " minute! Prepare your Hunting Party!", bc_all, 0xFF0000;
	sleep .sleep;
	monster .Map$[ .RandMap ], 0, 0, "World Boss", .MVP[ .RandMVP ], 1, strnpcinfo(0) + "::OnKilled";
	announce "[World Boss] A World Boss " + getmonsterinfo( .MVP[ .RandMVP ], 0 ) + " appeared in " + .Map$[ .RandMap ] + " to wreck havoc!! Form a Hunting Party and stop it!!", bc_all, 0xFF0000;
	end;
	
OnKilled:
	.@party_id = getcharid(1);
	.@party_name$ = getpartyname(.@party_id);
	.@leader_id = getpartyleader(.@party_id, 2);
	.@leader_name$ = strcharinfo(0, .@leader_id);
	announce "[World Boss] The " + .@party_name$ + " Hunting Party killed the World Boss! Congratulations!", bc_all, 0xFF0000;
	//announce "[World Boss] The "+getpartyname(getcharid(1))+" Hunting Party killed the World Boss! Congratulations!", bc_all, 0xFF0000;
	getmapxy(.@map$, .@x, .@y, 0);
	monster .@map$, rand(.@x, .@x-3), rand(.@y-3, .@y), "--ja--", 1324, 1, .npc_name$ + "::OnBoxKill";
	end;

OnBoxKill:
	deletearray @reward;
	@label$ = .npc_name$ + "::OnBoxKill";
	//@size = getd( ".tier_reward_"+.tier+"_size" );
	//copyarray @reward[0],getd( ".tier_reward_"+.tier+"[0]" ),@size;

	// Select random tier set from a range 0-3
	@range = rand(0, 3);
	@size = getd( ".tier_reward_" + @range + "_size" );
	//@size = getarraysize(getd(".tier_reward_" + @range));
	copyarray @reward[0], getd(".tier_reward_" + @range + "[0]"), @size;

	//doevent "WorldBoss::OnTalk";
	doevent .npc_name$ + "::OnTalk";
	end;

OnInit:
	// tier reward
	setarray .tier_reward_0,7227,30804,30805,30806,30000,30001;
	setarray .tier_reward_1,7227,7227,7227,7227,7227,7227;
	setarray .tier_reward_2,30804,30804,30804,30804,30804,30804;
	setarray .tier_reward_3,30805,30805,30805,30805,30805,30805;

	.tier_reward_0_size = getarraysize( .tier_reward_0 );
	.tier_reward_1_size = getarraysize( .tier_reward_1 );
	.tier_reward_2_size = getarraysize( .tier_reward_2 );
	.tier_reward_3_size = getarraysize( .tier_reward_3 );
	
	setarray .Map$[0],"prontera","morocc","geffen","payon","alberta","aldebaran","xmas","comodo","yuno","amatsu","gonryun","umbala","louyang","ayothaya","eibroch","hugel","rachel","veins","moscovia";
	setarray .MVP[0],3165,3166,3167,3169,3175,3177;
	.sleep = 60000;		 // 60000ms = 1min
	.npc_name$ = strnpcinfo(0);	
	setmapflag .map$,mf_partylock;
	setmapflag .map$,mf_nomobloot;
	setmapflag .map$,mf_nomvploot;
	end;
}

*debugmes - With this you can see a debug message in your server console.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

11 hours ago, Sehrentos said:

Hey

Does your console provide any error messages ?

Can i see your edited version of the file ?

Here is mine:


-	script	WorldBoss	-1,{

OnTalk:
	.@party_id = getcharid(1);
	.@map$ = strcharinfo(3);
	.@label$ = @label$;
	
	if( getcharid(0) != getpartyleader( .@party_id,2 ) ){
		message strcharinfo(0), "You're not Party Leader.";
		monster .@map$, rand(.@x,.@x-3), rand(.@y-3,.@y), "--ja--", 1324, 1, .@label$;
		end;
	} else {
		mes "[Loot Distributor]";
		mes "Please ensure you distribute the Rewards. If you cancelled this, your party might not able to receive any rewards.";
		next;
		mes "Reward List :";
		for( .@i = 0; .@i < @size; .@i++ )
			mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
		if( prompt( "Distribute Loots", "Dispose Loots" ) == 1 ){
			getpartymember .@party_id;
			getpartymember .@party_id,1;
			.@party_size = $@partymembercount;
			copyarray .@party_aid[0], $@partymemberaid[0], .@party_size;
			copyarray .@party_name$[0], $@partymembername$[0], .@party_size;
			for( .@i = 0; .@i < $@partymembercount; .@i++ ){
				if( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
					.@party_name_menu$ = .@party_name_menu$ + $@partymembername$[.@i];
				.@party_name_menu$ = .@party_name_menu$ + ":";
			}
			for( .@i = 0; .@i < @size; .@i++ ){
				next;
				mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
				.@name = rand( .@party_size );
				if( prompt( "Cast Loots" ) == 1 ) {
					//.@name = rand( .@party_size );
					message .@party_name$[.@name], "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
					getitem @reward[.@i], 1, .@party_aid[.@name];

					// DEBUG
					debugmes .@label$ + " Cast Loots! reward=" + @reward[.@i] + ", party_aid=" + .@party_aid[.@name];
				}
				//getitem @reward[.@i],1,.@party_aid[.@name];
			}
		}
		mes "Congratulations!";
		mapannounce .@map$, "All Rewards have been distributed.", 0;
		end;
	}

OnClock1159:
OnClock2359:
	set .RandMap, rand( getarraysize( .Map$ ) );
	set .RandMVP, rand( getarraysize( .MVP ) );
	killmonster .Map$, "All";
	.@mins = .sleep / 60000;
	announce "[World Boss] A rift on time and space is about to be opened! A World Boss will appear in " + .@mins + " minute! Prepare your Hunting Party!", bc_all, 0xFF0000;
	sleep .sleep;
	monster .Map$[ .RandMap ], 0, 0, "World Boss", .MVP[ .RandMVP ], 1, strnpcinfo(0) + "::OnKilled";
	announce "[World Boss] A World Boss " + getmonsterinfo( .MVP[ .RandMVP ], 0 ) + " appeared in " + .Map$[ .RandMap ] + " to wreck havoc!! Form a Hunting Party and stop it!!", bc_all, 0xFF0000;
	end;
	
OnKilled:
	.@party_id = getcharid(1);
	.@party_name$ = getpartyname(.@party_id);
	.@leader_id = getpartyleader(.@party_id, 2);
	.@leader_name$ = strcharinfo(0, .@leader_id);
	announce "[World Boss] The " + .@party_name$ + " Hunting Party killed the World Boss! Congratulations!", bc_all, 0xFF0000;
	//announce "[World Boss] The "+getpartyname(getcharid(1))+" Hunting Party killed the World Boss! Congratulations!", bc_all, 0xFF0000;
	getmapxy(.@map$, .@x, .@y, 0);
	monster .@map$, rand(.@x, .@x-3), rand(.@y-3, .@y), "--ja--", 1324, 1, .npc_name$ + "::OnBoxKill";
	end;

OnBoxKill:
	deletearray @reward;
	@label$ = .npc_name$ + "::OnBoxKill";
	//@size = getd( ".tier_reward_"+.tier+"_size" );
	//copyarray @reward[0],getd( ".tier_reward_"+.tier+"[0]" ),@size;

	// Select random tier set from a range 0-3
	@range = rand(0, 3);
	@size = getd( ".tier_reward_" + @range + "_size" );
	//@size = getarraysize(getd(".tier_reward_" + @range));
	copyarray @reward[0], getd(".tier_reward_" + @range + "[0]"), @size;

	//doevent "WorldBoss::OnTalk";
	doevent .npc_name$ + "::OnTalk";
	end;

OnInit:
	// tier reward
	setarray .tier_reward_0,7227,30804,30805,30806,30000,30001;
	setarray .tier_reward_1,7227,7227,7227,7227,7227,7227;
	setarray .tier_reward_2,30804,30804,30804,30804,30804,30804;
	setarray .tier_reward_3,30805,30805,30805,30805,30805,30805;

	.tier_reward_0_size = getarraysize( .tier_reward_0 );
	.tier_reward_1_size = getarraysize( .tier_reward_1 );
	.tier_reward_2_size = getarraysize( .tier_reward_2 );
	.tier_reward_3_size = getarraysize( .tier_reward_3 );
	
	setarray .Map$[0],"prontera","morocc","geffen","payon","alberta","aldebaran","xmas","comodo","yuno","amatsu","gonryun","umbala","louyang","ayothaya","eibroch","hugel","rachel","veins","moscovia";
	setarray .MVP[0],3165,3166,3167,3169,3175,3177;
	.sleep = 60000;		 // 60000ms = 1min
	.npc_name$ = strnpcinfo(0);	
	setmapflag .map$,mf_partylock;
	setmapflag .map$,mf_nomobloot;
	setmapflag .map$,mf_nomvploot;
	end;
}

*debugmes - With this you can see a debug message in your server console.

Here's what I'm currently using..

For now it doesn't show any error i think?

Emma try to use your version../ok

And no it does not show any error i think?

-	script	WorldBoss	-1,{

OnTalk:
    .@party_id = getcharid(1);
    .@map$ = strcharinfo(3);
    .@label$ = @label$;
    
    if( getcharid(0) != getpartyleader( .@party_id,2 ) ){
        message strcharinfo(0),"You're not Party Leader.";
        monster .@map$,rand(.@x,.@x-3),rand(.@y-3,.@y),"--ja--",1324,1,.@label$;
        end;
    }else{
        mes "[Loot Distributor]";
        mes "Please ensure you distribute the Rewards. If you cancelled this, your party might not able to receive any rewards.";
        next;
        mes "Reward List :";
        for( .@i = 0; .@i < @size; .@i++ )
            mes "^777777 ~ "+getitemname( @reward[.@i] )+"^000000";
        if( prompt( "Distribute Loots","Dispose Loots" ) == 1 ){
            getpartymember .@party_id;
            getpartymember .@party_id,1;
            .@party_size = $@partymembercount;
            copyarray .@party_aid[0],$@partymemberaid[0],.@party_size;
            copyarray .@party_name$[0],$@partymembername$[0],.@party_size;
            for( .@i = 0; .@i < $@partymembercount; .@i++ ){
                if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
                    .@party_name_menu$ = .@party_name_menu$ + $@partymembername$[.@i];
                .@party_name_menu$ = .@party_name_menu$ +":";
            }
            for( .@i = 0; .@i < @size; .@i++ ){
                next;
                mes "^777777 ~ "+getitemname( @reward[.@i] )+"^000000";
                if( prompt( "Cast Loots" ) == 1 ){
                    .@name = rand( .@party_size );
                    message .@party_name$[.@name],"Gained "+getitemname( @reward[.@i] )+" ( Distributed Randomly )";
                }
                getitem @reward[.@i],1,.@party_aid[.@name];
            }
        }
        mes "Congratulations!";
        mapannounce .@map$,"All Rewards have been distributed.",0;
        end;
    }

OnClock1159:
OnClock2359:
    set .RandMap,rand( getarraysize( .Map$ ) );
    set .RandMVP,rand( getarraysize( .MVP ) );
    killmonster .Map$,"All";
    .@mins = .sleep / 60000;
    announce "[World Boss] A rift on time and space is about to be opened! A World Boss will appear in " + .@mins + " minute! Prepare your Hunting Party!", bc_all, 0xFF0000;
    sleep .sleep;
    monster .Map$[ .RandMap ],0,0,"World Boss",.MVP[ .RandMVP ],1,strnpcinfo(0)+"::OnKilled";
    announce "[World Boss] A World Boss "+getmonsterinfo( .MVP[ .RandMVP ],0 )+" appeared in "+.Map$[ .RandMap ]+" to wreck havoc!! Form a Hunting Party and stop it!!", bc_all, 0xFF0000;    end;
    end;
    
OnKilled:
    announce "[World Boss] The "+getpartyname(getcharid(1))+" Hunting Party killed the World Boss! Congratulations!", bc_all, 0xFF0000;
    getmapxy(.@map$,.@x,.@y,0);
    monster .@map$,rand(.@x,.@x-3),rand(.@y-3,.@y),"--ja--",1324,1,.npc_name$+"::OnBoxKill";
    end;

OnBoxKill:
	deletearray @reward;
	@label$ = .npc_name$+"::OnBoxKill";
	@range = rand(4);
	@size = getarraysize(getd(".tier_reward_"+@range));
	copyarray @reward[0], getd(".tier_reward_"+@range+"[0]"), @size;
	doevent "WorldBoss::OnTalk";
	end;

OnInit:
    // tier reward
	setarray .tier_reward_0[0],7227,30804,30805,30806,30000,30001;
	setarray .tier_reward_1[0],7227,7227,7227,7227,7227,7227;
	setarray .tier_reward_2[0],30804,30804,30804,30804,30804,30804;
	setarray .tier_reward_4[0],30805,30805,30805,30805,30805,30805;
    	.tier_reward_0_size = getarraysize( .tier_reward_0 );
    	setarray .Map$[0],"prontera","morocc","geffen","payon","alberta","aldebaran","xmas","comodo","yuno","amatsu","gonryun","umbala","louyang","ayothaya","eibroch","hugel","rachel","veins","moscovia";
    	setarray .MVP[0],3165,3166,3167,3169,3175,3177;
    	.sleep = 60000;         // 60000ms = 1min
    	.npc_name$ = strnpcinfo(0);    
    	setmapflag .map$,mf_partylock;
    	setmapflag .map$,mf_nomobloot;
    	setmapflag .map$,mf_nomvploot;
    	end;
}

 

Edited by Musika6988
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

18 hours ago, Musika6988 said:

And no it does not show any error i think?

Does this debug message print in your console and does the reward or party_aid have any value? -This is right after the getitem

debugmes .@label$ + " Cast Loots! reward=" + @reward[.@i] + ", party_aid=" + .@party_aid[.@name];

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

3 hours ago, Sehrentos said:

Does this debug message print in your console and does the reward or party_aid have any value? -This is right after the getitem


debugmes .@label$ + " Cast Loots! reward=" + @reward[.@i] + ", party_aid=" + .@party_aid[.@name];

This is the only error I am having so far. Not sure where it's coming from though?

Can seem to find it on YGGFarm script..

 

Error.bmp

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

7 hours ago, Sehrentos said:

Does this debug message print in your console and does the reward or party_aid have any value? -This is right after the getitem


debugmes .@label$ + " Cast Loots! reward=" + @reward[.@i] + ", party_aid=" + .@party_aid[.@name];

 

-	script	WorldBoss	-1,{

OnTalk:
	.@party_id = getcharid(1);
	.@map$ = strcharinfo(3);
	.@label$ = @label$;
    
    if( getcharid(0) != getpartyleader( .@party_id,2 ) ){
        message strcharinfo(0),"You're not Party Leader.";
        monster .@map$,rand(.@x,.@x-3),rand(.@y-3,.@y),"--ja--",1324,1,.@label$;
        end;
    }else{
        mes "[Loot Distributor]";
        mes "Please ensure you distribute the Rewards. If you cancelled this, your party might not able to receive any rewards.";
        next;
        mes "Reward List :";
        for( .@i = 0; .@i < @size; .@i++ )
            mes "^777777 ~ "+getitemname( @reward[.@i] )+"^000000";
        if( prompt( "Distribute Loots","Dispose Loots" ) == 1 ){
            getpartymember .@party_id;
            getpartymember .@party_id,1;
            .@party_size = $@partymembercount;
            copyarray .@party_aid[0],$@partymemberaid[0],.@party_size;
            copyarray .@party_name$[0],$@partymembername$[0],.@party_size;
            for( .@i = 0; .@i < $@partymembercount; .@i++ ){
                if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
                    .@party_name_menu$ = .@party_name_menu$ + $@partymembername$[.@i];
                .@party_name_menu$ = .@party_name_menu$ +":";
            }
            for( .@i = 0; .@i < @size; .@i++ ){
                next;
                mes "^777777 ~ "+getitemname( @reward[.@i] )+"^000000";
                if( prompt( "Cast Loots" ) == 1 ){
                    .@name = rand( .@party_size );
                    message .@party_name$[.@name],"Gained "+getitemname( @reward[.@i] )+" ( Distributed Randomly )";
                }
                getitem @reward[.@i],1,.@party_aid[.@name];
            }
        }
        mes "Congratulations!";
        mapannounce .@map$,"All Rewards have been distributed.",0;
        end;
    }

OnClock1315:
OnClock2359:
    set .RandMap,rand( getarraysize( .Map$ ) );
    set .RandMVP,rand( getarraysize( .MVP ) );
    killmonster .Map$,"All";
    .@mins = .sleep / 60000;
    announce "[World Boss] A rift on time and space is about to be opened! A World Boss will appear in " + .@mins + " minute! Prepare your Hunting Party!", bc_all, 0xFF0000;
    sleep .sleep;
    monster .Map$[ .RandMap ],0,0,"World Boss",.MVP[ .RandMVP ],1,strnpcinfo(0)+"::OnKilled";
    announce "[World Boss] A World Boss "+getmonsterinfo( .MVP[ .RandMVP ],0 )+" appeared in "+.Map$[ .RandMap ]+" to wreck havoc!! Form a Hunting Party and stop it!!", bc_all, 0xFF0000;    end;
    end;
    
OnKilled:
	.@party_id = getcharid(1);
	.@party_name$ = getpartyname(.@party_id);
	.@leader_id = getpartyleader(.@party_id, 2);
	.@leader_name$ = strcharinfo(0, .@leader_id);
    announce "[World Boss] The "+getpartyname(getcharid(1))+" Hunting Party lead by "+strcharinfo(0, .@leader_id)+" by killed the World Boss! Congratulations!", bc_all, 0xFF0000;
    getmapxy(.@map$,.@x,.@y,0);
    monster .@map$,rand(.@x,.@x-3),rand(.@y-3,.@y),"--ja--",1324,1,.npc_name$+"::OnBoxKill";
    end;

OnBoxKill:
	deletearray @reward;
	@label$ = .npc_name$ + "::OnBoxKill";
	//@size = getd( ".tier_reward_"+.tier+"_size" );
	//copyarray @reward[0],getd( ".tier_reward_"+.tier+"[0]" ),@size;

	// Select random tier set from a range 0-3
	@range = rand(0, 3);
	@size = getd( ".tier_reward_" + @range + "_size" );
	//@size = getarraysize(getd(".tier_reward_" + @range));
	copyarray @reward[0], getd(".tier_reward_" + @range + "[0]"), @size;

	//doevent "WorldBoss::OnTalk";
	doevent .npc_name$ + "::OnTalk";
	end;

OnInit:
	// tier reward
	setarray .tier_reward_0,7227,30804,30805,30806,30000,30001;
	setarray .tier_reward_1,7227,7227,7227,7227,7227,7227;
	setarray .tier_reward_2,30804,30804,30804,30804,30804,30804;
	setarray .tier_reward_3,30805,30805,30805,30805,30805,30805;

	.tier_reward_0_size = getarraysize( .tier_reward_0 );
	.tier_reward_1_size = getarraysize( .tier_reward_1 );
	.tier_reward_2_size = getarraysize( .tier_reward_2 );
	.tier_reward_3_size = getarraysize( .tier_reward_3 );
	
	setarray .Map$[0],"prontera","morocc","geffen","payon","alberta","aldebaran","xmas","comodo","yuno","amatsu","gonryun","umbala","louyang","ayothaya","eibroch","hugel","rachel","veins","moscovia";
	setarray .MVP[0],3165,3166,3167,3169,3175,3177;
	.sleep = 60000;		 // 60000ms = 1min
	.npc_name$ = strnpcinfo(0);	
	setmapflag .map$,mf_partylock;
	setmapflag .map$,mf_nomobloot;
	setmapflag .map$,mf_nomvploot;
	end;
}

The random choice of Tier Reward in this one worked, but stil, it didn't give any prize, it only says "Gained" but no item obtained. and no debug errors on the console.. :(

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

I'm not really sure but..

It's like, it has an account limit or something?

Because the first time I used it, it's all working fine.

But now, it doesnt give any prizes anymore.

I'm not a good scripter or anything but..

if( prompt( "Cast Loots" ) == 1 ){
                    .@name = rand( .@party_size );
                    message .@party_name$[.@name],"Gained 

Do you think that part has something to do with the problem?

It announces "Gained Angeling Coin" but you won't recieve any.

But then it doesn't show any debug mes or even erros on the console.

Though the Random Tier is working fine i guess?

We just need to fix the prize distribution..

I appreciate your help with this Sir Sehrentos!

Thanks for lending some time to help!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

18 hours ago, Musika6988 said:

The random choice of Tier Reward in this one worked, but stil, it didn't give any prize, it only says "Gained" but no item obtained. and no debug errors on the console..

Okay, there was no online check when distributing random reward. getitem will do nothing if user is offline.

Try this (I commented out the party_name_menu since it's not in use):

OnTalk:
	.@party_id = getcharid(1);
	.@map$ = strcharinfo(3);
	.@label$ = @label$;
	
	if( getcharid(0) != getpartyleader( .@party_id,2 ) ){
		message strcharinfo(0), "You're not Party Leader.";
		monster .@map$, rand(.@x,.@x-3), rand(.@y-3,.@y), "--ja--", 1324, 1, .@label$;
		end;
	} else {
		mes "[Loot Distributor]";
		mes "Please ensure you distribute the Rewards. If you cancelled this, your party might not able to receive any rewards.";
		next;
		mes "Reward List :";
		for( .@i = 0; .@i < @size; .@i++ )
			mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
		if( prompt( "Distribute Loots", "Dispose Loots" ) == 1 ){
			//getpartymember .@party_id, 0; // name
			getpartymember .@party_id, 1; // cid
			getpartymember .@party_id, 2; // aid
			// Copy the temporary party data
			.@party_size = $@partymembercount;
			//copyarray .@party_name$[0], $@partymembername$[0], .@party_size;
			copyarray .@party_cid[0], $@partymembercid[0], .@party_size;
			copyarray .@party_aid[0], $@partymemberaid[0], .@party_size;
			
			// Create party member menu (NOT IN USE!!)
			//for( .@i = 0; .@i < .@party_size; .@i++ ){
			//	if( isloggedin( .@party_aid[.@i], .@party_cid[.@i] ) )
			//		.@party_name_menu$ = .@party_name_menu$ + .@party_name$[.@i];
			//	.@party_name_menu$ = .@party_name_menu$ + ":";
			//}

			// Loop through each reward
			for( .@i = 0; .@i < @size; .@i++ ){
				next;
				mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
				if( prompt( "Cast Loots" ) == 1 ) {
					.@rng = rand( .@party_size );
					// If they are not online, nothing will happen
					if( isloggedin( .@party_aid[.@rng], .@party_cid[.@rng] ) ) {
						//message .@party_name$[.@rng], "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
						.@name$ = strcharinfo(0, .@party_cid[.@rng]);
						message .@name$, "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
						getitem @reward[.@i], 1, .@party_aid[.@rng];

						// DEBUG <label>Cast Loots!<player>,<reward>,<AID>
						debugmes .@label$ + " Cast Loots! player= " + .@name$ + ", reward=" + @reward[.@i] + ", aid=" + .@party_aid[.@rng];
					}
				}
	
			}
		}
		mes "Congratulations!";
		mapannounce .@map$, "All Rewards have been distributed.", 0;
		end;
	}

Update: Other way of avoiding offline party members is to modify the party arrays.

Here is a quick sample how to do it (not tested):

// Loop through each party member
.@psize = .@party_size;
for( .@i = 0; .@i < .@psize; .@i++ ) {
  // If they are not online, remove from array
  if( !isloggedin( .@party_aid[.@i], .@party_cid[.@i] ) ){
    deletearray .@party_cid[.@i], 1;
    deletearray .@party_aid[.@i], 1;
    .@party_size--;
  }
}

This would go after the prompt "Cast Loots".

Edited by Sehrentos
fixtypo
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

18 hours ago, Sehrentos said:

Okay, there was no online check when distributing random reward. getitem will do nothing if user is offline.

Try this (I commented out the party_name_menu since it's not in use):


OnTalk:
	.@party_id = getcharid(1);
	.@map$ = strcharinfo(3);
	.@label$ = @label$;
	
	if( getcharid(0) != getpartyleader( .@party_id,2 ) ){
		message strcharinfo(0), "You're not Party Leader.";
		monster .@map$, rand(.@x,.@x-3), rand(.@y-3,.@y), "--ja--", 1324, 1, .@label$;
		end;
	} else {
		mes "[Loot Distributor]";
		mes "Please ensure you distribute the Rewards. If you cancelled this, your party might not able to receive any rewards.";
		next;
		mes "Reward List :";
		for( .@i = 0; .@i < @size; .@i++ )
			mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
		if( prompt( "Distribute Loots", "Dispose Loots" ) == 1 ){
			//getpartymember .@party_id, 0; // name
			getpartymember .@party_id, 1; // cid
			getpartymember .@party_id, 2; // aid
			// Copy the temporary party data
			.@party_size = $@partymembercount;
			//copyarray .@party_name$[0], $@partymembername$[0], .@party_size;
			copyarray .@party_cid[0], $@partymembercid[0], .@party_size;
			copyarray .@party_aid[0], $@partymemberaid[0], .@party_size;
			
			// Create party member menu (NOT IN USE!!)
			//for( .@i = 0; .@i < .@party_size; .@i++ ){
			//	if( isloggedin( .@party_aid[.@i], .@party_cid[.@i] ) )
			//		.@party_name_menu$ = .@party_name_menu$ + .@party_name$[.@i];
			//	.@party_name_menu$ = .@party_name_menu$ + ":";
			//}

			// Loop through each reward
			for( .@i = 0; .@i < @size; .@i++ ){
				next;
				mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
				if( prompt( "Cast Loots" ) == 1 ) {
					.@rng = rand( .@party_size );
					// If they are not online, nothing will happen
					if( isloggedin( .@party_aid[.@rng], .@party_cid[.@rng] ) ) {
						//message .@party_name$[.@rng], "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
						.@name$ = strcharinfo(0, .@party_cid[.@rng]);
						message .@name$, "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
						getitem @reward[.@i], 1, .@party_aid[.@rng];

						// DEBUG <label>Cast Loots!<player>,<reward>,<AID>
						debugmes .@label$ + " Cast Loots! player= " + .@name$ + ", reward=" + @reward[.@i] + ", aid=" + .@party_aid[.@rng];
					}
				}
	
			}
		}
		mes "Congratulations!";
		mapannounce .@map$, "All Rewards have been distributed.", 0;
		end;
	}

Update: Other way of avoiding offline party members is to modify the party arrays.

Here is a quick sample how to do it (not tested):


// Loop through each party member
.@psize = .@party_size;
for( .@i = 0; .@i < .@psize; .@i++ ) {
  // If they are not online, remove from array
  if( !isloggedin( .@party_aid[.@i], .@party_cid[.@i] ) ){
    deletearray .@party_cid[.@i], 1;
    deletearray .@party_aid[.@i], 1;
    .@party_size--;
  }
}

This would go after the prompt "Cast Loots".

Okay emma give this a try. ;)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

// Loop through each party member
.@psize = .@party_size;
for( .@i = 0; .@i < .@psize; .@i++ ) {
  // If they are not online, remove from array
  if( !isloggedin( .@party_aid[.@i], .@party_cid[.@i] ) ){
    deletearray .@party_cid[.@i], 1;
    deletearray .@party_aid[.@i], 1;
    .@party_size--;
  }
}

By the way, so sorry for being Noob in scripting but, I'm not sure where to insert these lines? should I insert it after the "Cast Loot" which mean I'll insert it between those lines or should I replace the next lines after "Cast Loots" with these that you have provided?:wacko:

Sorry..:(

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

-	script	WorldBoss	-1,{

OnTalk:
	.@party_id = getcharid(1);
	.@map$ = strcharinfo(3);
	.@label$ = @label$;
    
    if( getcharid(0) != getpartyleader( .@party_id,2 ) ){
        message strcharinfo(0),"You're not Party Leader.";
        monster .@map$,rand(.@x,.@x-3),rand(.@y-3,.@y),"--ja--",1324,1,.@label$;
        end;
    }else{
        mes "[Loot Distributor]";
        mes "Please ensure you distribute the Rewards. If you cancelled this, your party might not able to receive any rewards.";
        next;
        mes "Reward List :";
        for( .@i = 0; .@i < @size; .@i++ )
            mes "^777777 ~ "+getitemname( @reward[.@i] )+"^000000";
        if( prompt( "Distribute Loots","Dispose Loots" ) == 1 ){
            getpartymember .@party_id;
            getpartymember .@party_id,1;
            .@party_size = $@partymembercount;
            copyarray .@party_aid[0],$@partymemberaid[0],.@party_size;
            copyarray .@party_name$[0],$@partymembername$[0],.@party_size;
            for( .@i = 0; .@i < $@partymembercount; .@i++ ){
                if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
                    .@party_name_menu$ = .@party_name_menu$ + $@partymembername$[.@i];
                .@party_name_menu$ = .@party_name_menu$ +":";
            }
// Loop through each party member
.@psize = .@party_size;
for( .@i = 0; .@i < .@psize; .@i++ ) {
                next;
                mes "^777777 ~ "+getitemname( @reward[.@i] )+"^000000";
                if( prompt( "Cast Loots" ) == 1 ) {
			.@rng = rand( .@party_size );
			if( !isloggedin( .@party_aid[.@i], .@party_cid[.@i] ) ){
    deletearray .@party_cid[.@i], 1;
    deletearray .@party_aid[.@i], 1;
    .@party_size--;
  }
			.@name$ = strcharinfo(0, .@party_cid[.@rng]);
			message .@name$, "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
			getitem @reward[.@i], 1, .@party_aid[.@rng];
                }
                getitem @reward[.@i],1,.@party_aid[.@name];
            }
        }
        mes "Congratulations!";
        mapannounce .@map$,"All Rewards have been distributed.",0;
        end;
    }
OnClock0300:
OnClock2359:
    set .RandMap,rand( getarraysize( .Map$ ) );
    set .RandMVP,rand( getarraysize( .MVP ) );
    killmonster .Map$,"All";
    .@mins = .sleep / 60000;
    announce "[World Boss] A rift on time and space is about to be opened! A World Boss will appear in " + .@mins + " minute! Prepare your Hunting Party!", bc_all, 0xFF0000;
    sleep .sleep;
    monster .Map$[ .RandMap ],0,0,"World Boss",.MVP[ .RandMVP ],1,strnpcinfo(0)+"::OnKilled";
    announce "[World Boss] A World Boss "+getmonsterinfo( .MVP[ .RandMVP ],0 )+" appeared in "+.Map$[ .RandMap ]+" to wreck havoc!! Form a Hunting Party and stop it!!", bc_all, 0xFF0000;    end;
    end;
    
OnKilled:
	.@party_id = getcharid(1);
	.@party_name$ = getpartyname(.@party_id);
	.@leader_id = getpartyleader(.@party_id, 2);
	.@leader_name$ = strcharinfo(0, .@leader_id);
    announce "[World Boss] The "+getpartyname(getcharid(1))+" Hunting Party lead by "+strcharinfo(0, .@leader_id)+" killed the World Boss! Congratulations!", bc_all, 0xFF0000;
    getmapxy(.@map$,.@x,.@y,0);
    monster .@map$,rand(.@x,.@x-3),rand(.@y-3,.@y),"--ja--",1324,1,.npc_name$+"::OnBoxKill";
    end;

OnBoxKill:
	deletearray @reward;
	@label$ = .npc_name$ + "::OnBoxKill";
	//@size = getd( ".tier_reward_"+.tier+"_size" );
	//copyarray @reward[0],getd( ".tier_reward_"+.tier+"[0]" ),@size;

	// Select random tier set from a range 0-3
	@range = rand(0, 3);
	@size = getd( ".tier_reward_" + @range + "_size" );
	//@size = getarraysize(getd(".tier_reward_" + @range));
	copyarray @reward[0], getd(".tier_reward_" + @range + "[0]"), @size;

	//doevent "WorldBoss::OnTalk";
	doevent .npc_name$ + "::OnTalk";
	end;

OnInit:
	// tier reward
	setarray .tier_reward_0,7227,30804,30805,30806,30000,30001;
	setarray .tier_reward_1,7227,7227,7227,7227,7227,7227;
	setarray .tier_reward_2,30804,30804,30804,30804,30804,30804;
	setarray .tier_reward_3,30805,30805,30805,30805,30805,30805;

	.tier_reward_0_size = getarraysize( .tier_reward_0 );
	.tier_reward_1_size = getarraysize( .tier_reward_1 );
	.tier_reward_2_size = getarraysize( .tier_reward_2 );
	.tier_reward_3_size = getarraysize( .tier_reward_3 );
	
	setarray .Map$[0],"prontera","morocc","geffen","payon","alberta","aldebaran","xmas","comodo","yuno","amatsu","gonryun","umbala","louyang","ayothaya","eibroch","hugel","rachel","veins","moscovia";
	setarray .MVP[0],3165,3166,3167,3169,3175,3177;
	.sleep = 60000;		 // 60000ms = 1min
	.npc_name$ = strnpcinfo(0);	
	setmapflag .map$,mf_partylock;
	setmapflag .map$,mf_nomobloot;
	setmapflag .map$,mf_nomvploot;
	end;
}

I'm using this one.. Random Tier Reward is okay, but when i try to Cast loots, this is the error i get in the console..

[Error]: buildin_strcharinfo: Player with char id '0' is not found.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

3 hours ago, Musika6988 said:

[Error]: buildin_strcharinfo: Player with char id '0' is not found.

Okay, so you put the loop in the wrong place.

Not to worry here is the option 1:

if( prompt( "Distribute Loots", "Dispose Loots" ) == 1 ){
	//getpartymember .@party_id, 0; // name
	getpartymember .@party_id, 1; // cid
	getpartymember .@party_id, 2; // aid
	// Copy the temporary party data
	.@party_size = $@partymembercount;
	//copyarray .@party_name$[0], $@partymembername$[0], .@party_size;
	copyarray .@party_cid[0], $@partymembercid[0], .@party_size;
	copyarray .@party_aid[0], $@partymemberaid[0], .@party_size;
	
	// Loop through each reward
	for( .@i = 0; .@i < @size; .@i++ ){
		next;
		mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
		if( prompt( "Cast Loots" ) == 1 ) {
			.@rng = rand( .@party_size );
			// If they are not online, nothing will happen
			if( isloggedin( .@party_aid[.@rng], .@party_cid[.@rng] ) ) {
				//message .@party_name$[.@rng], "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
				.@name$ = strcharinfo(0, .@party_cid[.@rng]);
				message .@name$, "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
				getitem @reward[.@i], 1, .@party_aid[.@rng];

				// DEBUG <label>Cast Loots!<player>,<reward>,<AID>
				debugmes .@label$ + " Cast Loots! player= " + .@name$ + ", reward=" + @reward[.@i] + ", aid=" + .@party_aid[.@rng];
			}
		}

	}
}

And this is option 2 which im not 100% sure about:

if( prompt( "Distribute Loots", "Dispose Loots" ) == 1 ){
	//getpartymember .@party_id, 0; // name
	getpartymember .@party_id, 1; // cid
	getpartymember .@party_id, 2; // aid
	// Copy the temporary party data
	.@party_size = $@partymembercount;
	//copyarray .@party_name$[0], $@partymembername$[0], .@party_size;
	copyarray .@party_cid[0], $@partymembercid[0], .@party_size;
	copyarray .@party_aid[0], $@partymemberaid[0], .@party_size;
	
	// Loop through each party member
	.@psize = .@party_size;
	for( .@i = 0; .@i < .@psize; .@i++ ) {
		// If they are not online, remove from array
		if( !isloggedin( .@party_aid[.@i], .@party_cid[.@i] ) ){
			deletearray .@party_cid[.@i], 1;
			deletearray .@party_aid[.@i], 1;
			.@party_size--;
		}
	}

	// Loop through each reward
	for( .@i = 0; .@i < @size; .@i++ ){
		next;
		mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
		if( prompt( "Cast Loots" ) == 1 ) {
			.@rng = rand( .@party_size );
			// If they are not online, nothing will happen
			if( isloggedin( .@party_aid[.@rng], .@party_cid[.@rng] ) ) {
				//message .@party_name$[.@rng], "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
				.@name$ = strcharinfo(0, .@party_cid[.@rng]);
				message .@name$, "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
				getitem @reward[.@i], 1, .@party_aid[.@rng];

				// DEBUG <label>Cast Loots!<player>,<reward>,<AID>
				debugmes .@label$ + " Cast Loots! player= " + .@name$ + ", reward=" + @reward[.@i] + ", aid=" + .@party_aid[.@rng];
			}
		}

	}
}

Update:

Since this thread is marked as complete.

You can PM me about your results and we can continue there, if you need more help with this :)

Edited by Sehrentos
Update
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   6
  • Joined:  09/09/13
  • Last Seen:  

On 2/22/2018 at 9:17 AM, Sehrentos said:

Okay, so you put the loop in the wrong place.

Not to worry here is the option 1:


if( prompt( "Distribute Loots", "Dispose Loots" ) == 1 ){
	//getpartymember .@party_id, 0; // name
	getpartymember .@party_id, 1; // cid
	getpartymember .@party_id, 2; // aid
	// Copy the temporary party data
	.@party_size = $@partymembercount;
	//copyarray .@party_name$[0], $@partymembername$[0], .@party_size;
	copyarray .@party_cid[0], $@partymembercid[0], .@party_size;
	copyarray .@party_aid[0], $@partymemberaid[0], .@party_size;
	
	// Loop through each reward
	for( .@i = 0; .@i < @size; .@i++ ){
		next;
		mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
		if( prompt( "Cast Loots" ) == 1 ) {
			.@rng = rand( .@party_size );
			// If they are not online, nothing will happen
			if( isloggedin( .@party_aid[.@rng], .@party_cid[.@rng] ) ) {
				//message .@party_name$[.@rng], "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
				.@name$ = strcharinfo(0, .@party_cid[.@rng]);
				message .@name$, "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
				getitem @reward[.@i], 1, .@party_aid[.@rng];

				// DEBUG <label>Cast Loots!<player>,<reward>,<AID>
				debugmes .@label$ + " Cast Loots! player= " + .@name$ + ", reward=" + @reward[.@i] + ", aid=" + .@party_aid[.@rng];
			}
		}

	}
}

And this is option 2 which im not 100% sure about:


if( prompt( "Distribute Loots", "Dispose Loots" ) == 1 ){
	//getpartymember .@party_id, 0; // name
	getpartymember .@party_id, 1; // cid
	getpartymember .@party_id, 2; // aid
	// Copy the temporary party data
	.@party_size = $@partymembercount;
	//copyarray .@party_name$[0], $@partymembername$[0], .@party_size;
	copyarray .@party_cid[0], $@partymembercid[0], .@party_size;
	copyarray .@party_aid[0], $@partymemberaid[0], .@party_size;
	
	// Loop through each party member
	.@psize = .@party_size;
	for( .@i = 0; .@i < .@psize; .@i++ ) {
		// If they are not online, remove from array
		if( !isloggedin( .@party_aid[.@i], .@party_cid[.@i] ) ){
			deletearray .@party_cid[.@i], 1;
			deletearray .@party_aid[.@i], 1;
			.@party_size--;
		}
	}

	// Loop through each reward
	for( .@i = 0; .@i < @size; .@i++ ){
		next;
		mes "^777777 ~ " + getitemname( @reward[.@i] ) + "^000000";
		if( prompt( "Cast Loots" ) == 1 ) {
			.@rng = rand( .@party_size );
			// If they are not online, nothing will happen
			if( isloggedin( .@party_aid[.@rng], .@party_cid[.@rng] ) ) {
				//message .@party_name$[.@rng], "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
				.@name$ = strcharinfo(0, .@party_cid[.@rng]);
				message .@name$, "Gained " + getitemname( @reward[.@i] ) + " ( Distributed Randomly )";
				getitem @reward[.@i], 1, .@party_aid[.@rng];

				// DEBUG <label>Cast Loots!<player>,<reward>,<AID>
				debugmes .@label$ + " Cast Loots! player= " + .@name$ + ", reward=" + @reward[.@i] + ", aid=" + .@party_aid[.@rng];
			}
		}

	}
}

Update:

Since this thread is marked as complete.

You can PM me about your results and we can continue there, if you need more help with this :)

Thanks Sir Sehrentos. I'll test this and if incase still doesnt work, let's try to fix this via PM lol.. Just got back from long drive.

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