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.
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- there are some real members mixed in those latter pages, but the *vast* majority are spam accounts
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- there are almost 3k pages
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- the real members stop around page 250
[2024-4-14. : 9:20 pm]
O)FaRTy1billion[MM] -- look at the members list
[2024-4-12. : 12:52 pm]
Oh_Man -- da real donwano
da real donwano shouted: This is the first time I've seen spam bots like this on SEN. But then again, for the last 15 years I haven't been very active.
it's pretty common
[2024-4-11. : 9:53 pm]
da real donwano -- This is the first time I've seen spam bots like this on SEN. But then again, for the last 15 years I haven't been very active.
[2024-4-11. : 4:18 pm]
IlyaSnopchenko -- still better than "Pakistani hookers in Sharjah" that I've seen advertised in another forum
[2024-4-11. : 4:07 pm]
Ultraviolet -- These guys are hella persistent
[2024-4-11. : 3:29 pm]
Vrael -- You know, the outdoors is overrated. Got any indoor gym and fitness equipment?
[2024-4-10. : 8:11 am]
Sylph-Of-Space -- Hello!
Please log in to shout.


Members Online: Roy, jun3hong