Here is sample script of new oildrum for new scripting engine :
Code:
require default;
CNewDrum : COilDrum; //this line declares CNewDrum class from COilDrum (explosive oil drum thingies)
CNewDrum::CNewDrum(CObject* parent, fixed x, fixed y) //constructor of CNewDrum
{
super(parent->Store->GetObject(25, 0), x, y, false); //GetObject(25, 0) returns parent object for all environment objects (mines, oil drums...)
fds = new CFireDesc; //will be used later in the script
};
void CNewDrum::Explosion()
{
DoExplosion(1, PosX, PosY, 100, 88, 0, OwnerTeam); //triple explosion
DoExplosion(1, PosX, PosY - 55, 100, 80, 0, OwnerTeam);
DoExplosion(1, PosX, PosY - 88, 100, 75, 0, OwnerTeam);
fds->X = PosX; //flame parameters
fds->Y = PosY;
fds->Count = 24;
fds->UnkB = 1;
fds->Duration = 5000;
fds->UpPower = 100;
fds->Damage = 15;
fds->OwnerTeam = OwnerTeam;
fds->SpY = -3;
fds->SpX = -3;
local fire = new CFire(fs, fds, 0);
};
void CNewDrum::Render() //replaces original drum render function
{
local sn = (4 * Dmg) / 50; //sn is the sprite index
if (sn > 3) sn = 3;
AddSpriteEx(16, PosX, PosY, sn + 110, GS->Tick / 50.0, 0, 1.2); //1.2 is scale
};
void newdrum::Init() //newdrum is the script's name
{
local nd = new CNewDrum(Env->Objs.Objs[0], 100, 0); //put CNewDrum in point 100, 0
};
no "idk" anymore