[1.13c] Help Cube.

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

User avatar
thaison
Junior Member
Paladin
Posts: 108
Joined: Fri Apr 03, 2015 11:59 am
Location: Viet Nam
Vietnam

[1.13c] Help Cube.

Post by thaison » Fri Jun 02, 2017 1:14 pm

I'm testing this code with a fixed level number, it worked perfectly :)

Code: Select all

DWORD FASTCALL Cube_RedPortal(Game* ptGame, Unit* ptChar)
{
	Position pos;
	D2COMMON_D2GetPosition(ptChar, &pos);
	int ret = OpenRedPortal(ptGame, ptChar, 38); //38 - Tristram
	return ret;
}

But I try to make the custom level number on the cubemain, it crashed

Code: Select all

D2FUNC(D2COMMON, D2GetCubeMainTxt, CubeMainTxt*, __stdcall, (DWORD cubemainID), 0x1B890)

DWORD FASTCALL Cube_RedPortal(Game* ptGame, Unit* ptChar)
{
	CubeMainTxt* pCube = D2COMMON_D2GetCubeMainTxt(ptChar->nTxtFileNo);
	Position pos;
	D2COMMON_D2GetPosition(ptChar, &pos);
	int ret = OpenRedPortal(ptGame, ptChar, pCube->value);
	return ret;
}

User avatar
kidpaddle94
Forum Legend
Principality
Posts: 2057
Joined: Thu Aug 13, 2009 2:54 pm
Location: localhost
Canada

Re: [1.13c] Help Cube.

Post by kidpaddle94 » Sat Jun 03, 2017 7:45 pm

Why are you retrieving the cubemain record based on the player's class? Also not sure why you're retrieving the player's pos to not use it after.

Return to “Code Editing”