Jump to content
  • 0

Transfering Party Leader on Death / Sharing Zeny with Party Members


Eross

Question


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.10
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

Hi guys ! I need a little help with my instance settings.. This is how this should work...

#1. Party of 2 to 5 members to finish an instance. If they a player die 3x inside the instance, that player should warp out and automatically transfer the leadership (if the died player is the leader) [RANDOMLY] to any party member, so that the instance wont break. the condition is that member should be ONLINE.. 

#2. When creating an instance the leader and members should share the quest price. For example the party has 4 members (including leader) and the amount to get quest is 10,000 zeny .. The NPC should check if party members and also the leader have enough zeny to pay for it .. so every member should have 2,500 zeny on their wallet.. 

here are my sample scripts .. Im really tired, apology if I messed up 
This first one is not organized yet and Im kinda confused what to do with this 

-	script	mh_ghall	-1,{
OnPCDieEvent:
	@die_count++;
	if (@die_count >= 1) {
		.@party_id = getcharid(1);
		if (is_party_leader(getcharid(1))) {
			getpartymember .@party_id, 1;
			party_changeleader(getcharid(1),$@partymembercid[rand(1,$@partymembercount)]);
		}
		
		party_delmember(getcharid(0));
		@die_count = 0;
		end;
	}
	end;


OnPCLogoutEvent:
	instance_destroy(instance_id(IM_PARTY));
	set @instance_name$, "";
	instance_active = 0;
} 

This is the creating of instance NPC 

		switch (@menu_instance) {
		case 1:			
		case 2:			
		case 3:			
		case 4:
			if (instance_active > 0) {
				mes .@name$;
				mes "You have already created one. Kindly destroy instance before getting new one.";
				end;
			}		
			instance_create(.@instance_name$[@menu_instance], IM_PARTY);
			set @instance_name$ , ""+.@instance_name$[@menu_instance]+"";
			instance_active = 1;
			break;
		case 5:
			mes .@name$;
			mes "Are you sure you want to destroy ["+.@instance_name$[@menu_instance]+"] instance?";
			switch (select("I'm 100% sure!","No, cancel it!")) {
				case 1:
					dispbottom "["+@instance_name$+"] instance has been destroyed.";
					instance_destroy(instance_id(IM_PARTY));
					specialeffect2 677;
					set @instance_name$, "";
					instance_active = 0;
					end;
					break;
				case 2:
					end;
			}			
		}

Thankyou ! 

Edited by Eross
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  68
  • Reputation:   8
  • Joined:  05/12/20
  • Last Seen:  

try this
 

-    script    mh_ghall    -1,{
OnPCDieEvent:

    // if !(INSTANCE X IS RUNNING) #todo
    //  end;
    
    @die_count++;
    if (@die_count >= 3) {
    
        // Clean player
        .@party_id = getcharid(1);     
        party_delmember(getcharid(0))
        warp "prontera",50,50;
        @die_count = 0;
        
        // Check if party leader
        if (!is_party_leader(.@party_id))
            end;
            
        // Set party var
        getpartymember .@party_id, 1;
        copyarray .@ptmembercid,$@partymembercid,$@partymembercount;
        
        // Remove offline members
        for (.@i = 0 ; .@i < $@partymembercount; .@i++){
            if (!isloggedin(.@ptmembercid[.@i]))
                deletearray .@partymembercid[.@i],1;
        }
        
        party_changeleader(.@party_id,convertpcinfo(.@partymembercid[rand(getarraysize(.@partymembercid))],CPC_CHAR));
        end;
    }
    end;
}

OnPCLogoutEvent:
    instance_destroy(instance_id(IM_PARTY));
    set @instance_name$, "";
    instance_active = 0;
} 


 

prontera,50,50,0    script    InstanceCreate    -1,{
    .price = 10000;
    getpartymember getcharid(0),1;
    .@individual_price = .price/$@partymembercount;
    for (.@i = 0 ; .@i < $@partymembercount; .@i++){
        if (readparam(Zeny,convertpcinfo($@partymembercid[.@i],CPC_CHAR)) > .@individual_price)
            .@c++;
    }
    if (.@c == $@partymembercount)
        // Start Event here
    
}

 

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