Hi
I'm trying to get below script to run as it should..
You get a warning that you need to hurry. Ceiling drops down and squashes you if you run out of time.
If I use eblock then you can't run, if i use eNoBlock then the next piece of script runs.
Am i using the correct IsCollidingWithObject or is it a {} problem?
function room_AfterFadeIn()
{
Display("Clue: You are going to have to hurry!");
SetTimer(1, 320);
object[0].Move(80, 397, 4, eNoBlock, eAnywhere);
if (cindy_bones.IsCollidingWithObject(object[0]) == 1)
Display("You've been squashed. It's the end of your journey!!");
cindy_bones.ChangeView(17);
}
All help appreciated.
barefoot
It won't work because you're checking whether stuff collide in the room Fade_In() event, i.e. it's only being checked once, and it's even just right after the object megins to move.
You need to check this in repeatedly_execute() instead, something like:
function repeatedly_execute(){
if (IsTimerExpired(1)) {
if (cindy_bones.IsCollidingWithObject(object[0])) Display("You've been squashed. It's the end of your journey!!");
else Display("Congratulations! You escaped from the trap!");
}
}
Gilbet, thought we had it..
but its not really working.. Ive set the timer to activate from a region now.
The ceiling drops down as it should with the char behind it but nothing is said (displayed)..I also wanted the char to changeview to 17 if collides...
function region1_WalksOnto()
{
Display("Clue: You are going to have to hurry!");
SetTimer(1, 160);
object[0].Move(80, 469, 2, eNoBlock, eAnywhere);
}
And put this in RepExec:
function room_RepExec(){
if (IsTimerExpired(1)) {
if (cindy_bones.IsCollidingWithObject(object[0])) Display("You've been squashed. It's the end of your journey!!");
else Display("Congratulations! You escaped from the trap!");
}
}
UPDATE
I think it may be a case of distance,speed of object and time..!!
This is what I now use:
function region1_WalksOnto()
{
Display("Clue: You are going to have to hurry!");
SetTimer(1, 120);
object[0].Move(56, 433, 3, eNoBlock, eAnywhere);
}
function room_RepExec(){
if (IsTimerExpired(1)) {
if (cindy_bones.IsCollidingWithObject(object[0])) Display("You've been squashed. It's the end of your journey!!");
else Display("Congratulations! You escaped from the trap!");
}
}
Do I really need a Timer?... would it be better to adjust speed of Object with Collision???
barefoot
The use of the timer was just a suggestion, I don't think you'll need it.
The problem is that IsTimerExpired will only return true once, then false again.
Just remove it.
Also keep in mind that Character.IsCollidingWithObject checks the position of the character's feet (the best use would be checking whether the character is standing on a piece of paper they can pick up). For something that's dropping down on the character, I'd check the object's Y coordinate and if the character is standing on a region.
Khris
as per my last message, is a timer really needed...
my lastest script works ok.. my only let down is it not able to change cindy_bones view to 17 (squashed view) before displaying "You've been squashed. It's the end of your journey!!"
Thanks for your advice Khris
UPDATE: SORTED
barefoot