Author Topic: Making an item collidable and static without new datablocks?  (Read 817 times)

Is there a way to spawn a static model through script without making a new datablock?

I've tried:

Code: [Select]
%i = new StaticShape(){
datablock = gunItem;
}

Didn't work.

and this:

Code: [Select]
%i = new Item(){
datablock = gunItem;
}
%i.collideable = 1;
%i.static = 1;

neither did that.

Code: [Select]
%i = new TSStatic(){
shapefile = gunItem.shapefile;
position = [POSITION];
}

TSStatics are more limited than Static Shapes but don't need datablocks. They're the ones spawned by F11/F4/Static Shapes.

Thank you.

Quote
TSStatic::OnAdd: no shape name!
« Last Edit: November 02, 2007, 03:11:51 PM by MrPickle »

Try Shapename = gunItem.shapefile;.

That works, thanks.

It still has no collision though.

Does the gun.dts even have collision?

I don't remember if only bricks have the "setColliding()" method or not, but you could try this:

Code: [Select]
%static = new TSStatic()
{
     shapeName = gunItem.shapefile;
}

%static.setTransform(%x SPC %y SPC %z);
%static.setColliding(true);
MissionCleanup.add(%static);
« Last Edit: November 02, 2007, 05:16:46 PM by Trader »