Domanda [DOMANDA]give_item2 a ogni membro di un gruppo

Stato
Discussione chiusa ad ulteriori risposte.

Th3~J0k3r

Utente Emerald
18 Agosto 2011
1,435
59
148
423
Ciao ragazzi, volevo chiedervi se fosse possibile usare il comando give_item2 per un gruppo, cioè dare un item con relativa quantità a ogni membro di tale gruppo.

Ogni strada per arrivare alla soluzione è accettata. :)

P.S. Possibilmente senza applicare modifiche alla source.
 
Identificativo intendi il VID ? Ma la give_item non ha il vid come parametro (se è quello che intendi)
Prima che arrivi anyone con modifiche stravolgenti al source, puoi fare tutto con le funzioni già presenti tramite quest :asd:
Codice:
function party.give_item(vnum, count)
        -- ti restituisce l'id di tutti i membri del gruppo
        local pids = {party.get_member_pids()}
        for i, pid in ipairs/pairs(pids) do
                -- seleziona un personaggio del gruppo
               q.begin_other_pc_block(pid)
               pc.give_item2(vnum, count)
               q.end_other_pc_block(pid)
        end
end
 
Ultima modifica:
Prima che arrivi anyone con modifiche stravolgenti al source, puoi fare tutto con le funzioni già presenti tramite quest :asd:
Codice:
function party.give_item(vnum, count)
        -- ti restituisce l'id di tutti i membri del gruppo
        local pids = {party.get_member_pids()}
        for i, pid in ipairs/pairs(pids) do
                -- seleziona un personaggio del gruppo
               q.begin_other_pc_block(pid)
               pc.give_item2(vnum, count)
               q.end_other_pc_block(pid)
        end
end
Non potevo chiedere di meglio, proprio quello che mi serviva ;)
edit.
 
Riapro, ho chiuso troppo in fretta, e purtroppo non funziona, probabilmente mi manca qualche altre funzione @Goddamn. tipo la party.get_member_pids, dato che nel quest_functions non c'è.
 
Prima che arrivi anyone con modifiche stravolgenti al source, puoi fare tutto con le funzioni già presenti tramite quest :asd:
Codice:
function party.give_item(vnum, count)
        -- ti restituisce l'id di tutti i membri del gruppo
        local pids = {party.get_member_pids()}
        for i, pid in ipairs/pairs(pids) do
                -- seleziona un personaggio del gruppo
               q.begin_other_pc_block(pid)
               pc.give_item2(vnum, count)
               q.end_other_pc_block(pid)
        end
end
Caro avevo detto che non servivano modifiche source quindi
 
Quel pezzo di codice è preso dalla quest della gameforge del dungeon di ghiaccio (nemere) e riadattato.
Coi file 40k funziona...
Sei sicuro di aver aggiunto a quest_functions? Ti da errori durante la compilazione della quest? Se si, quali?
Oppure non funziona in game? Se non funziona in game, metti TEST_MODE = 1 nei config e ti dovrebbe uscire un errore nella chat mentre provi ad eseguire quella funzione. In tal caso scrivilo qui.
 
Quel pezzo di codice è preso dalla quest della gameforge del dungeon di ghiaccio (nemere) e riadattato.
Coi file 40k funziona...
Sei sicuro di aver aggiunto a quest_functions? Ti da errori durante la compilazione della quest? Se si, quali?
Oppure non funziona in game? Se non funziona in game, metti TEST_MODE = 1 nei config e ti dovrebbe uscire un errore nella chat mentre provi ad eseguire quella funzione. In tal caso scrivilo qui.
- Uso i 40k
- Si sono sicuro di aver aggiunto la riga party.get_member_pids nel quest_functions
- Non mi da nessun errore di compilazione
- Non funziona semplicemente in game

Credo che non funzioni per il semplice motivo che non c'è proprio implementata quella funzione nel source (come mi ha consigliato di guardare @Anyone )
 
- Uso i 40k
- Si sono sicuro di aver aggiunto la riga party.get_member_pids nel quest_functions
- Non mi da nessun errore di compilazione
- Non funziona semplicemente in game

Credo che non funzioni per il semplice motivo che non c'è proprio implementata quella funzione nel source (come mi ha consigliato di guardare @Anyone )
Fai l'altra cosa che ti ho detto. Metti in test mode e posta qui l'errore lua.
Dovresti anche trovarlo nel syserr o nel syslog
 
Fai l'altra cosa che ti ho detto. Metti in test mode e posta qui l'errore lua.
Dovresti anche trovarlo nel syserr o nel syslog
Non mi fa neanche loggare col test mode a 1, appena loggo col pg mi crasha alla selezione del personaggio (andiamo bene :asd:)
Ecco cosa mi da nei syserr ch1
Codice:
SYSERR: Jul  3 21:17:00.4414 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:03.14361 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:06.14368 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:09.14357 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:12.5436 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:15.14400 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:18.4666 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:21.4469 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:24.14575 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:27.4388 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:30.4596 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:33.5551 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:36.14604 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:39.15354 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:42.4422 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:45.34465 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:48.4492 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:51.5234 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:54.4533 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:57.4464 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:18:00.5813 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:18:03.14881 :: socket_connect: HOST 0:27206, could not connect.
 
Non mi fa neanche loggare col test mode a 1, appena loggo col pg mi crasha alla selezione del personaggio (andiamo bene :asd:)
Ecco cosa mi da nei syserr ch1
Codice:
SYSERR: Jul  3 21:17:00.4414 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:03.14361 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:06.14368 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:09.14357 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:12.5436 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:15.14400 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:18.4666 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:21.4469 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:24.14575 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:27.4388 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:30.4596 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:33.5551 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:36.14604 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:39.15354 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:42.4422 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:45.34465 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:48.4492 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:51.5234 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:54.4533 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:57.4464 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:18:00.5813 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:18:03.14881 :: socket_connect: HOST 0:27206, could not connect.
Non c'entra niente sta giù il db. Non mi ricordo se l'opzione si chiami test mode o test server. Cerca e attivala.....
 
Non mi fa neanche loggare col test mode a 1, appena loggo col pg mi crasha alla selezione del personaggio (andiamo bene :asd:)
Ecco cosa mi da nei syserr ch1
Codice:
SYSERR: Jul  3 21:17:00.4414 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:03.14361 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:06.14368 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:09.14357 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:12.5436 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:15.14400 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:18.4666 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:21.4469 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:24.14575 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:27.4388 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:30.4596 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:33.5551 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:36.14604 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:39.15354 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:42.4422 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:45.34465 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:48.4492 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:51.5234 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:54.4533 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:17:57.4464 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:18:00.5813 :: socket_connect: HOST 0:27206, could not connect.
SYSERR: Jul  3 21:18:03.14881 :: socket_connect: HOST 0:27206, could not connect.
TEST_SERVER: 1
 
Ecco i comandi da aggiungere in questlua_party.cpp:

C++:
//search :
    void RegisterPartyFunctionTable()

//ADD BEFORE -WARNING BEFORE-

    struct FPartyPIDCollector
    {
        std::vector <DWORD> vecPIDs;
        FPartyPIDCollector()
        {
        }
        void operator() (LPCHARACTER ch)
        {
            vecPIDs.push_back (ch->GetPlayerID());
        }
    };

    int party_get_member_pids (lua_State* L)
    {
        CQuestManager& q = CQuestManager::instance();
        LPCHARACTER ch = q.GetCurrentCharacterPtr();
        LPPARTY pParty = ch->GetParty();
        if (NULL == pParty)
        {
            return 0;
        }
        FPartyPIDCollector f;
        pParty->ForEachOnMapMember (f, ch->GetMapIndex());

        for (auto it = f.vecPIDs.begin(); it != f.vecPIDs.end(); it++)
        {
            lua_pushnumber (L, *it);
        }
        return f.vecPIDs.size();
    }


//search :

            { "setqf",                    party_set_quest_flag        },
            { "chat",                    party_chat                    },
            { "syschat",                party_syschat                },
            { "get_near_count",            party_get_near_count        },
            { "show_cinematic",            party_show_cinematic        },
            { "run_cinematic",            party_run_cinematic            },
            { "get_max_level",            party_get_max_level            },
            { "clear_ready",            party_clear_ready            },
            { "is_in_dungeon",            party_is_in_dungeon            },
            { "give_buff",                party_give_buff                },
            { "is_map_member_flag_lt",    party_is_map_member_flag_lt    },

//add a new  function in function_table :

 
            { "get_member_pids",        party_get_member_pids        },

non so se ti possono servire , se davvero non le hai..
comunque se usassi la source che mi hai chiesto di mandarti (e che ti ho mandanto) non avresti questo problema (nemmeno il problema del crash db con test server).
 
Stato
Discussione chiusa ad ulteriori risposte.
Indietro
Top Bottom