Jump to content

Setting spawned barrels on fire?


Recommended Posts

I've been teaching my self basic modding, I've adapted the "cheat" exec function spawnbarrels that creates 8 oil barrels around the player to instead spawn a wedge of 5 barrels placed in the direction the player is looking. It works, but what I'd like to add is for the closest barrel to also be on fire, so that when it explodes it triggers the other 4 barrels.

 

I looked in the oilbarrel.ws script file and found the function SetOnFire, but when I try to use it the RedEngine compiler gives a "Could not find function 'SetOnFire'". I'm assuming this is because I'm trying to reference the function improperly.

 

Code snippet:

 

brrltmpl = (CEntityTemplate)LoadResource("barrel");
// first barrel 4 meters away
dst = 4.0;
brl.X = pos.X + dst * dir.X;
brl.Y = pos.Y + dst * dir.Y;
brl.Z = pos.Z + 0.5;
ent1 = theGame.CreateEntity(brrltmpl, brl, thePlayer.GetWorldRotation() );
ent1.SetOnFire(2.0,0);

The parameters for SetOnFire are explTime (float) and randomize (bool), so I'm asking for a 2 second delay and not a random one. The brl vector is a point 4 meters away (in the XY plane) from the player position pos, in the current camera direction given by the dir vector.

 

I tried to cast the function call with (COilBarrelEntity)ent1.SetOnFire(2.0,0) but get the same error message.

 

Can anyone provide help with getting this to work?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...