Staredit Network > Forums > Modding Assistance > Topic: Canceling upgrading at a specific unit
Canceling upgrading at a specific unit
Jan 27 2009, 6:02 pm
By: Biophysicist  

Jan 27 2009, 6:02 pm Biophysicist Post #1



I need a way to cancel upgrades at a particular unit, without affecting any other unit, when I don't know where the unit is or even which type of unit it is. (So, basically, if the player tries to research something, the upgrade instantly cancels researching.) Does anyone have any ideas? Note that the units in question are mobile and there can be up to 100 (more if the player uses Mind Control a lot).

EDIT: Is there any way to create a unit in iscript? If so, I could put a create unit command into the unit's "working" animation and center a location on that unit.

EDIT2: Okay, there's been some confusion in the shoutbox about this, so I'll try to explain moar guder. Basically, I need a bunch of buttons (at least 7, probably a lot more) that have no effect when clicked on, but that the game can detect when one is clicked (triggers) and do stuff. The only way I could think of to do this is to repurpose a bunch of upgrade buttons and figure out when one is clicked by mineral loss detection. The problem is, pressing the button makes the upgrade's level go up by 1, which means that each button can only be used 255 times. Therefore, I need some way to make the upgrade stop automatically. I know about using Give Units to halt an upgrade, but the problem is figuring out WHICH unit to Give. The units are mobile, and all units (except a few special ones) will need a set of these buttons.

Alternatively, if anyone has a better control idea, I'd be glad to hear it. (Building units wouldn't work, because the units aren't buildings and I can't make them buildings for technical reasons.)

Oh, is there any way to create a unit with iscript? If so, I could just put a create unit command in the "Working" block (the one that plays when a unit is researching or building units and stuff like that). I doubt this a lot, but w/e.

Post has been edited 4 time(s), last time on Jan 27 2009, 9:09 pm by TassadarZeratul.



None.

Jan 27 2009, 6:49 pm Pigy_G Post #2



Give the building to neutral then back again?



None.

Jan 27 2009, 6:50 pm Devourer Post #3

Hello

Quote from Pigy_G
Give the building to neutral then back again?
It's modding.



Please report errors in the Staredit.Network forum.

Jan 27 2009, 6:51 pm Biophysicist Post #4



Not buildings... And the problem is figuring out WHICH unit to give. I can't give all of them, or the player's whole army will lose their orders.

EDIT: Okay, there's been some confusion in the shoutbox about this, so I'll try to explain moar guder. Basically, I need a bunch of buttons (at least 7, probably a lot more) that have no effect when clicked on, but that the game can detect when one is clicked (triggers) and do stuff. The only way I could think of to do this is to repurpose a bunch of upgrade buttons and figure out when one is clicked by mineral loss detection. The problem is, pressing the button makes the upgrade's level go up by 1, which means that each button can only be used 255 times. Therefore, I need some way to make the upgrade stop automatically. I know about using Give Units to halt an upgrade, but the problem is figuring out WHICH unit to Give. The units are mobile, and all units (except a few special ones) will need a set of these buttons.

Alternatively, if anyone has a better control idea, I'd be glad to hear it. (Building units wouldn't work, because the units aren't buildings and I can't make them buildings for technical reasons.)

Oh, is there any way to create a unit with iscript? If so, I could just put a create unit command in the "Working" block (the one that plays when a unit is researching or building units and stuff like that). I doubt this a lot, but w/e.

Post has been edited 3 time(s), last time on Jan 27 2009, 9:09 pm by TassadarZeratul. Reason: Grammar fail



None.

Jan 27 2009, 9:36 pm Syphon Post #5



You're gonna need locations. :P

Try running AIScripts on them? If not, ya, give to a player and back. Also, there are MUCH easier ways to do this. Use unit morphs and locations to detect when upgrades happen.



None.

Jan 27 2009, 9:41 pm Biophysicist Post #6



Unit morphs: No can do... I'd actually hit the unit slot limit if I did that, believe it or not.

Giving to a player: The problem is figuring out WHICH UNIT TO GIVE.

Anyway, what AI script? And wouldn't I have the same problem of not knowing which unit to run the script on?



None.

Jan 27 2009, 9:42 pm Syphon Post #7



Oh. There's no way to detect what unit is undergoing an upgrade unless you feeling like getting your hands dirty with ASM.



None.

Jan 27 2009, 9:49 pm Biophysicist Post #8



Well, only one unit can be "upgrading" at any given time, so I could use EUDs to find which unit it is by checking which unit is currently selected... (The "upgrade" menu isn't available when more than one unit is selected.) Then the problem is centering a location on the currently selected unit...

Oh, how does one do ASM injection? I could learn assembly, but I don't know how to use it in a mod. :(



None.

Jan 27 2009, 9:53 pm A_of-s_t Post #9

aka idmontie

There's an address in the unt node that is set to true if a unit is upgrading and I believe there may be one for which upgrade is being researched.

Post has been edited 2 time(s), last time on Jan 27 2009, 10:49 pm by A_of-s_t.



Personal GitHub
Starcraft GitHub Organization - Feel free to request member status!
TwitchTV

Jan 29 2009, 5:15 am Syphon Post #10



Quote from name:TassadarZeratul
Well, only one unit can be "upgrading" at any given time, so I could use EUDs to find which unit it is by checking which unit is currently selected... (The "upgrade" menu isn't available when more than one unit is selected.) Then the problem is centering a location on the currently selected unit...

Oh, how does one do ASM injection? I could learn assembly, but I don't know how to use it in a mod. :(

FG doesn't have the ASM plugin yet(!), but if you feeling going back to the good ol' days of modding, and use StarGraft, here's a short ASM tutorial. http://www.campaigncreations.org/starcraft/stardraft/asm.shtml



None.

Jan 29 2009, 5:16 am A_of-s_t Post #11

aka idmontie

Or just make a plugin in C++ which allows inline ASM.



Personal GitHub
Starcraft GitHub Organization - Feel free to request member status!
TwitchTV

Jan 29 2009, 5:21 am Biophysicist Post #12



I'm new at this, remember? How does one make plugins?

EDIT: Can one use both Stargraft and Firegraft?



None.

Jan 29 2009, 5:23 am A_of-s_t Post #13

aka idmontie

It's complicated. First you need a C++ compiler, than knowledge of C++ and ASM. Then you get the poper formats for making a plugin. Then you write out all the code after finding the right addresses. After than, you can plug it in with FG and then check if it works.

Check here for what can be done with plugins:
http://bwapi.googlecode.com/svn/

Quote
EDIT: Can one use both Stargraft and Firegraft?
No, they are for different versions of SC last time I checked. SG for version 1.13f or something and FG for 1.15.0/1.



Personal GitHub
Starcraft GitHub Organization - Feel free to request member status!
TwitchTV

Jan 29 2009, 5:26 am Biophysicist Post #14



Where can I get said "formats"?

EDIT: Damn...



None.

Jan 29 2009, 5:42 am A_of-s_t Post #15

aka idmontie

Quote from name:TassadarZeratul
Where can I get said "formats"?

EDIT: Damn...
Look in the link I gave you. Either that or ask one of the five other people that know how to make plugins: farty, poiuy_qwert, DoA, Doodle, Heinermann.



Personal GitHub
Starcraft GitHub Organization - Feel free to request member status!
TwitchTV

Jan 30 2009, 1:08 am Syphon Post #16



I believe I also have the plugin specs for FireGraft somewhere. And if you find can find Pie_Sniper, I'm 90% he did some ASM just two patches ago.



None.

Jan 30 2009, 1:10 am Symmetry Post #17

Dungeon Master

Quote from A_of-s_t
It's complicated. First you need a C++ compiler, than knowledge of C++ and ASM. Then you get the poper formats for making a plugin. Then you write out all the code after finding the right addresses. After than, you can plug it in with FG and then check if it works.

Check here for what can be done with plugins:
http://bwapi.googlecode.com/svn/

Quote
EDIT: Can one use both Stargraft and Firegraft?
No, they are for different versions of SC last time I checked. SG for version 1.13f or something and FG for 1.15.0/1.

SG is for 1.08, the reason all the old mods were 1.13f is because there was a memgraft version that could import .pats made in stargraft.



:voy: :jaff: :voy: :jaff:

Jan 30 2009, 3:35 am Biophysicist Post #18



Thanks for all the help guys. I know to do this now, yay!

But, I have another question about ASM in SC... I'd like to set it up so that every few seconds, each unit has 1 HP added if it has > 100 shields. How would you recommend doing this?



None.

Jan 30 2009, 3:50 am A_of-s_t Post #19

aka idmontie

Set up a loop to check every unit. Check its Shield, if true, then add 1 hp. Move to next unit.

I'd use a trigger edit plugin for that.



Personal GitHub
Starcraft GitHub Organization - Feel free to request member status!
TwitchTV

Jan 30 2009, 3:57 am Biophysicist Post #20



What I don't understand is how I'd get the loop into SC... If I have the ASM, how do I make it run as part of SC's main loop?

And what does a trigger edit plugin have to do with this? (Honest question, I don't understand...)



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:45 am]
Sylph-Of-Space -- Does the shoutbox get disabled when there's spammers?
[06:47 am]
NudeRaider -- lil-Inferno
lil-Inferno shouted: nah
strong
[05:41 am]
Ultraviolet -- 🤔 so inf is in you?
[04:57 am]
O)FaRTy1billion[MM] -- my name is mud
[04:35 am]
Ultraviolet -- mud, meet my friend, the stick
[2024-5-16. : 10:07 pm]
lil-Inferno -- nah
[2024-5-16. : 8:36 pm]
Ultraviolet -- Inf, we've got a job for you. ASUS has been very naughty and we need our lil guy to go do their mom's to teach them if they fuck around, they gon' find out
[2024-5-16. : 5:25 pm]
NudeRaider -- there he is, right on time! Go UV! :D
[2024-5-16. : 5:24 pm]
lil-Inferno -- poopoo
[2024-5-16. : 5:14 pm]
UndeadStar -- I wonder if that's what happened to me. A returned product (screen) was "officially lost" for a while before being found and refunded. Maybe it would have remained "lost" if I didn't communicate?
Please log in to shout.


Members Online: Ultraviolet, Sylph-Of-Space, Roy, 1madisonc911rb1