Jump to content

Sehrentos

Members
  • Posts

    91
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Sehrentos

  1. Hello,

    Is it possible to calculate and extract the crafted items char_id from card position 3 and 4 ?
    I have this test script, where i'm trying to extract as many data from the crafted items as possible and show results.

    In docs char_id is calculated: @card3 = @charid & 65535; @card4 = @charid >> 16; when crafting them.

    -	script	#atcmd_test	-1,{
    OnInit:
    	bindatcmd "test", strnpcinfo(3)+"::OnAtCommand";
    	end;
    
    OnAtCommand:
    	if (getgmlevel() < 60) end;
    	.@char_id = getcharid(0);
    	getinventorylist( .@char_id );
    	for( .@i = 0; .@i<@inventorylist_count; .@i++ ) {
    		if(@inventorylist_card1[.@i] == CARD0_PET) {
    			message strcharinfo(0), (.@i+1) +". [Pet] "+ getitemname(@inventorylist_id[.@i]) +
    			" ("+ @inventorylist_amount[.@i] +")";
    		}
    		else if(@inventorylist_card1[.@i] == CARD0_FORGE) {
    			message strcharinfo(0), (.@i+1) +". [Forge]" +
    			(@inventorylist_refine[.@i] ? " +"+ @inventorylist_refine[.@i] : "") +
    			" "+ callsub(S_ForgeProperty, @inventorylist_card2[.@i]) +
    			" "+ getitemname(@inventorylist_id[.@i]) + 
    			" ("+ @inventorylist_amount[.@i] +")" +
    			(@inventorylist_equip[.@i] > 0 ? " Equiped: "+ callsub(S_EquipPosition,@inventorylist_equip[.@i]) : "") +
    			(@inventorylist_attribute[.@i] ? " broken" : "");
    			// for debugs:
    			//(@inventorylist_card2[.@i] ? " card-2:" + @inventorylist_card2[.@i] : "") +
    			//(@inventorylist_card3[.@i] ? " card-3:" + @inventorylist_card3[.@i] : "") +
    			//(@inventorylist_card4[.@i] ? " card-4:" + @inventorylist_card4[.@i] : "");
    		}
    		else if(@inventorylist_card1[.@i] == CARD0_CREATE) {
    			message strcharinfo(0), (.@i+1) +". [Create]" +
    			(@inventorylist_refine[.@i] ? " +"+ @inventorylist_refine[.@i] : "") +
    			" "+ getitemname(@inventorylist_id[.@i]) + 
    			" ("+ @inventorylist_amount[.@i] +")" +
    			(@inventorylist_equip[.@i] > 0 ? " Equiped: "+ callsub(S_EquipPosition,@inventorylist_equip[.@i]) : "");
    			// for debugs:
    			//(@inventorylist_card2[.@i] ? " card-2:" + @inventorylist_card2[.@i] : "") +
    			//(@inventorylist_card3[.@i] ? " card-3:" + @inventorylist_card3[.@i] : "") +
    			//(@inventorylist_card4[.@i] ? " card-4:" + @inventorylist_card4[.@i] : "");
    		}
    		else if (@inventorylist_equip[.@i] > 0) {
    			// Equiped items
    			message strcharinfo(0), (.@i+1) +"." +
    			(@inventorylist_refine[.@i] ? " +"+ @inventorylist_refine[.@i] : "") +
    			" "+ getitemname(@inventorylist_id[.@i]) + 
    			" ("+ @inventorylist_amount[.@i] +")" +
    			" Equiped: "+ callsub(S_EquipPosition,@inventorylist_equip[.@i]) +
    			(@inventorylist_identify[.@i] ? "" : " unidentified") +
    			(@inventorylist_attribute[.@i] ? " broken" : "") +
    			(@inventorylist_card1[.@i] ? " card-1:" + @inventorylist_card1[.@i] : "") + //@inventorylist_card1[.@i] == 256 is Egg
    			(@inventorylist_card2[.@i] ? " card-2:" + @inventorylist_card2[.@i] : "") +
    			(@inventorylist_card3[.@i] ? " card-3:" + @inventorylist_card3[.@i] : "") +
    			(@inventorylist_card4[.@i] ? " card-4:" + @inventorylist_card4[.@i] : "");
    		}
    		else {
    			// Other inventory items
    			message strcharinfo(0), (.@i+1) +"." +
    			(@inventorylist_refine[.@i] ? " +"+ @inventorylist_refine[.@i] : "") +
    			" "+ getitemname(@inventorylist_id[.@i]) +
    			" ("+ @inventorylist_amount[.@i] +")" +
    			(@inventorylist_identify[.@i] ? "" : " unidentified") +
    			(@inventorylist_attribute[.@i] ? " broken" : "") +
    			(@inventorylist_card1[.@i] ? " card-1:" + @inventorylist_card1[.@i] : "") +
    			(@inventorylist_card2[.@i] ? " card-2:" + @inventorylist_card2[.@i] : "") +
    			(@inventorylist_card3[.@i] ? " card-3:" + @inventorylist_card3[.@i] : "") +
    			(@inventorylist_card4[.@i] ? " card-4:" + @inventorylist_card4[.@i] : "");
    		}
    		//debugmes "Equip: "+ getitemname(@inventorylist_id[.@i]) + ": "+@inventorylist_equip[.@i];
    	}
    	end;
    
    S_ForgeProperty:
    	.@attr = getarg(0);
    	// 1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
    	// Calc formula: ElementNumber + ((StarCrubNumber * 5) << 8)
    	switch(.@attr) {
    		case 3840: .@name$ = "Very Very Very Strong Neutral"; break;
    		case 3841: .@name$ = "Very Very Very Strong Ice"; break;
    		case 3842: .@name$ = "Very Very Very Strong Earth"; break;
    		case 3843: .@name$ = "Very Very Very Strong Fire"; break;
    		case 3844: .@name$ = "Very Very Very Strong Wind"; break;
    		case 2560: .@name$ = "Very Very Strong Neutral"; break;
    		case 2561: .@name$ = "Very Very Strong Ice"; break;
    		case 2562: .@name$ = "Very Very Strong Earth"; break;
    		case 2563: .@name$ = "Very Very Strong Fire"; break;
    		case 2564: .@name$ = "Very Very Strong Wind"; break;
    		case 1280: .@name$ = "Very Strong Neutral"; break;
    		case 1281: .@name$ = "Very Strong Ice"; break;
    		case 1282: .@name$ = "Very Strong Earth"; break;
    		case 1283: .@name$ = "Very Strong Fire"; break;
    		case 1284: .@name$ = "Very Strong Wind"; break;
    		case 0: .@name$ = "Neutral"; break;
    		case 1: .@name$ = "Ice"; break;
    		case 2: .@name$ = "Earth"; break;
    		case 3: .@name$ = "Fire"; break;
    		case 4: .@name$ = "Wind"; break;
    		default: .@name$ = ""; break;
    	}
    	//debugmes "Calc value: "+ .@attr;
    	//debugmes "Calc result: "+ .@name$;
    	return .@name$;
    
    S_EquipPosition:
    	.@idx = getarg(0);
    	if(.@idx == EQP_ACC_L) {
    		.@name$ = "Accessory Left";
    	} else if(.@idx == EQP_ACC_R) {
    		.@name$ = "Accessory Right";
    	} else if(.@idx == EQP_SHOES) {
    		.@name$ = "Shoes";
    	} else if(.@idx == EQP_GARMENT) {
    		.@name$ = "Garment";
    	} else if(.@idx == EQP_HEAD_LOW) {
    		.@name$ = "Head lower";
    	} else if(.@idx == EQP_HEAD_MID) {
    		.@name$ = "Head middle";
    	} else if(.@idx == EQP_HEAD_TOP) {
    		.@name$ = "Head top";
    	} else if(.@idx == EQP_ARMOR) {
    		.@name$ = "Armor";
    	} else if(.@idx == EQP_HAND_L) {
    		.@name$ = "Hand Left";
    	} else if(.@idx == EQP_HAND_R) {
    		.@name$ = "Hand Right";
    	} else if(.@idx == EQP_HAND_L + EQP_HAND_R) {
    		.@name$ = "Hands Left & Right";
    	} else if(.@idx == EQP_COSTUME_HEAD_TOP) {
    		.@name$ = "C-Head top";
    	} else if(.@idx == EQP_COSTUME_HEAD_MID) {
    		.@name$ = "C-Head middle";
    	} else if(.@idx == EQP_COSTUME_HEAD_LOW) {
    		.@name$ = "C-Head lower";
    	} else if(.@idx == EQP_COSTUME_GARMENT) {
    		.@name$ = "C-Garment";
    	} else if(.@idx == EQP_AMMO) {
    		.@name$ = "Ammonition";
    	} else if(.@idx == EQP_SHADOW_ARMOR) {
    		.@name$ = "S-Armor";
    	} else if(.@idx == EQP_SHADOW_WEAPON) {
    		.@name$ = "S-Weapon";
    	} else if(.@idx == EQP_SHADOW_SHIELD) {
    		.@name$ = "S-Shield";
    	} else if(.@idx == EQP_SHADOW_SHOES) {
    		.@name$ = "S-Shoes";
    	} else if(.@idx == EQP_SHADOW_ACC_R) {
    		.@name$ = "S-Accessory Right";
    	} else if(.@idx == EQP_SHADOW_ACC_L) {
    		.@name$ = "S-Accessory Left";
    	} else if(.@idx == EQP_ACC_RL) {
    		.@name$ = "Accessory Both";
    	} else if(.@idx == EQP_SHADOW_ACC_RL) {
    		.@name$ = "S-Accessory Both";
    	} else {
    		.@name$ = "";
    	}
    	return .@name$;
    }

    Thanks in advance.

  2. Hi, You can try if this works for you:

    INSERT INTO pvp_ranking (charid,points) VALUES(150013, 0) ON DUPLICATE KEY UPDATE points = CASE WHEN points >= 12 THEN points - 12 ELSE 0 END

    Change the table column names to match yours.

    • Love 1
  3. Hey, I got some spare time and decided to update the script.
    @Musika6988

    Version 2.9

    Added loot modes 10 and 11 with party select option.

    And option to turn off the radar (changing monster HP)

    Update: Version 2.9.1

    Fix random reward will be selected only once, to avoid abuse.

    Added option to turn off mapflags.

    Added more default .MOB_ status points.

    Renamed some values. easier to understand.

    Update2: Version 2.9.2

    Disabled FOG effect.

    Added more announce text.

    Added unit checks OnMobDie event.

    Added inarray optimizations.

     

    Note: To rename the Treasure Chest NPC, replace ALL "Treasure Chest#wb_" strings but keep the index numbers.

    • Love 1
  4. 49 minutes ago, Strand said:

    Hello @Sehrentos,

     

    Thank you for your time and help but I tried the first one with the arrays and the 2nd party member is not receiving the PvPKills Points in both cases (when enemy does not have the variable "last_kill" and when he does). 

    Any idea what could be happening?

     

    Hi, save the original killedrid to .@killedrid and use that in the checks like this: https://pastebin.com/nK2XZyGY

    Since every party member can have different killedrid.

  5. 7 hours ago, Strand said:

    Where exactly do I add or edit addrid(2, 0, getcharid(1));?

    Hi, @Strand

    You can use it like this in your script:

    set .@map$, strcharinfo(3);
    addrid(2, 0, .@party_id);
    if( HP && strcharinfo(3) == .@map$ )
      set .@online_count,.@online_count + 1;

    Or with the getpartymember & copyarray:

    getpartymember .@party_id, 2;
    .@party_count = $@partymembercount;
    copyarray .@party_aid[0], $@partymemberaid[0], .@party_count;
    
    set .@map$, strcharinfo(3);
    for( set .@i, 0; .@i < .@party_count; set .@i, .@i +1 )
    	if( attachrid( .@party_aid[.@i] ) )
    		if( HP && strcharinfo(3) == .@map$ )
    			set .@online_count,.@online_count + 1;

    And double check {curly brackets}. I think one was set off the course.

  6. Hmm, well could it be that the server variables get changed during party member loop and then it fails. You should save the $@ to a .@ instance variable with copyarray, since they can change at any moment when requesting party data.

    Or  attach all available party members with addrid(2, 0, getcharid(1));

     

  7. On 9/16/2018 at 12:22 AM, Elysium said:

    .@i = rand(getarraysize(.item));

    if( .item[.@i] == .GlobalMessage ) {

    announce "Player "+ strcharinfo(0) +" obtaining "+ .qnt[.@i] +" x "+ getitemname(.item[.@i]) +".",0;

    }

    getitem .item[.@i], .qnt[.@i];

    Edit that rand() line?

  8. On 8/12/2018 at 2:32 PM, dikapramantya said:

    Hi @Sehrentos .

    I want to ask how to make it need a kill x global_monster in ragnarok world to trigger this script?

    and after kill the world boss, variable will reset to 0?

     

    i've try using OnNPCKillEvent: but when i put in top, the npc not count it . i'm so confused

    Hey @dikapramantya

    Sorry for the long wait. I have been too busy with other projects.
    How you can trigger the Start event. Create new NPC that has OnNPCKillEvent and a counter for the kills and call this when you want to start it:

    donpcevent "WorldBoss::OnEnable";

     

     

    Quote

    sir, im having a problem with the this script. i don't know what to do? please help....... thank you 

    Hey @ichikun1

    I think you must update your server if it does not support "unittalk".

  9. On 28.3.2018 at 10:05 AM, hendra814 said:

    set @Esucces, @Esucces+1;

    Just for a tip:

    For permanent character variable we can use "set Esuccess" instead of "set @Esuccess" or it will reset on logout?

    It depends how we want to limit the access.

  10. On 12.3.2018 at 10:14 AM, jawbreaker said:

    if (!@inventorylist_bound[.@i]){

    .@itemname$ = callfunc( "getitemname2", @inventorylist_id[.@i], @inventorylist_identify[.@i], @inventorylist_refine[.@i], @inventorylist_attribute[.@i], @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i], @inventorylist_bound[.@i]);

    .@menu$ = .@menu$ + @itemname2_info$ + .@itemname$ +":";

    }

    Hmm, add also the empty in the menu so it will be properly skipped and keep the index number:

    .@i = 0;
    while ( .@i < @inventorylist_count ) {
    
    	/* Filter only items that is not bound */
    	if (!@inventorylist_bound[.@i]){
    		.@itemname$ = callfunc( "getitemname2", @inventorylist_id[.@i], @inventorylist_identify[.@i], @inventorylist_refine[.@i], @inventorylist_attribute[.@i], @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i], @inventorylist_bound[.@i]);
    		.@menu$ = .@menu$ + @itemname2_info$ + .@itemname$;
    	}
    	.@menu$ = .@menu$ + ":";
    	.@i++;
    }
    .@s = select(.@menu$) -1;

     

  11. Look for pincode in the login table.

    query_sql("SELECT pincode FROM login WHERE account_id="+ getcharid(3) +";", .@pin);
    
    if ( getarraysize( .@pin ) ) { /* Has pincode .@pin[0] */ }

     

  12. Thank you for this share.

    I would suggest more loot options like:

    - Reward all near the boss and not just single party.

    - Selective where leader can select what item to who.

    And maby multiple events at once, but not in same map.

    Update: From 2.4 into 2.7 version

    Minor text changes.

    Added WorldBossRadar event NPC to monitor World Boss HP.

     - World Boss HP will increase or decrease by 1.5 mil per each player in 20 cell range and is updated every 10 seconds.

    Added timeout timer to clear expired event monster.

    Added loot mode 1 give one reward to one random party member.

    Added loot modes 4-5 give all/one rewards to all nearby players and their party members.

    Added loot modes 6-7 give all/one rewards to all nearby players.

    Removed Treasure Chest monster and added Treasure Chest NPC's.

    Added multiple events at once, but not in the same map.

    Added loot modes 8-9 give all/one rewards to all players in same map.

    Added double exp and drop rates for 1 hour after boss is killed. Can be disabled.

    TODO: Loot modes select party members.

    I will try to update this if i forgot to add something.

    • Love 2
  13. 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 :)

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

  15. Hey,

    One way is to move this:

    set #Roll_Claimed,gettimetick(2) + ( .Hours * 3600 );

    In to the Item Apear List dialogue before next; like this:

    mes "Item Apear List :";
    mes "[ ^FF0000Required Items^000000 ] [ ^0000FFItem Gain^000000 ]";
    set #Roll_Claimed, gettimetick(2) + ( .Hours * 3600 );

    If player cancel the roll, the daily roll will be set anyway. So he can't re-roll ?

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

×
×
  • Create New...