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.
[11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
[2024-4-17. : 1:52 am]
Vrael -- hah do you think I was born yesterday?
[2024-4-17. : 1:08 am]
O)FaRTy1billion[MM] -- i'll trade you mineral counts
[2024-4-16. : 5:05 pm]
Vrael -- Its simple, just send all minerals to Vrael until you have 0 minerals then your account is gone
[2024-4-16. : 4:31 pm]
Zoan -- where's the option to delete my account
[2024-4-16. : 4:30 pm]
Zoan -- goodbye forever
Please log in to shout.


Members Online: Roy