Showing results 1 to 8 of 8

Thread: Questions About Coding DLL's

  1. #1

    Default Questions About Coding DLL's

    I am currently working on my first dll. I've read "Yonderknight's Unit Alert Tutorial!" and understand it pretty well.

    The problem:
    I am not really sure how to command units once they have been created. I can figure out the unit counts, who owns them, and what they are, but how do I actually issue commands to the the unit just created?

    The dll I am making is pretty simple. Upon making a drone, it will instantly go to the closest mineral patch and begin mining.

    Any help given will be appreciated!

    --
    overwhelmed

  2. #2
    C2 100E Senior Member
    Developer

    Blessed
    p00onu's Avatar
    Join Date
    Mar 2005
    Location
    Reno, NV
    Posts
    2,188

    Default

    Ok first off, good job on following the tutorial.

    I will warn you that making this hack will not be as easy as the unit alert.

    So your pseudocode should look like this:
    Unit created, get unit id, select unit, get closest mineral patch, issue the mine command on the mineral patch.

    Next, you will need to find the select unit function. Start by finding the selected unit buffer. Have nothing selected and search for 0, select something and search for has changed, etc... Once you find it, set a write bp on it and select something. When it pops, step out one or two times and you should be right after the select unit function call.

    Next you will have to get the map coordinates of your command center/nexus/hatchery and then scroll thru the unit list and compare coords to find out which patch is closest to your main.

    Next you would need to issue the mine command on the mineral patch with your newly created worker selected.

    It looks like you have your work cut out for you. Good luck.

    I get laid.
    Quote Originally Posted by The most intelligent hellinsect
    blizzard is targeting my computer

  3. #3

    Default

    Quote Originally Posted by p00onu View Post
    It looks like you have your work cut out for you. Good luck.
    Thanks for the advice! I will get working on this, and let you know what other snags I come across

    Thanks again!

    --
    overwhelmed

  4. #4
    =) Senior Member
    Developer

    Supreme Being
    K? Pŕo?ćtiόnŹ's Avatar
    Join Date
    Oct 2004
    Posts
    11,794

    Default

    This function may prove handy
    Code:
    Distance2D proc x1:DWORD,y1:DWORD,x2:DWORD,y2:DWORD
    LOCAL retdd:DWORD
    	pushad
    	mov eax,x2
    	sub eax,x1
    	mov ebx,y2
    	sub ebx,y1
    	imul eax,eax
    	imul ebx,ebx
    	add eax,ebx
    	invoke IntSqrt,eax
    	mov retdd,eax
    	popad
    	mov eax,retdd
    	ret
    Distance2D endp
    IntSqrt can be found in masm's library..
    Quote Originally Posted by Voice Of Korhal View Post
    Let us hope so, if that Reverse Engineering crap actually works, I'll be amazed.

  5. #5
    Senior Member
    Retired Staff Member

    Inquisitor
    SC_Modder's Avatar
    Join Date
    Nov 2004
    Posts
    4,836

    Default

    Square rooting the distances might not be necessary, you could omit doing it for performance reasons and instead compare the un-square rooted numbers, since the relationship between the values will still represent the distance relatively.

  6. #6
    =) Senior Member
    Developer

    Supreme Being
    K? Pŕo?ćtiόnŹ's Avatar
    Join Date
    Oct 2004
    Posts
    11,794

    Default

    but then you cant use it in other applications, and also what if the number is bigger than a dword? That would suck, yah.
    Quote Originally Posted by Voice Of Korhal View Post
    Let us hope so, if that Reverse Engineering crap actually works, I'll be amazed.

  7. #7
    Programmer/PC Enthusiast Developer
    Gold Member

    Enlightened
    AgentGOD's Avatar
    Join Date
    Jul 2004
    Location
    127.0.0.1
    Posts
    2,760

    Default

    Lol, I was about to say... distance formula.
    Case: Antec 900
    CPU: Q9650 @ 4.0 GHz [IntelBurnTest stable]
    GPU: ATI Radeon HD6950 UL
    Motherboard: ASUS P5Q Deluxe
    Memory: 8 GB (4x 2 GB) OCZ Reaper HPC DDR2 1066
    Sound: Creative SB X-Fi Fatal1ty Pro
    PSU: Corsair AX-1200
    O/S: 7 Ultimate SP1 X64

    Purchase products here (e.g. Premium membership, Black Ops Intervention, H2SO4 for CSS/TF2/L4D, EliteControl for SC, MW2 Liberation v1.06+, etc)

    Get Premium for Just $8, and get MW2 Liberation v1.06!

  8. #8

    Default

    Quote Originally Posted by p00onu View Post
    Ok first off, good job on following the tutorial.

    I will warn you that making this hack will not be as easy as the unit alert.

    So your pseudocode should look like this:
    Unit created, get unit id, select unit, get closest mineral patch, issue the mine command on the mineral patch.

    Next, you will need to find the select unit function. Start by finding the selected unit buffer. Have nothing selected and search for 0, select something and search for has changed, etc... Once you find it, set a write bp on it and select something. When it pops, step out one or two times and you should be right after the select unit function call.

    Next you will have to get the map coordinates of your command center/nexus/hatchery and then scroll thru the unit list and compare coords to find out which patch is closest to your main.

    Next you would need to issue the mine command on the mineral patch with your newly created worker selected.

    It looks like you have your work cut out for you. Good luck.
    you make it sound so easy. good info btw. +rep

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. C++ Questions
    By Uniquely_Defined in forum Software Development
    Replies: 105
    Last Post: 03-02-2009, 03:17 AM
  2. A few development related questions
    By varm0uth in forum Reverse Engineering
    Replies: 4
    Last Post: 02-21-2007, 03:21 PM
  3. Newbs like me with stupid questions
    By darkcloak in forum Software Development
    Replies: 12
    Last Post: 08-13-2006, 12:14 PM
  4. My Questions Of The Day
    By Zaund in forum Mods & Maps
    Replies: 0
    Last Post: 12-14-2005, 09:08 PM
  5. Blackllama Questions
    By llafnwod in forum Flame Board
    Replies: 33
    Last Post: 12-05-2004, 03:37 PM

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •