Jump to content
  • 0

NPC register... Please help me


joyy95

Question


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.09
  • Content Count:  51
  • Reputation:   0
  • Joined:  06/28/23
  • Last Seen:  

Quote

payon,210,168,5    script    Pietri#LMPQ_Register    4_M_PIERROT,{
    OnTalk:
        doevent "lmpq_main::OnRegister";
    end;
    OnInit:
        while (true) { // this loop will run forever
            delwaitingroom;
            waitingroom "Party Quest: "+getmapusers("new_zone04")+" Players",0; //
            sleep 1000; // sleep for 1 second (1000 ms)
        }
    end;

}

new_zone04,100,29,4    script    Pietri#LMPQ    4_M_PIERROT,{
    // changecamera(424, 42, -31);
    if (strnpcinfo(2) == "LMPQ") {
        doevent "lmpq_main::OnTalk";
    }
    else {
        sscanf(strnpcinfo(2), "%d-%d", .@room, .@portal);
        mes "^0055FF[ "+strnpcinfo(1)+" ]^000000";
        mes "You're currently at Room #"+.@room;
        mes " ";
        mes " ";
        mes "^777777Now you have to decide. Which portals will lead you to Room 16?^000000";
        close;
    }
    end;
    
    OnTouch:
        sscanf(strnpcinfo(2), "%d-%d", .@room, .@portal);
        if (.@portal == 1) {
            .@room = (.@room + 4) % 16;
        }
        else if (.@portal == 2) {
            .@room = (.@room + 7) % 16;
        }
        else if (.@portal == 3) {
            .@room = (.@room - 3) % 16;
            if (.@room < 0) 
                .@room = 16 + .@room;
        }
        else {
            showscript "Invalid Portal#"+strnpcinfo(2);
            end;
        }
        .@room = (.@room % 16);
        if (.@room == 0) {
            if (!getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC, "Pietri#LMPQ")) {
                warp .@map$, .@x, .@y - rand(5, 10);
            }
        }
        else if (!getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC, "Pietri#"+.@room+"-2")) {
            warp .@map$, .@x, .@y + rand(5, 15);
            showscript "<LMPQ> You entered Room #"+.@room;
        }
        else {
            showscript "Invalid Portal#"+strnpcinfo(2);
        }
        end;
        
    OnLMPQEnable:
        sscanf(strnpcinfo(2), "%d-%d", .@room, .@portal);
        if (.@room > 0 && .@portal == 0) {
            delwaitingroom;
            waitingroom "LMPQ Room # "+.@room, 0;
        }
        end;
        
    OnLMPQDisable:
        delwaitingroom;
        end;
}

-    script    Pietri::lmpq_main    -1,{
    
    OnInit:
        // ticket ItemID + amount
        .nameid = 45350;
        .amount = 100;
        // bonus EXP given for each tickets
        .exp_per_item = 1;
        // Quest duration (minute)
        .duration = 15;
        // Required party member
        .min_pt_member = 2;
        
        // Announcements within the map.
        setarray .announce$,
            "This party quest is to collect at least "+.amount+"x "+getitemname(.nameid)+" by killing monsters.",
            "You only have 10 minutes to finish this quest. Or you will be warped back to town.",
            "Bring the items to [Pietri] who will be waiting for you all at the last room (Room 16).",
            "Each room of the maze consists of 3 portals (with the exception of Room 16).",
            "Its absolutely vital for party members to follow the party leaders instructions so that all of you will not be lost.",
            "Once you reach Room 16 with the tickets, talk to the NPC [Pietri] ",
            "Treasure box it will spawn the mobs. After killing them...",
            "You'll have more chance to get more Proof Of Donation",
            "Completed the quest, you will receive 300 Proof Of Donation and 500 Skulls.",
            "That's all information for you all. Get ready, Party quest be starting now...";
        .announce_size = getarraysize(.announce$);
        
        getmapxy(.map$, .@x, .@y, UNITTYPE_NPC, "Pietri#LMPQ");
        setmapflag .map$, mf_noteleport;
        setmapflag .map$, mf_nowarp;
        setmapflag .map$, mf_nowarpto;
        setmapflag .map$, mf_nobranch;
        setmapflag .map$, mf_nosave;
        setmapflag .map$, mf_nomemo;
        setmapflag .map$, mf_noskill;
        setmapflag .map$, mf_nomobloot;
        
        getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC, "Pietri#LMPQ_Register");
        mapwarp .map$, .@map$, .@x, .@y;

        // bindatcmd("lmpq", strnpcinfo(3)+"::OnRoomWarp"); // quick access for each room.
        end;

        
    OnRoomWarp:
        if (getgmlevel() >= 99){
            .@room = atoi(.@atcmd_parameters$[0]);
            callsub(L_Warp, .@room);
        }
        end;
    
    L_Warp:
        .@room = getarg(0, 0);
        if (!getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC, "Pietri#"+.@room+"-2")) {
            warp .@map$, .@x, .@y + 15;
        }
        else {
            showscript "Invalid Portal#"+.@room;
        }
        return;
        
OnRegister:
    .@party_id = getcharid(1);
    .@is_leader = (getcharid(0) == getpartyleader(.@party_id, 2));

    mes "^0055FF[ "+strnpcinfo(1)+" ]^000000";
    if (.status || getmapusers(.map$) > 0) {
        mes "Sorry, Currently another party are currently challenging the party quest now.";
        mes "Try again later...";
        close;
    }

    if (.party_id > 0) {
        mes "Sorry, another party has already registered.";
        close;
    }

    if (!.@is_leader) {
        mes "You're not party leader.";
        close;
    }

    if (.min_pt_member > 0 && !instance_check_party(.@party_id, .min_pt_member)) {
        mes "Sorry, we required at least "+.min_pt_member+" online party members to participate this party quest.";
        mes "Try again later.";
        close;
    }

    mes "Are you sure you want to register for the Party Quest?";
    mes "- NO SKILL MAP";
    mes "- NO DUAL CLIENT";
    switch (select("Yes:No")) {
        case 1: // Yes
            // Check if the current date is the same as the one stored for the player
            if (#PARTY_QUEST_DATE == gettime(DT_DAYOFYEAR)) {
                // If the current date is the same, check if the player has done the quest five times already
                if (#PARTY_QUEST_COUNT >= 10) {
                    mes "You have already participated in the party quest 5 times today.";
                    mes "Please come back tomorrow.";
                    close;
                } else {
                    // If the player has done the quest less than 5 times, increment the counter
                    #PARTY_QUEST_COUNT++;
                }
            } else {
                // If the current date is not the same as the one stored for the player
                // (i.e., the player is attempting the quest on a new day), reset the counter and store the current date
                #PARTY_QUEST_DATE = gettime(DT_DAYOFYEAR);
                #PARTY_QUEST_COUNT = 1;
            }

            .party_id = .@party_id;
            .status = 1;
            mes "Your party has successfully registered for the Party Quest.";
            close2;
            donpcevent strnpcinfo(3)+"::OnStart";
            end;
        case 2: // No
            mes "Alright, let me know if you change your mind.";
            close;
    }
    close;

Rest of code.........

 

Hello this is my script... A party leader can register this quest ... if party leader reach 5 times a day.. Cant register....

But this script when the party leader leave his party and join another party leader who not yet reach the register reach 5 times... it will follow too...

 Iwant prevent the registration of the party if any member has already participated 5 times in the same day.
Party leader register need check all member if one of the member has reach the limit.. cant register

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   87
  • Joined:  06/30/18
  • Last Seen:  

It is hard to help you when parts of the NPC are missing.

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