After quite a sabbatical I've had time to start woking on my Mario stuff again. The question block is a Decoration that spawns an item when a pawn bumps a trigger on the bottom of the block. I want the block to be disabled for a certain amount of time, so I call SetTimer(). Well, the function Timer() never seems to get executed. Got a clue?
Code:
class qblock extends Decoration;
#exec mesh IMPORT MESH=qblock ANIVFILE=MODELS\qblock_a.3d DATAFILE=MODELS\qblock_d.3d X=0 Y=0 Z=0
#exec mesh ORIGIN MESH=qblock X=0 Y=0 Z=0
#exec mesh SEQUENCE MESH=qblock SEQ=All STARTFRAME=0 NUMFRAMES=30
//#exec mesh SEQUENCE MESH=qblock SEQ=??? STARTFRAME=0 NUMFRAMES=30
#exec MESHMAP new MESHMAP=qblock MESH=qblock
#exec MESHMAP scale MESHMAP=qblock X=0.1 Y=0.1 Z=0.2
#exec texture IMPORT NAME=QBlockTex1 FILE=MODELS\qblock.pcx GROUP=Skins FLAGS=2
#exec texture IMPORT NAME=QBlockTex1 FILE=MODELS\qblock.pcx GROUP=Skins PALETTE=QBlockTex1
#exec texture IMPORT NAME=QBlockTex_Dark FILE=MODELS\qblockdark.pcx GROUP=Skins FLAGS=2
#exec texture IMPORT NAME=QBlockTex_Dark FILE=MODELS\qblockdark.pcx GROUP=Skins PALETTE=QBlockTex_Dark
#exec MESHMAP SETTEXTURE MESHMAP=qblock NUM=1 TEXTURE=QBlockTex1
var() class<Inventory> PopoutItem;
var() float DeactivateTime;
var qblock_trigger t;
function PreBeginPlay()
{
local Inventory temp;
if(DeactivateTime<0.2)
{
temp = Spawn(PopoutItem,,,,);
DeactivateTime = temp.RespawnTime;
Log("%%%%%%%%% DeactivateTime = "@DeactivateTime);
temp.Destroy();
}
t = Spawn( class'qblock_trigger', self, , Location + vect(0, 0, -15), );
Super.PreBeginPlay();
}
event Trigger( Actor Other, Pawn EventInstigator ){
local Inventory item;
local float angle;
local float x_v, y_v, Z_v;
item = Spawn( PopoutItem, , , Location + vect(0, 0, 20), );
item.RespawnTime = 0.0; //don't respawn
item.SetPhysics(PHYS_Falling);
item.RemoteRole = ROLE_DumbProxy;
item.BecomePickup();
item.NetPriority = 2.5;
item.NetUpdateFrequency = 20;
item.bCollideWorld = true;
item.GotoState('PickUp', 'Dropped');
angle = FRand()*(PI/2);
x_v = Cos(angle)*150;
if(FRand()>0.5) x_v*=-1;
y_v = Sin(angle)*150;
if(FRand()>0.5) y_v*=-1;
z_v = 200 + FRand()*400;
item.Velocity.X = x_v;
item.Velocity.Y = y_v;
item.Velocity.Z= z_v;
SetTimer(DeactivateTime,false);
Log("%%%%%%%%% SetTimer("@DeactivateTime@", false)");
t.SetCollision(false,false,false);
texture = Texture'QBlockTex_Dark';
AmbientGlow = 0;
}
function Timer()
{
Log("%%%%%%%%%%%%%% TIMER");
t.SetCollision(true,true,true);
texture = Texture'QBlockTex1';
AmbientGlow = 96;
}
defaultproperties
{
DrawType=DT_Mesh
Mesh=qblock
CollisionRadius=14.500000
CollisionHeight=13.000000
bCollideActors=True
bCollideWorld=True
bBlockActors=True
bBlockPlayers=True
PopoutItem=class'HealthVial'
DeactivateTime=0.0
AmbientGlow=96
}