Page 2 of 2
Re: 3D floor with special?
Posted: Tue Mar 30, 2010 10:12 pm
by hfc2x
Project Dark Fox wrote:Though nice to have the if/else written out, it can be condensed to two lines:
Code: Select all
script 4 (void)
{
if (GetActorFloorZ (0) >= 392)
Teleport(1,0,0);
}
Note the lack of brackets. This works only if you have a single thing to process whatever's under the "if". The else is unnecessary and it will automatically terminate on its own.
Just thought I'd let you know is all.

Wow that was simple xD
Well, I want now to create a vent that thrusts players upwards when stepped on, but only till certain altitude.
Here I have this script, activated through
ACS_ExecuteAlways so multiple players can be thrusted at once:
Code: Select all
int InSector[99];
script 1 (void)
{
InSector[PlayerNumber()] = true;
while (InSector[PlayerNumber()])
{
ThrustThingZ(const: 0, 80, 0, 0);
delay(const:1);
}
}
script 2 (void) // script to terminate Script 1
{
InSector[PlayerNumber()] = false;
}
Well, that script thrusts players upward all the way to the ceiling, but I need to change the force at certain point... how do I do it?
Re: 3D floor with special?
Posted: Tue Mar 30, 2010 11:31 pm
by Project Shadowcat
I'm thinking that you should, again, play with GetActor(Floor)Z for this. At the same time, try lower forces. 6-10 allows it to be controllable.
Re: 3D floor with special?
Posted: Wed Mar 31, 2010 6:13 am
by hfc2x
Project Dark Fox wrote:I'm thinking that you should, again, play with GetActor(Floor)Z for this. At the same time, try lower forces. 6-10 allows it to be controllable.
Well, I actually tried a script like this:
Code: Select all
script 1 (void) // ventilador
{
InSector[PlayerNumber()] = true;
while (InSector[PlayerNumber()])
{
ThrustThingZ(const: 0, 40, 0, 0);
if ((GetActorZ (0) - GetActorFloorZ (0)) < 640) // added these
delay(const:1); // lines.
}
}
and also set a script to check the formula, so I know the values to use:
Code: Select all
script 99 ENTER
{
while (TRUE)
{
Print (f:GetActorZ (0) - GetActorFloorZ (0));
Delay (1);
}
}
But I get a "Runaway Script 1 terminated." warning, though.
I don't know what I'm doing wrong, because I use the correct value (taken from the counter in SCRIPT 99).
Re: 3D floor with special?
Posted: Wed Mar 31, 2010 8:49 am
by Project Shadowcat
Because the "if" statement is only applying to your delay(1);. You need that running all of the time for the script to not runaway.
Re: 3D floor with special?
Posted: Thu Apr 01, 2010 4:13 am
by Klofkac
hfc2x wrote:Klofkac wrote:I'm put. That "Actor hits ceiling/floor" thing affects only control sector and I don't know, what I must do for success.
I use type 1 3D floor.
You must use an "Actor Hits Floor" thing, and only works for the Vavoom-type 3D floor (the one with the inverted floor/ceiling heights)
No change.
Re: 3D floor with special?
Posted: Thu Apr 01, 2010 12:46 pm
by hfc2x
Klofkac wrote:hfc2x wrote:Klofkac wrote:I'm put. That "Actor hits ceiling/floor" thing affects only control sector and I don't know, what I must do for success.
I use type 1 3D floor.
You must use an "Actor Hits Floor" thing, and only works for the Vavoom-type 3D floor (the one with the inverted floor/ceiling heights)
No change.
Weird... it worked for me.
Are you sure you're doing everything right? Set the dummy sector to have the floor higher than its ceiling and put an "Actor Hits Ceiling" thing in it. Set the 3D floor to type 3 (Vavoom) and add the special to the "Actor Hits Floor" thing.
The created 3D floor will have the special of the Thing, but will be activated only when hitting the floor (for example if you jump on it).
I did all that, and worked... it's weird that doesn't work for you
Project Dark Fox wrote:Because the "if" statement is only applying to your delay(1);. You need that running all of the time for the script to not runaway.
Well, I got my script to work finally

I had to shift the result bits, because
GetActor(Floor)Z returns a fixed point value, so the script ended like this:
Code: Select all
int InSector[99];
script 1 (void)
{
InSector[PlayerNumber()] = true;
SetActorProperty(0,APROP_Gravity,0.38); // Gravity gets lowered, so the player doesn't fall too
while (InSector[PlayerNumber()]) // fast, giving it a "mid-air" feel
{
ThrustThingZ(0, 30, 0, 0);
delay(1);
if (((GetActorZ (0) - GetActorFloorZ (0)) >> 16) > 640)
delay(45); // The extra delay is for the player to fall a bit before being thrusted again
}
}
script 2 (void)
{
SetActorProperty(0,APROP_Gravity,1.0);
InSector[PlayerNumber()] = false;
}
script 98 RESPAWN // Script to prevent players from being thrusted idefinitely if they die on the ventilator
{
ACS_ExecuteAlways(2,0,0,0,0);
}
It works like a charm now
