[1.10] Character start hook

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
Demon9ne
Dark Alliance Beta Test
Champion of the Light
Posts: 385
Joined: Mon Dec 20, 2004 6:01 am
Location: IL, USA

[1.10] Character start hook

Post by Demon9ne » Wed Feb 01, 2012 8:21 pm

A relatively simple question:

I'm looking for an ideal place to hook the game at character start, for some code that will run once at game entrance, when the character pops up in town. Can anyone recommend an address? Thanks.

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

Re: [1.10] Character start hook

Post by kidpaddle94 » Wed Feb 01, 2012 8:33 pm

on character creation only or every times you enter a game with any character?

User avatar
Demon9ne
Dark Alliance Beta Test
Champion of the Light
Posts: 385
Joined: Mon Dec 20, 2004 6:01 am
Location: IL, USA

Re: [1.10] Character start hook

Post by Demon9ne » Wed Feb 01, 2012 8:36 pm

Every time. I need it to be when a character appears, after the character data is loaded.

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
South Africa

Hand-picked

Re: [1.10] Character start hook

Post by Necrolis » Thu Feb 02, 2012 8:51 am

Hook D2Game.0x6FC8EF20:

Code: Select all

DWORD __fastcall D2ProcessSaveFile(D2GameStrc* pGame, D2ClientStrc* pClient, BYTE* pSaveFile, size_t nSize, D2UnitStrc** ppPlayer, DWORD dw1, DWORD dw2, DWORD dw3)
Unfortunately it must be this as internally there is a branch for new players/loaded players. just remember to call it first, and you'll have a fully inited player
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

User avatar
Demon9ne
Dark Alliance Beta Test
Champion of the Light
Posts: 385
Joined: Mon Dec 20, 2004 6:01 am
Location: IL, USA

Re: [1.10] Character start hook

Post by Demon9ne » Thu Feb 02, 2012 11:00 pm

Thanks Nec. Works well.

Also, a poor/lazy coder's solution to new players vs. those already present:

if (Experience == 0) {
do new player stuff
+1 Experience!
}

When players ask why they start with 1 experience, simply tell them "Backstory."

Return to “Code Editing”