Portal-Zone Gothic-Zone Gothic II-Zone Gothic 3-Zone Gothic 4-Zone Modifikationen-Zone Download-Zone Foren-Zone RPG-Zone Almanach-Zone Spirit of Gothic

 

Ergebnis 1 bis 3 von 3
  1. Beiträge anzeigen #1 Zitieren
    Apprentice
    Registriert seit
    Mar 2020
    Beiträge
    26
     
    Khantor ist offline

    [Gothic II NotR] How to prevent enemies to drop their weapon after death?

    Hi! As in the title - could You please tell me how to prevent enemies to drop their weapon (or holding objects, like goblins) when drop unconscious?

  2. Beiträge anzeigen #2 Zitieren
    Ritter Avatar von Kirides
    Registriert seit
    Jul 2009
    Ort
    Norddeutschland
    Beiträge
    1.810
     
    Kirides ist offline
    See the following code example for Gothic 2 NotR.
    It shows how to do your own logic when the NPC is about to drop their weapons.

    In this example, no one will drop their wepons/shields, instead they will be put back into their inventory, still being equipped, thus the player can not collect them.

    Code:
    func void _Engine_oCNpc_RemoveFromSlot(var int npcPtr, var string SlotName, var int retVal, var int SlotID) {
        CALL_IntParam(SlotID);
        CALL_IntParam(retVal);
        CALL_zStringPtrParam(SlotName);
        CALL__thiscall(npcPtr, oCNpc__RemoveFromSlot);
    };
    
    func void _Npc_ClearHands(var int npcPtr) {
        _Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_RIGHTHAND", 0, 0);
        _Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_LEFTHAND", 0, 0);
        _Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_SWORD", 0, 0);
        _Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_LONGSWORD", 0, 0);
        _Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_BOW", 0, 0);
        _Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_CROSSBOW", 0, 0);
        _Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_SHIELD", 0, 0);
    };
    
    func void _oCNpc_DropAllInHand() {
        var int npcPtr; npcPtr = ESI;
        const int oCNpc_DropAllInHand_G2 = 7566816; // 0x007375e0
    
        CALL__thiscall(npcPtr, oCNpc_DropAllInHand_G2);
    };
    
    func void oCNpc_DropUnconscious_DropAllInHand() {
        MEM_Info("oCNpc_DropUnconscious_DropAllInHand");
        _Npc_ClearHands(ESI);
        // _oCNpc_DropAllInHand();
    };
    
    func void oCNpc_DoDie_DropAllInHand() {
        MEM_Info("oCNpc_DoDie_DropAllInHand");
        _Npc_ClearHands(ESI);
        // _oCNpc_DropAllInHand();
    };
    
    func void InitCustomDropAllInHand() {
        const int oCNpc_DropUnconscious_DropAllInHand_G2 = 7561131; // 0x00735fab
        const int oCNpc_DoDie_DropAllInHand_G2 = 7563416; // 0x00736898
    
        const int once = 1;
        if (once) {
            MemoryProtectionOverride(oCNpc_DropUnconscious_DropAllInHand_G2, 7);
            MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+1, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+2, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+3, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+4, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+5, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+6, ASMINT_OP_nop);
    
            MemoryProtectionOverride(oCNpc_DoDie_DropAllInHand_G2, 7);
            MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+1, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+2, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+3, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+4, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+5, ASMINT_OP_nop);
            MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+6, ASMINT_OP_nop);
    
            HookEngineF(oCNpc_DropUnconscious_DropAllInHand_G2, 7, oCNpc_DropUnconscious_DropAllInHand);
            HookEngineF(oCNpc_DoDie_DropAllInHand_G2, 7, oCNpc_DoDie_DropAllInHand);
            once = 0;
        };
    };
    Geändert von Kirides (21.08.2024 um 17:56 Uhr)

  3. Beiträge anzeigen #3 Zitieren
    Apprentice
    Registriert seit
    Mar 2020
    Beiträge
    26
     
    Khantor ist offline
    It's working and that's exactly what I was looking for. Thanks a lot!

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
Impressum | Link Us | intern
World of Gothic © by World of Gothic Team
Gothic, Gothic 2 & Gothic 3 are © by Piranha Bytes & Egmont Interactive & JoWooD Productions AG, all rights reserved worldwide