What's new

[8.1][C++] OnDiePlayer

Status
Not open for further replies.
Joined
Aug 15, 2008
Messages
64
Reaction score
8
Znalaz?em kod c++ "OnDiePlayer". Jest on oparty na funkcji "onDie". Nie dotyczy potwor?w, lecz player?w.

Zaczynajmy:

w pliku creature.cpp pod:
Code:
//scripting event - onDie
CreatureEvent* eventDie = getCreatureEvent(CREATURE_EVENT_DIE);
if(eventDie){
eventDie->executeOnDie(this, corpse);
}

dodajemy:
Code:
#ifdef ON_PLAYER_DIE_DZOJO    
    if(this->getPlayer()){
         g_creatureEvents->playerDie(this->getPlayer(), corpse);
    }
#endif

Otwieramy plik creatureevent.cpp :

Pod:
Code:
m_logOutEvent = NULL;

Dodajemy:
Code:
#ifdef ON_PLAYER_DIE_DZOJO    
    m_playerDieEvent = NULL;
#endif

nast?pnie pod:
Code:
delete m_logOutEvent;

Wstawiamy:
Code:
#ifdef ON_PLAYER_DIE_DZOJO    
    delete m_playerDieEvent;
#endif

Pod:
Code:
case CREATURE_EVENT_LOGOUT:
delete m_logOutEvent;
m_logOutEvent = creatureEvent;
return true;

Dajemy:
Code:
#ifdef ON_PLAYER_DIE_DZOJO        
    case CREATURE_EVENT_DIE_PLAYER:
        delete m_playerDieEvent;
        m_playerDieEvent = creatureEvent;
        return true;
#endif

Nad tym:
Code:
uint32_t CreatureEvents::playerLogOut(Player* player)
{
// fire global event if is registered
if(m_logOutEvent){
return m_logOutEvent->executeOnLogout(player);
}
return 0;
}

Wpisujemy to:
Code:
#ifdef ON_PLAYER_DIE_DZOJO    
uint32_t CreatureEvents::playerDie(Player* player, Item* corpse)
{
    // fire global event if is registered
    if(m_playerDieEvent){
        return m_playerDieEvent->executeOnDiePlayer(player, corpse);
    }
        return 0;
    }    
#endif

Pod:"
Code:
else if(str == "die"){
m_type = CREATURE_EVENT_DIE;
}

Dajemy:
PHP:
#ifdef ON_PLAYER_DIE_DZOJO        
        else if(str == "dieplayer"){
            m_type = CREATURE_EVENT_DIE_PLAYER;
        }
#endif

Poni?ej:
Code:
case CREATURE_EVENT_DIE:
return "onDie";
break;

Wpisujemy:
PHP:
#ifdef ON_PLAYER_DIE_DZOJO        
    case CREATURE_EVENT_DIE_PLAYER:
        return "onDiePlayer";
        break;
#endif

Teraz zajmiemy si? plikiem creatureevent.h:

Pod:
Code:
uint32_t playerLogOut(Player* player);

Dodajemy:
PHP:
#ifdef ON_PLAYER_DIE_DZOJO    
    uint32_t playerDie(Player* player, Item* corpse);
#endif

Poni?ej:
Code:
uint32_t executeOnDie(Creature* creature, Item* corpse);

Dodajemy:
PHP:
#ifdef ON_PLAYER_DIE_DZOJO    
    uint32_t executeOnDiePlayer(Player* player, Item* corpse);
#endif

Pod:
Code:
CreatureEvent* m_logOutEvent;

Dodajemy:
PHP:
#ifdef ON_PLAYER_DIE_DZOJO       
    CreatureEvent* m_playerDieEvent;
#endif

Poni?ej:
Code:
CREATURE_EVENT_DIE,

Wklejamy:
PHP:
#ifdef ON_PLAYER_DIE_DZOJO
    CREATURE_EVENT_DIE_PLAYER,
#endif


No to ju? wszystko, teraz tylko musimy wej?? w opcje projektu i wklei? to:
Code:
-DON_PLAYER_DIE_DZOJO


Pozdrawiam,
Banco Rozbujca
 

Mateusz7125

Advanced User
Joined
Apr 13, 2008
Messages
192
Reaction score
6
Mo?esz bardziej obja?ni? o co chodzi w tym skrypcie??

Dodaje jak?? fukcje OnDie? Ale po co? ...
 

T O M E K

Active User
Joined
Apr 5, 2008
Messages
97
Reaction score
10
Age
31
@up
Dzi?ki tej funkcji mo?esz np zrobi? ?e jak padniesz to w dedzie masz ko?? m?zg lub inny item i na niej pisz? twoje dane czyli nick itd
@topic
stary skrypt ale nie by?o go tu wi?c dobrze ? go doda?e?
 
Last edited:

Zexarm

User
Joined
Jul 25, 2008
Messages
38
Reaction score
1
Odp: [8.1][C++] OnDiePlayer

Taki podobny scrypt jest na Stigma Ots 8.1 ?e jak padniesz to w dedzie jest serce i pisze : (nick) zmar? na (lvl postaci) przez (nick zabujcy,albo nazwa potwora)
 

Unwanted

User
Joined
Oct 2, 2008
Messages
10
Reaction score
0
Odp: [8.1][C++] OnDiePlayer

onDie/onDeath jest teraz w ka?dym engine, dlatego nie rozumiem po co taki kod :eek:
 
Last edited:

Stachuzo

Active User
Joined
Jul 30, 2008
Messages
64
Reaction score
1
Odp: [8.1][C++] OnDiePlayer

jakby? m?g? to podaj ca?o?? skryptu bo ja nie mam tej wersji
//scripting event - onDie
CreatureEvent* eventDie = getCreatureEvent(CREATURE_EVENT_DIE);
if(eventDie){
eventDie->executeOnDie(this, corpse);
}
 

olgierd555

Senior User
Joined
May 28, 2008
Messages
650
Reaction score
21
Odp: [8.1][C++] OnDiePlayer

a gdzie pisze jaki to item?
 

Matixy

Active User
Joined
Jun 15, 2008
Messages
123
Reaction score
2
Odp: [8.1][C++] OnDiePlayer

masz w items.xml chyba i po id sprawdzasz co to za item
 
Status
Not open for further replies.
Top