Page 1 of 1

StaticEntityProxy and Usekey

Posted: Sat Jul 07, 2007 4:53 pm
by WebsterX37
Hello,

I am relatively new to this but finally managed to create a first actorfile for RF. A simple TV. I placed it into my level and it looks fine so far. Now I want the TV to be turned on (maybe change the texture of a face and animate it) by the Player.

The StaticEntityProxy has a Usekey Field but I have no Idea about how to use it. My Model has a simple cube as TVtrigger
with one animation (use). Any Ideas?

Thanx a lot
Webster

Posted: Sun Jul 08, 2007 11:09 pm
by WebsterX37
..did not find a way better then using an

Attribute with a switch.act as actor (setting the Attribute to be triggered by UseKey),
setting the Attribute to ReSpawn with 0.0 delay, setting the AtrributeAmount to 0,
triggering a logicgate as FlipFlop,
the logicgate then triggers a flipbook,

any better way?

:roll:

Posted: Sat Jul 14, 2007 5:02 am
by WebsterX37
:D

Me answering my question :-))
Who whom it may concern, I have found a better way: making a pawn and scripting it. Took me quite
long to figure it out, I am not really a programmer and new to RF:

{
ACTIVATERANGE [70]

Spawn[()
{
Console(true);
AttributeOrder("health",100,"Die");
SetFOV(360);
HostilePlayer(false);
HostileSame(false);
HostileDifferent(false);
IsPushable(true);
SetGroup("TV");
SetFlag(1,true);
NewOrder("IdleState");
}]

Die[()
{
Remove(true);
}]

IdleState[()
{
self.ThinkTime=1;
debug(self.key_pressed);
if(self.player_range<ACTIVATERANGE)
{
if(self.key_pressed=16)
{
if(GetFlag(1)=true)
{
PlayAnimation("on", true, "" );
PlayAnimation("on_idle", true, "" );
}
else
{
PlayAnimation("off", true, "" );
PlayAnimation("off_idle", true, "" );
}
if(GetFlag(1)=true)
{
SetFlag(1,false);
}
else
{
SetFlag(1,true);
}
}
}
RestartOrder();
}]
}


But I think it could be shorter. Any better way? Changing the Material should be easy now.