[LE] Weapon Poison replace and remove in Creation Kit and Modders Posted February 12, 2017 · Edited February 12, 2017 by kelamor Hello! With plugin "Infinite Weapon Poison" (author meh321, Nexus link for plugin and its source- http://www.nexusmods.com/skyrim/mods/64142/?) I can replace and remove poisons on weapon and it is really cool! But Infinite shots break my mod that add in Alchemy a perk that give 10 poison shots (or more with more Alchemy points). Please, help me to edit this plugin and remove infinite poison shots.Or advice me how can I do it self? Below is the code of main.cpp from source of plugin "Infinite Weapon Poison".I modify it for two days, but was not able to remove infinite poison shots ((( --------------------- code -------------------------------------------------------------------------typedef unsigned char UInt8; //!< An unsigned 8-bit integer valuetypedef unsigned short UInt16; //!< An unsigned 16-bit integer valuetypedef unsigned long UInt32; //!< An unsigned 32-bit integer valuetypedef unsigned long long UInt64; //!< An unsigned 64-bit integer valuetypedef signed char SInt8; //!< A signed 8-bit integer valuetypedef signed short SInt16; //!< A signed 16-bit integer valuetypedef signed long SInt32; //!< A signed 32-bit integer valuetypedef signed long long SInt64; //!< A signed 64-bit integer valuetypedef float Float32; //!< A 32-bit floating point valuetypedef double Float64; //!< A 64-bit floating point value #include "Windows.h"#include "skse/PluginAPI.h"#include "skse/skse_version.h" int allowOverwrite1 = 0x7462CD;int allowOverwrite2 = 0x7462D4; int isPoison1 = 0x4757B0; int reducePoison1 = 0x475810;int reduceCharge1 = 0x410711;int reduceCharge2 = 0x410719; int doRemove = 0; extern "C"{ bool SKSEPlugin_Query(const SKSEInterface * skse, PluginInfo * info) { // populate info structure info->infoVersion = PluginInfo::kInfoVersion; info->name = "item poison plugin"; info->version = 1; if (skse->isEditor || skse->runtimeVersion != RUNTIME_VERSION_1_9_32_0) return false; return true; } bool SKSEPlugin_Load(const SKSEInterface * skse) { void * jumpAddress1 = NULL; void * jumpAddress2 = NULL; _asm { mov jumpAddress1, offset IPCodeStart jmp IPCodeEnd IPCodeStart: mov ecx, esi mov doRemove, 1 call reducePoison1 mov ecx, esi call isPoison1 test eax, eax jmp allowOverwrite2 IPCodeEnd: } _asm { mov jumpAddress2, offset RPCodeStart jmp RPCodeEnd RPCodeStart: test ecx, ecx jbe RPBack cmp doRemove, 0 je RPBack mov doRemove, 0 mov ecx, 0 mov [eax+8], ecx RPBack: jmp reduceCharge2 RPCodeEnd: } DWORD oldProtect = 0; int len2 = allowOverwrite2 - allowOverwrite1; if (VirtualProtect((void *)allowOverwrite1, len2, PAGE_EXECUTE_READWRITE, &oldProtect)) { *((unsigned char *)allowOverwrite1) = (unsigned char)0xE9; *((int *)(allowOverwrite1 + 1)) = (int)jumpAddress1 - allowOverwrite1 - 5; for (int i = 5; i < len2; i++) *((unsigned char *)(i + allowOverwrite1)) = (unsigned char)0x90; VirtualProtect((void *)allowOverwrite1, len2, oldProtect, &oldProtect); } int len1 = reduceCharge2 - reduceCharge1; if (VirtualProtect((void *)reduceCharge1, len1, PAGE_EXECUTE_READWRITE, &oldProtect)) { *((unsigned char *)reduceCharge1) = (unsigned char)0xE9; *((int *)(reduceCharge1 + 1)) = (int)jumpAddress2 - reduceCharge1 - 5; for (int i = 5; i < len1; i++) *((unsigned char *)(i + reduceCharge1)) = (unsigned char)0x90; VirtualProtect((void *)reduceCharge1, len1, oldProtect, &oldProtect); } return true; }};--------------------------------------------------------------------------------
[LE] Weapon Poison replace and remove
in Creation Kit and Modders
Posted · Edited by kelamor
Hello!
With plugin "Infinite Weapon Poison" (author meh321, Nexus link for plugin and its source- http://www.nexusmods.com/skyrim/mods/64142/?)
I can replace and remove poisons on weapon and it is really cool!
But Infinite shots break my mod that add in Alchemy a perk that give 10 poison shots (or more with more Alchemy points).
Please, help me to edit this plugin and remove infinite poison shots.
Or advice me how can I do it self?
Below is the code of main.cpp from source of plugin "Infinite Weapon Poison".
I modify it for two days, but was not able to remove infinite poison shots (((
--------------------- code -------------------------------------------------------------------------
typedef unsigned char UInt8; //!< An unsigned 8-bit integer value
typedef unsigned short UInt16; //!< An unsigned 16-bit integer value
typedef unsigned long UInt32; //!< An unsigned 32-bit integer value
typedef unsigned long long UInt64; //!< An unsigned 64-bit integer value
typedef signed char SInt8; //!< A signed 8-bit integer value
typedef signed short SInt16; //!< A signed 16-bit integer value
typedef signed long SInt32; //!< A signed 32-bit integer value
typedef signed long long SInt64; //!< A signed 64-bit integer value
typedef float Float32; //!< A 32-bit floating point value
typedef double Float64; //!< A 64-bit floating point value
#include "Windows.h"
#include "skse/PluginAPI.h"
#include "skse/skse_version.h"
int allowOverwrite1 = 0x7462CD;
int allowOverwrite2 = 0x7462D4;
int isPoison1 = 0x4757B0;
int reducePoison1 = 0x475810;
int reduceCharge1 = 0x410711;
int reduceCharge2 = 0x410719;
int doRemove = 0;
extern "C"
{
bool SKSEPlugin_Query(const SKSEInterface * skse, PluginInfo * info)
{
// populate info structure
info->infoVersion = PluginInfo::kInfoVersion;
info->name = "item poison plugin";
info->version = 1;
if (skse->isEditor || skse->runtimeVersion != RUNTIME_VERSION_1_9_32_0)
return false;
return true;
}
bool SKSEPlugin_Load(const SKSEInterface * skse)
{
void * jumpAddress1 = NULL;
void * jumpAddress2 = NULL;
_asm
{
mov jumpAddress1, offset IPCodeStart
jmp IPCodeEnd
IPCodeStart:
mov ecx, esi
mov doRemove, 1
call reducePoison1
mov ecx, esi
call isPoison1
test eax, eax
jmp allowOverwrite2
IPCodeEnd:
}
_asm
{
mov jumpAddress2, offset RPCodeStart
jmp RPCodeEnd
RPCodeStart:
test ecx, ecx
jbe RPBack
cmp doRemove, 0
je RPBack
mov doRemove, 0
mov ecx, 0
mov [eax+8], ecx
RPBack:
jmp reduceCharge2
RPCodeEnd:
}
DWORD oldProtect = 0;
int len2 = allowOverwrite2 - allowOverwrite1;
if (VirtualProtect((void *)allowOverwrite1, len2, PAGE_EXECUTE_READWRITE, &oldProtect))
{
*((unsigned char *)allowOverwrite1) = (unsigned char)0xE9;
*((int *)(allowOverwrite1 + 1)) = (int)jumpAddress1 - allowOverwrite1 - 5;
for (int i = 5; i < len2; i++)
*((unsigned char *)(i + allowOverwrite1)) = (unsigned char)0x90;
VirtualProtect((void *)allowOverwrite1, len2, oldProtect, &oldProtect);
}
int len1 = reduceCharge2 - reduceCharge1;
if (VirtualProtect((void *)reduceCharge1, len1, PAGE_EXECUTE_READWRITE, &oldProtect))
{
*((unsigned char *)reduceCharge1) = (unsigned char)0xE9;
*((int *)(reduceCharge1 + 1)) = (int)jumpAddress2 - reduceCharge1 - 5;
for (int i = 5; i < len1; i++)
*((unsigned char *)(i + reduceCharge1)) = (unsigned char)0x90;
VirtualProtect((void *)reduceCharge1, len1, oldProtect, &oldProtect);
}
return true;
}
};
--------------------------------------------------------------------------------