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.
[04:40 pm]
Zoan -- never change, sen
[04:39 pm]
Zoan -- :wob:
[12:46 pm]
razorback9423 -- :wob: KANDA FOREVER!
[2019-9-20. : 2:41 pm]
razorback9423 -- NudeRaider
NudeRaider shouted: MTiger156 power over:wob:ing?
No, POWER UNDER :wob: ing!
[2019-9-20. : 12:53 pm]
NudeRaider -- MTiger156
MTiger156 shouted: Power over:wob:ing
power over:wob:ing?
[2019-9-20. : 12:27 pm]
MTiger156 -- crap...
[2019-9-20. : 12:27 pm]
MTiger156 -- Power over:wob:ing
[2019-9-20. : 11:50 am]
UEDCommander -- WARNING: Unit Unplaceable! (u) (69, 69)
[2019-9-20. : 9:26 am]
lil-Inferno -- :wob:
[2019-9-20. : 8:25 am]
Black_Overseer -- razorback9423
razorback9423 shouted: WARNING: Unit Unplaceable! (Aldaris) (1656,2996)
You have no power here, Gandalf the Grey.
Please log in to shout.


Members Online: Roy, MTiger156