Staredit Network > Forums > Modding Discussion > Topic: GPTP PLUGINS DUMPSTER
GPTP PLUGINS DUMPSTER
Feb 15 2017, 6:17 am
By: Corbo  

Feb 15 2017, 6:17 am Corbo Post #1

ALL PRAISE YOUR SUPREME LORD CORBO

Alright so the purpose of this topic is to share plug ins.

I'm currently making a few plug ins and I intend to post whatever I feel like sharing for everyone's use because #PowerToThePeople. I'm nowhere near being an expert at this, I am not a programmer and I am an idiot. So there's that. Here's a few guidelines for this topic, though:

  • If anyone else feels like posting their own I'll make sure to keep this post organized with a nice list to show them all.
  • If anyone feels like requesting or giving ideas that could work too, I guess.
  • While one can just post their code or plug ins keep in mind this topic is aimed for the fools so it would be nice if you included a brief explanation on how to use them too.
  • Grabbing something? Don't be an asshole and give credit where credit is due.

PLUGINS INDEX
  • None yet.




fuck you all

Feb 15 2017, 6:32 am Corbo Post #2

ALL PRAISE YOUR SUPREME LORD CORBO

TERRAIN AFFECTS UNITS

Ever wanted to have units be affected by terrain other than being blocked by it? Ever wanted terrain to have much more involvement in gameplay than just sitting there decoratively?

Then this plug in is for you!

With this plug in you'll be able to affect units depending on which tile/tileset group they're standing on. This will also give you access to tileset flags so, there's that for you to use too.

Here's how it works:
  • You need structs for the MTXM and the Tile section of a map, additionally I added a mapSize struct too
  • You need pointers to those sections
  • You need code to do stuff!

Here's the code for the structs AND the pointers:
Code
// Adds MTXMTile info struct...
struct MTXMTile {
    u16 megatile : 4;
    u16 megatileGroup : 12;
};

// Adds Tile info struct...
struct Tile {
u16 index;
u16 buildable;
u16 unk6; // I don't remember what any of these are
u16 unk7;
u16 unk8;
u16 unk9;
u16 unk10;
u16 unk11;
u16 unk12;
u16 unk13;
u16 tiles[16];
};

// Adds mapSize info struct...
struct mapSizeStuff{
    u16 width;
    u16 height;
};

// Adds pointer to MTXM map tile data
SCBW_DATA(MTXMTile**, MTXM, 0x005993C4);
// Adds pointer to megaTileArray data
SCBW_DATA(Tile**, megaTileArray, 0x00628458);
// Adds pointer to mapSize data
SCBW_DATA(mapSizeStuff*, mapSize,0x0057F1D4);

Paste this in scbwdata.h ideally to keep things tidy you'll paste it near other tileset related stuff. I pasted mine after SCBW_DATA(ActiveTile**, activeTileArray, 0x006D1260);


Here's the code to make it do stuff:
Code
if (unit->id == UnitId::marine && unit->unusedTimer == 0 && (*MTXM)[unit->getTileX() + unit->getTileY()*mapSize->width].megatileGroup == 4){
                unit->damageHp(256); // This is how you damage a unit
                unit->sprite->createOverlay(ImageId::Flames1Type1_Small, 0, 0, 0); // This is because FIREZ
}

Paste this in game_hooks.cpp after the //Write your code here line in the unit loop

Here's how it works, the code that does the magic is this: (*MTXM)[unit->getTileX() + unit->getTileY()*mapSize->width].megatileGroup == 4
That's getting the unit's position and finding out which megatileGroup it is in. If it's 4 then it will execute actions inside the {} in this case I went with mtg == 4 because that's the megatilegroup for lava in ashworld. Additional requirements, like I restricted my code to only run on marines and when an unused timer is set to 0, because otherwise units would die quickly.

My actions were damage a unit 1HP and create a fire overlay.

Here's the result:

This is from when every unit would catch on fire xD


GPTP Version: GPTP-For-VS2008-Update-4

Post has been edited 6 time(s), last time on Feb 15 2017, 6:44 am by Corbo.



fuck you all

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:53 am]
Ultraviolet -- :lol:
[06:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[06:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[06:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[06:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[06:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
[06:48 pm]
Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
[06:47 pm]
Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
[06:45 pm]
NudeRaider -- Vrael
Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
beats me, but I'd make sure to pick the epitome of excellence and nothing less.
[06:41 pm]
Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
Please log in to shout.


Members Online: Roy, Ultraviolet