Scripts... what the hell!!!
Scripts... what the hell!!!
Hello everybody, I'm having some problems with a script in a map I'm making, I'm new in mapping and it's the first time I try to create a script.
I have created an elevator using 3D floor in gzdoom builder, I've put the tag 45 on the floor, on the ceiling of the elevator.
I want that you can call the elevator with a switch and then the elevator came back to the original position after waiting for some second.
This is what I wrote:
script 8 (void)
{
Floor_LowerByValue(45,27,128);
Ceiling_LowerByValue(45,27,128);
Delay(1);
Floor_RaiseByValue(45,27,128);
Ceiling_RaiseByValue(45,27,128);
}
Repetable action;
When player presses use;
The elevator lower correct, but is not raising... What am I missing?
I have created an elevator using 3D floor in gzdoom builder, I've put the tag 45 on the floor, on the ceiling of the elevator.
I want that you can call the elevator with a switch and then the elevator came back to the original position after waiting for some second.
This is what I wrote:
script 8 (void)
{
Floor_LowerByValue(45,27,128);
Ceiling_LowerByValue(45,27,128);
Delay(1);
Floor_RaiseByValue(45,27,128);
Ceiling_RaiseByValue(45,27,128);
}
Repetable action;
When player presses use;
The elevator lower correct, but is not raising... What am I missing?
Last edited by marcello on Fri Jul 24, 2015 7:04 am, edited 1 time in total.
RE: Scripts... what the hell!!!
You will probably have to lengthen the delay time to compensate for the Floor and Ceiling lower speed, otherwise the raise event happens too early afterwards.
Last edited by ARGENTVM on Fri Jul 24, 2015 7:38 am, edited 1 time in total.
-
Catastrophe
- Retired Staff / Community Team Member
- Posts: 2571
- Joined: Sat Jun 02, 2012 2:44 am
RE: Scripts... what the hell!!!
instead of delay(1); use tagwait(45);
RE: Scripts... what the hell!!!
While I was waiting I figured out:
script 8 (void)
{
{
Floor_LowerByValue(45,27,128);
Ceiling_LowerByValue(45,27,128);
Delay(1);
}
Delay(100);
{
Floor_RaiseByValue(45,27,128);
Ceiling_RaiseByValue(45,27,128);
Delay(1);
}
}
In this way it works. But I try tagwait right now! Tahnk you!
script 8 (void)
{
{
Floor_LowerByValue(45,27,128);
Ceiling_LowerByValue(45,27,128);
Delay(1);
}
Delay(100);
{
Floor_RaiseByValue(45,27,128);
Ceiling_RaiseByValue(45,27,128);
Delay(1);
}
}
In this way it works. But I try tagwait right now! Tahnk you!
-
Catastrophe
- Retired Staff / Community Team Member
- Posts: 2571
- Joined: Sat Jun 02, 2012 2:44 am
RE: Scripts... what the hell!!!
Np, also just letting you know, FloorAndCeiling_LowerByValue and FloorAndCeiling_RaiseByValue exists.
Last edited by Catastrophe on Fri Jul 24, 2015 9:37 am, edited 1 time in total.
RE: Scripts... what the hell!!!
tagwait is more flexible because you won't have to change the delay if you decide to alter the raise/lower speed in the future.marcello wrote: While I was waiting I figured out:
script 8 (void)
{
{
Floor_LowerByValue(45,27,128);
Ceiling_LowerByValue(45,27,128);
Delay(1);
}
Delay(100);
{
Floor_RaiseByValue(45,27,128);
Ceiling_RaiseByValue(45,27,128);
Delay(1);
}
}
In this way it works. But I try tagwait right now! Tahnk you!
Code: Select all
<Synert> fuck
<Synert> plugged in my memory stick and got a bsodRE: Scripts... what the hell!!!
Nobody noticed this thread being in the wrong place? There's Editing Help section for these questions.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
RE: Scripts... what the hell!!!
the delay(x); thing counts tics, not seconds. 35 tics = 1 second
RE: Scripts... what the hell!!!
Moved thread to the correct subforum.
Also, this is probably the best thing to do:
Also, this is probably the best thing to do:
Code: Select all
script 8 (void){
FloorAndCeiling_LowerByValue(45,27,128);
Tagwait(45);
Delay(35); //wait a second before actually moving up again.
FloorAndCeiling_RaiseByValue(45,27,128);
}
Last edited by Fused on Fri Jul 24, 2015 12:33 pm, edited 1 time in total.
RE: Scripts... what the hell!!!
Ah? ahahahaha! I didn't know it!!!Catastrophe wrote: Np, also just letting you know, FloorAndCeiling_LowerByValue and FloorAndCeiling_RaiseByValue exists.
Thank you, didn't know "tagwait".Konda wrote: tagwait is more flexible because you won't have to change the delay if you decide to alter the raise/lower speed in the future.
Ok, this information is very usefull.Lycaon wrote: the delay(x); thing counts tics, not seconds. 35 tics = 1 second
Ivan wrote: Nobody noticed this thread being in the wrong place? There's Editing Help section for these questions.
My apologiesFused wrote: Moved thread to the correct subforum.
Works really great! Thank you everybody, I am very greteful, may I ask another question? If I want to change the brightness of a room, which script should I look for?Fused wrote: Also, this is probably the best thing to do:Code: Select all
script 8 (void){ FloorAndCeiling_LowerByValue(45,27,128); Tagwait(45); Delay(35); //wait a second before actually moving up again. FloorAndCeiling_RaiseByValue(45,27,128); }
RE: Scripts... what the hell!!!
Light_Fade (tag, value, tics)marcello wrote: If I want to change the brightness of a room, which script should I look for?
- tag: Tag of affected sector
- value: New light level
- tics: How long the light takes to fade to the new level
Since the thirth argument allows you to slowly fade to the desired brightness, a loop is not needed.
RE: Scripts... what the hell!!!
Ok, and if I want to coordinate a sound with the lack of light I had first to define it in SNDINFO, then I had to use "A_PlaySound" function?
RE: Scripts... what the hell!!!
Nevermind, I don't need the answer anymore! SNDINFO, SNDSEQ, 80 script X (void) {Soundsequence ("myfile"); }
Thank you anyway!
Thank you anyway!