It'd be nice if someone wrote clear step by step instructions for this
Although most of what you need to know is outlined in the previous posts, I guess that a quick summary could be a good thing.
Here's a list of the different methods we used to write to a certain address:
- Address=4*Player+48*UnitID+5787104 The number of completed UnitID owned by Player.
- Address=4*Player+48*UnitID+5776160 The total number of UnitID owned by Player.
- Address=4*Player+48*UnitID+5808992 The number of deaths of UnitID suffered by Player.
- Address=4*Player+48*UnitID+5798048 The number of UnitID that Player has killed.
For instance, the number of completed vultures (unit id=2) owned by player 7 would be stored in the address 4*7+48*2+5787104=5787228.
If we wanted to modify the Terran Ship Plating upgrades of Player 10, we'd first have to find what its address is. We'd have to look through
The Almighty EUD DB. According to
this the addresses for upgrades start at 0x0058D2B0 (which is 5821104 in base 10, the one I'll be using for simplicity's sake) and according to
that, we'd need to add 46*(10-1)+2 to that address. So, the address of player 10's ship plating upgrades is 5821104+46*(10-1)+2=
5821520.
If we wanted to modify those upgrades simply by pre-placing units on our map (i.e. by modifying the
completed unit and
total unit count that were mentioned in the table above), we'd need to use one of the two equations:
5821520=4*Player+48*UnitID+57871045821520=4*Player+48*UnitID+5776160Solve for
Player and
UnitID.
One of the many solutions to the
first equation (i.e. the one for completed units) is:
UnitID=716
Player=12
We can easily see that 4*12+48*716+5787104=5821520. Therefore, placing a Unit ID 716 (in SCMDraft 2, change the unit ID to 716 in unit properties) owned by player 12 will increase player 10's terran ship upgrades by 1.
Another equation that is useful to know is that the properties of a unit at a certain index is stored in the address:
Address=6455960-336*(Index-1)+offsetYou would find the value for the offset
in this table. According to it, the offset for the unit ID is +0x64 in hexadecimal, or +100 in base 10. Therefore, if we wanted to change a ghost (unit ID=1) in index 1594 into a shuttle (unit ID=69), we'd need to increase the value stored in address 6455960-336*(1594-1)+100=
5920812 by 69-1=68. You'd just need to solve for
UnitID and
Player the same way we did previously. We find that one of the solutions is:
UnitID=2785Player=7So placing 68 UnitID 2785 owned by player 7 would turn our ghost into a shuttle. Be careful though, sometimes you can only preplace extended units for players 9-12 then give them to player 7 using triggers.
In addition to this, if we wanted to update the command card of our brand spanking new shuttle (so that we'd be able to see the shuttle's abilities), we could use the address for the maelstrom timer, since the command card refreshes when maelstrom (or any other stunning spell) expires. We find that the offset for that value is +0x124 in hexa or 292 in base 10. So we'd need to modify address 6455960-336*(1594-1)+292=
5921004. One of the solutions to that equation is:
UnitID=2789Player=7Last but not least, since the player ID's for the all the stuff I found previously were between 1 and 12, I can use the "Give to player" action in triggers to increase and decrease those values as many times as I want. Therefore, we'd be able to switch a ghost into a shuttle, then into a high templar at some point, etc.
The only real difficulty of this system is finding unit ID's that don't crash (or cause any other problems). Unfortunately, they're quite rare in some ranges. So far, I found that the following ID's were givable, destructible (or anyway, appeared to be):
List of "good" extended unit IDs
690
698
701
706
716
2436
2442
2450
2464
2470
2498
2519
2547
2548
2551
2554
2568
2575
2582
2596
2603
2610
2628
2635
2645
2656
2698
2705
2712
2715
2719
2722
2726
2729
2733
2736
2740
2743
2750
2754
2761
2764
2768
2771
2778
2782
2785
2789
3900
I hope that was helpful. I'm not too sure if I gave too many details or if I should have given more. Anyway, if anyone still has any questions concerning this topic, don't hesitate to ask.
Edit:What's wrong with tables? They work in messages but not in posts?
Post has been edited 1 time(s), last time on Aug 25 2012, 6:54 pm by Chia-Tyrant.
None.