Is it posible to make a floor that breaks when u step on it?
Is it posible to make a floor that breaks when u step on it?
Is it possible to make a floor that breaks when you walk over it? If it is, can someone please tell me how to do it? Thanks in advance.
Re: Is it posible to make a floor that breaks when u step on it?
You have three alternatives:
1. Making several world models (in the editor) that show a crumbling floor, then them as a Door or using MovingPlatform entities. You must link them together with the NextToTrigger field.
2. Making an actor (in your modelling program) that has a 'break' animation, then add it as a Pawn entity with a script so that when something touches it / is over it, so that it breaks, then the collision is turned off.
3. The third alternative would be to use a mixture of both, i think that would be harder than both of them.
No. 2 would be the easiest, i think.
The base script for the Pawn could look like this:
1. Making several world models (in the editor) that show a crumbling floor, then them as a Door or using MovingPlatform entities. You must link them together with the NextToTrigger field.
2. Making an actor (in your modelling program) that has a 'break' animation, then add it as a Pawn entity with a script so that when something touches it / is over it, so that it breaks, then the collision is turned off.
3. The third alternative would be to use a mixture of both, i think that would be harder than both of them.
No. 2 would be the easiest, i think.
The base script for the Pawn could look like this:
Code: Select all
{
Spawn[ ()
{
SetGroup("Static"); //So that enemies won't attack it
Console(true); //let's look if this script works
Gravity(false); //Gravity is off or it would fall down
LowLevel("LookIfSomebodyComes");
} ]
//A variable in which we store the thing that we detected
TRACERESULT [FALSE]
LookIfSomebodyComes[ ()
{
//this is executed every frame
//Use TraceToActor which looks if anything is in the way of it's "beam"
TRACERESULT=TraceToActor("",0,50,0); //I used an "upward beam" length 50, you should play around with it
if(TRACERESULT="Player") //we hit the Player, if you are using a ScriptedPlayer you must
{ //change "Player" to the entityname of the ScriptedPlayer
HighLevel("Break");
return;
}
} ]
Break[ ()
{
//play "break" animation for it's full length
PlayAnimation("break", true, ""); //the last parameter can be changed into a "break-sound" e.g. "break.wav"
SetNoCollision(); //fall trough now
Gravity(true); //it falls down to until it meets the floor
FadeOut(10,0); //slowly fade out (10 seconds)
Remove(true); //end script
} ]
}
Everyone can see the difficult, but only the wise can see the simple.
-----
-----
Re: Is it posible to make a floor that breaks when u step on it?
Thanks, I'll try it out this afternoon.