Staredit Network > Forums > Modding Assistance > Topic: Regeneration plugin
Regeneration plugin
Jul 13 2012, 5:36 pm
By: iquare  

Jul 13 2012, 5:36 pm iquare Post #1



How to write plugin, which gain 5hp/second regeneration ability for zergling? (I try make it, using GPTP, but it cause error during compilation



None.

Jul 13 2012, 5:39 pm Biophysicist Post #2



Copy-paste your game.h file here and I'll debug it.

EDIT: At least, I think it's game.h. The one you edit when using GPTP.



None.

Jul 14 2012, 6:26 am iquare Post #3



/*
* This is where the magic happens. However, there are other things
* that you can change. In "Definitions/definitions.h", you can
* remove the DEBUG defintion for a final release of your plugin.
* You can likewise change the version that the plguin is for.
* Supported versions are given in "Definitions/definitions.h".
*
* Oh, and you can also change the plugin's ID in that file as well,
* just in case it conflicts with other plugin IDs.
*/

//the asm functions don't seem to work for some reason. probably the offsets I have are wrong, if anyone knows them, contact me asap!
#include "asm.cpp"


#ifdef DEBUG
#include <fstream>
std::ofstream myfile;
#endif

// Any code in nextFrame() will be run every frame. On Fastest game speed, this is equal to 24 times per second.
bool nextFrame()
{
return true;
}

// Any code in gameOn() will be run once, when the map starts.
bool gameOn()
{
return true;
}

// Any code in gameEnd() will be run once, at the end of the game.
bool gameEnd()
{
return true;
}

void nextFrame()
{
int hitpoints = 35;
for (int i=0;i<1700;i++) {
UNIT* zergling;
zergling = &unitTable[i];
if (zergling->unitId == 37) {
if (zergling->healthPoints < 256*hitpoints) {
for (int j=0;j<1700;j++) {
if (zergling->healthPoints < 256) {
zergling->healthPoints = zergling->healthPoints + 32;
}
}
}
}
}
}



None.

Jul 14 2012, 2:45 pm Biophysicist Post #4



Try this:

Code
#include "asm.cpp"

#ifdef DEBUG
#include <fstream>
std::ofstream myfile;
#endif

// Any code in nextFrame() will be run every frame. On Fastest game speed, this is equal to 24 times per second.
bool nextFrame()
{
    int hitpoints = 35;
    for (int i=0;i<1700;i++) {
        UNIT* zergling = &unitTable[i];
        if (zergling->unitId == 37 && zergling->healthPoints < 256*hitpoints)
                zergling->healthPoints += 32;
    }
    return true;
}

// Any code in gameOn() will be run once, when the map starts.
bool gameOn()
{
    return true;
}

// Any code in gameEnd() will be run once, at the end of the game.
bool gameEnd()
{
    return true;
}




None.

Jul 15 2012, 10:36 am iquare Post #5



Thanks, plugin works.



None.

Jul 15 2012, 7:02 pm Pr0nogo Post #6



Huh. Not much different from Python coding. I could probably learn this easily.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-2-24. : 9:49 am]
IlyaSnopchenko -- So I wouldn't really call it "mine" by now, it's a collaborative effort. And who can forget C(a)Hek's ceaseless testing efforts and advice
[2024-2-24. : 9:48 am]
IlyaSnopchenko -- It would not have been possible without the participation of jun3hong - who has created the sounds, the portraits and the new wireframes, among other things - and Warchief, the author of the story
[2024-2-24. : 9:45 am]
IlyaSnopchenko -- Thank you
[2024-2-24. : 6:37 am]
kgh829 -- IlyaSnopchenko
IlyaSnopchenko shouted: kgh829 Been using that for a while and yes, it's awesome.
I just checked out your campaign, and it's absolutely insane. The direction and new graphics are fantastic. Personally, I think the dialogue is a bit too long, but it was an extremely impressive piece of art. The AI voices are also excellent. If the quality is this good, it's definitely worth paying for
[2024-2-23. : 4:15 pm]
IlyaSnopchenko -- kgh829
kgh829 shouted: Has anyone tried Elevenlabs? I watched Executor Nral's youtube and was very impressed
Been using that for a while and yes, it's awesome.
[2024-2-23. : 2:36 pm]
NudeRaider -- :wob:
[2024-2-23. : 7:58 am]
kgh829 -- I found that the price was very reasonable, so I'm seriously considering using it for the map I'm working on
[2024-2-23. : 7:55 am]
kgh829 -- Has anyone tried Elevenlabs? I watched Executor Nral's youtube and was very impressed
[2024-2-23. : 4:44 am]
sraw531 -- :wob:
[2024-2-22. : 7:24 pm]
Zycorax -- :wob:
Please log in to shout.


Members Online: Bonuio06