Using variables
Moderator: Moderators
Using variables
I'm playing around with tltrudes brilliant 3 floor elevator and I wondered whether I could set variables in the beginning for the wait time, because I always have to change a dozen lines to change it for each floor, door, button...
Could I use sth like
level.elevwait = 10
and further down where it should be used:
wait level.elevwait
Trying above causes sth like a wait 0, as far as I can see...
Could I use sth like
level.elevwait = 10
and further down where it should be used:
wait level.elevwait
Trying above causes sth like a wait 0, as far as I can see...
You gave me hope and I tried i again!
And now it works!
This script was so messed up by my alterations (made three buttons to select each floor and not just up/down), that I didn't know what my name was
Next step: Make the buttons enlightened when trigger is triggerable. Will probably have to ask for help in near future...
Can I use those scriptobjects we once had for the torches, and bind them to the elevator?
Jv, tyvm! If I didn't know you're out there, I wouldn't have dared to start scripting
And now it works!
This script was so messed up by my alterations (made three buttons to select each floor and not just up/down), that I didn't know what my name was
Next step: Make the buttons enlightened when trigger is triggerable. Will probably have to ask for help in near future...
Can I use those scriptobjects we once had for the torches, and bind them to the elevator?
Jv, tyvm! If I didn't know you're out there, I wouldn't have dared to start scripting
Well, well, well Life couls be worse! 8)
The lights work. I used script_objects with a targename elight_in and I could bind them to the elevator (it's another script_object) with:
$elight_in bind $elevator
Lighting is done with
$elight_in light 0 1 0 10 (green) when tiggers are turned triggerable
Nice!
tltrude uses sounds like
$elevator playsound snd_ping
or
$elevator loopsound lighthouse_run
Where are these wavs? I would like to choose other sounds but couldn't even find the sounds he used...
The elevator is rumbling when it moves, though I can't find anything that look like that in the script. This is a part of it:
$elevator moveto $way_floor0
$elevator loopsound lighthouse_run
thread indicator_move_up
$elevator waitmove
$elevator loopsound lighthouse_run wait
$elevator playsound snd_ping
wait 1
thread upper_doors_cycle
level.elipos = 0
wait level.warte
thread triggers_on
goto elevator_standby_0
Do you see something that makes the elevator shake?
Ty!
The lights work. I used script_objects with a targename elight_in and I could bind them to the elevator (it's another script_object) with:
$elight_in bind $elevator
Lighting is done with
$elight_in light 0 1 0 10 (green) when tiggers are turned triggerable
Nice!
tltrude uses sounds like
$elevator playsound snd_ping
or
$elevator loopsound lighthouse_run
Where are these wavs? I would like to choose other sounds but couldn't even find the sounds he used...
The elevator is rumbling when it moves, though I can't find anything that look like that in the script. This is a part of it:
$elevator moveto $way_floor0
$elevator loopsound lighthouse_run
thread indicator_move_up
$elevator waitmove
$elevator loopsound lighthouse_run wait
$elevator playsound snd_ping
wait 1
thread upper_doors_cycle
level.elipos = 0
wait level.warte
thread triggers_on
goto elevator_standby_0
Do you see something that makes the elevator shake?
Ty!
And I just started to think...
Life is worse!
Anyhow the triggers are triggerable to early, during elevator movement. Because doors and level indicators depend on this, everything gets messed up, when the player is playing with the buttons while going with the elevator!
I don't know what to do: Mapping for halflife? Drugs?? Suicide???
Please help!!!!
Here's the map, bsp, scr of this elevator.
Please anyone take a look and tell me that it is easy to fix (and how). Don't look at the staircase, it's awfull, I know!
Tyvm
Life is worse!
Anyhow the triggers are triggerable to early, during elevator movement. Because doors and level indicators depend on this, everything gets messed up, when the player is playing with the buttons while going with the elevator!
I don't know what to do: Mapping for halflife? Drugs?? Suicide???
Please help!!!!
Here's the map, bsp, scr of this elevator.
Please anyone take a look and tell me that it is easy to fix (and how). Don't look at the staircase, it's awfull, I know!
Tyvm
This is the 1st script I'm fighting with, so I believe everything you say!
The script is more or less what tltrude has done for his elevator, I can slowly follow what's going on in it, but I wouldn't dare to write it new from scratch (is it said so?) Just tried to change the up/down buttons in 1/2/3 buttons with lighting
If you can make it smaller with the same function and want to, this is great!
Ofcourse you'll be the author then!
What my main prob is, as you might have seen, is that the trigger_on thread starts when it shouldn't!
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
lol, np's
yeah that is your main problem, you have trigger_on and trigger _off attached to too many of the script, i.e: doors and something else i think, you only need this 2 b attached to the button triggers
if you don't really understand what's goin on in the script i can put little //'s with it and let the script do the talkin, there are quite a few areas i've entirely erased script, but let's cross our fingers and find out if they really did do anything
anyway... back 2 it and i'll b back in a sec or hour with script in hand
yeah that is your main problem, you have trigger_on and trigger _off attached to too many of the script, i.e: doors and something else i think, you only need this 2 b attached to the button triggers
if you don't really understand what's goin on in the script i can put little //'s with it and let the script do the talkin, there are quite a few areas i've entirely erased script, but let's cross our fingers and find out if they really did do anything
anyway... back 2 it and i'll b back in a sec or hour with script in hand
hope this helps, prob not cos it's all foreign 2 me :-/
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
nope i'm goin ok as it is, is it possible that you'll want 2 add additional levels to this that the elevator will be able 2 reach, it's all sorted except the indicator,
i'll b needing 2 add a bit more complicated script 4 it if you are adding levels but easy enough if not, well both easy enough but which'll b more relevant?
anyway how about goin on a cruise ship and startin a comedy show with me?
THE NUGGETS AND WACKO SHOW!!!
you've heard it here 1st
i'll b needing 2 add a bit more complicated script 4 it if you are adding levels but easy enough if not, well both easy enough but which'll b more relevant?
anyway how about goin on a cruise ship and startin a comedy show with me?
THE NUGGETS AND WACKO SHOW!!!
you've heard it here 1st
hope this helps, prob not cos it's all foreign 2 me :-/
no, just 3 levels for me, thanks! But maybe we could give this brand new elevator to the rest of the world and there might be someone who wants to build s/th like the WTC][ (is it allowed to mention this in this forum? We'll probably be moved to somewhere else, now...) Anyway, an easier to adjust script might become handy!
A comedy show on a cruise ship
As I must confess, my English is rather bad, so I decided to try not to be too funny in this forum and on cruise ships. I had some rather embarrassing moments in my life, though, not yet on cruise ships: I told jokes to English speaking people. I thought them to be very funny and, well, they didn't (See above). Maybe the wrong people!? But, we could go on a german ship! German humor is easy
especially for a typical audience on a cruise ship, I'd say!
A comedy show on a cruise ship
As I must confess, my English is rather bad, so I decided to try not to be too funny in this forum and on cruise ships. I had some rather embarrassing moments in my life, though, not yet on cruise ships: I told jokes to English speaking people. I thought them to be very funny and, well, they didn't (See above). Maybe the wrong people!? But, we could go on a german ship! German humor is easy
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
right then!!!
i ended up goin out so it took a little longer than expected, it's bloody 5am GMT!!!
anyways i'll send u the map 2moro and the script but here's the script 4 now, i may as well make a new tut, no disrespect 2 the person that wrote the original but... hmmm...
another anyway... here it is
///////////////////
// //
// jjjjj k k //
// j k k //
// j kkk //
// j j k k //
// jjj k k //
// //
///////////////////
//here's all the bits needed to make your own elevator with no limit to the number of levels
//see --------->>> for where to add the script for the levels (note there are 5 areas needing the new script (
main:
// \\\ change this number if adding floors///
// vvv
level.levels = 3 //to be entered by the mapper/scripter of the map in question
level.indiangle = (180 / (level.levels - 1)) //note "indiangle" is "indicator angle" but shorter,
level.eleposold = 0 //will need to be changed to the starting floor of the elevator
level waittill spawn
thread elevator_prep
end
// Three Story Elevator !!!redefined!!!
//credit also goes to WACKO for the indicator and lights idea
/////////////////////////////////////////////////////
//__________________the beginning__________________//
/////////////////////////////////////////////////////
elevator_prep:
$elevator_button0 bind $elevator //joins all the associated entities to the elevator
$elevator_button1 bind $elevator
$elevator_button2 bind $elevator
$doorA_lt bind $elevator
$doorA_rt bind $elevator
$elight_in bind $elevator
$elevator time level.elespeed // sets the movement times
$doorA_lt speed 45
$doorA_rt speed 45
$door0_lt speed 48
$door0_rt speed 48
$door1_lt speed 48
$door1_rt speed 48
$door2_lt speed 48
$door2_rt speed 48
//-------->>> new doors set up in here
end
///////////////////////////////////////////////////
//__________________the calling__________________//
///////////////////////////////////////////////////
//setup for the ground floor (0)
call_floor0:
thread turn_triggers_off
level.eleposnew = 0
thread where_am_i
// $elevator loopsound lighthouse_run
$elevator moveto $way_floor0
$elevator waitmove
wait .5
thread doors_cycle0
// $elevator loopsound lighthouse_run wait
level.eleposold = 0
end
//setup for the 1st floor (1)
call_floor1:
thread turn_triggers_off
level.eleposnew = 1
thread where_am_i
// $elevator loopsound lighthouse_run
$elevator moveto $way_floor1
$elevator waitmove
wait 0.5
thread doors_cycle1
$elevator loopsound lighthouse_run wait
level.eleposold = 1
end
//--------------------------------------------------------------->>>
//setup for the 2nd floor (2) //-->>>
call_floor2: //-->>>
thread turn_triggers_off //-->>>
level.eleposnew = 2 //-->>>
thread where_am_i //-->>>
// $elevator loopsound lighthouse_run //-->>>
$elevator moveto $way_floor2 //-->>>
$elevator waitmove //-->>>
wait 0.5 //-->>>
thread doors_cycle2 //-->>>
$elevator loopsound lighthouse_run wait //-->>>
level.eleposold = 2 //-->>>
end //-->>>
//--------------------------------------------------------------->>> copy all this script and change the 2's to the new floor numbers
//////////////////////////////////////////////////
//__________________the motion__________________//
//////////////////////////////////////////////////
//elevator doors
doors_cycleA:
$elevator playsound lighthouse_lever
$doorA_lt moveSouth 48
$doorA_lt move
$doorA_rt moveNorth 48
$doorA_rt waitmove
wait 5
$elevator playsound lighthouse_lever
$doorA_lt moveNorth 48
$doorA_lt move
$doorA_rt moveSouth 48
$doorA_rt waitmove
$elevator playsound snd_ping
thread turn_triggers_on
end
//floor0 doors
doors_cycle0:
thread doors_cycleA
wait .1
$door0_lt moveSouth 48
$door0_lt move
$door0_rt moveNorth 48
$door0_rt move
wait 5
$door0_lt moveNorth 48
$door0_lt move
$door0_rt moveSouth 48
$door0_rt move
end
//floor1 doors
doors_cycle1:
thread doors_cycleA
wait .1
$door1_lt moveSouth 48
$door1_lt move
$door1_rt moveNorth 48
$door1_rt move
wait 5
$door1_lt moveNorth 48
$door1_lt move
$door1_rt moveSouth 48
$door1_rt move
end
//-------------------------------->>>
//floor2 doors //-->>>
doors_cycle2: //-->>>
thread doors_cycleA //-->>>
wait .1 //-->>>
$door2_lt moveSouth 48 //-->>>
$door2_lt move //-->>>
$door2_rt moveNorth 48 //-->>>
$door2_rt move //-->>>
wait 5 //-->>>
$door2_lt moveNorth 48 //-->>>
$door2_lt move //-->>>
$door2_rt moveSouth 48 //-->>>
$door2_rt move //-->>>
end //-->>>
//-------------------------------->>> AND copy all this script and change the 2's to the new floor numbers
//////////////////////////////////////////////////////
//__________________the tricky bit__________________//
//////////////////////////////////////////////////////
where_am_i:
if (level.eleposnew == level.eleposold)
{
$elevator time 0.25
}
else
if (level.eleposnew > level.eleposold)
{
level.distance = (level.eleposnew - level.eleposold)
$elevator time (level.distance * 5)
$floor_id time (level.distance * 5)
$floor_id rotateZdown (level.indiangle * level.distance)
$floor_id waitmove
}
else
if (level.eleposold > level.eleposnew)
{
level.distance = (level.eleposold - level.eleposnew)
$elevator time (level.distance * 5)
$floor_id time (level.distance * 5)
$floor_id rotateZup (level.indiangle * level.distance)
$floor_id waitmove
}
end
////////////////////////////////////////////////////
//__________________the triggers__________________//
////////////////////////////////////////////////////
//thread to disable all triggers
turn_triggers_off:
$button0 nottriggerable
$button1 nottriggerable
$button2 nottriggerable
//------>>>add all new triggers for buttons in here
$elevator_button0 nottriggerable
$elevator_button1 nottriggerable
$elevator_button2 nottriggerable
$elight_in light 1 0 0 10
$elight_out light 1 0 0 10
end
//thread to enable/re-enable all triggers
turn_triggers_on:
$button0 triggerable
$button1 triggerable
$button2 triggerable
//------>>>AND again in here
$elevator_button0 triggerable
$elevator_button1 triggerable
$elevator_button2 triggerable
$elight_in light 0 1 0 10
$elight_out light 0 1 0 10
end
//as said in the script this will work 4 a lift with however many levels with the mathematics already worked out,
//if you do want to add the indicator on it, then you will need to create it on an 180 degree arc with a central arrow,
//good luck peeps, anymore questions contact me on YAHOO MESSENGER
//i'll give you my bank details 4 all donations then
//BLOODY 5AM bedtime!!!
i ended up goin out so it took a little longer than expected, it's bloody 5am GMT!!!
anyways i'll send u the map 2moro and the script but here's the script 4 now, i may as well make a new tut, no disrespect 2 the person that wrote the original but... hmmm...
another anyway... here it is
///////////////////
// //
// jjjjj k k //
// j k k //
// j kkk //
// j j k k //
// jjj k k //
// //
///////////////////
//here's all the bits needed to make your own elevator with no limit to the number of levels
//see --------->>> for where to add the script for the levels (note there are 5 areas needing the new script (
main:
// \\\ change this number if adding floors///
// vvv
level.levels = 3 //to be entered by the mapper/scripter of the map in question
level.indiangle = (180 / (level.levels - 1)) //note "indiangle" is "indicator angle" but shorter,
level.eleposold = 0 //will need to be changed to the starting floor of the elevator
level waittill spawn
thread elevator_prep
end
// Three Story Elevator !!!redefined!!!
//credit also goes to WACKO for the indicator and lights idea
/////////////////////////////////////////////////////
//__________________the beginning__________________//
/////////////////////////////////////////////////////
elevator_prep:
$elevator_button0 bind $elevator //joins all the associated entities to the elevator
$elevator_button1 bind $elevator
$elevator_button2 bind $elevator
$doorA_lt bind $elevator
$doorA_rt bind $elevator
$elight_in bind $elevator
$elevator time level.elespeed // sets the movement times
$doorA_lt speed 45
$doorA_rt speed 45
$door0_lt speed 48
$door0_rt speed 48
$door1_lt speed 48
$door1_rt speed 48
$door2_lt speed 48
$door2_rt speed 48
//-------->>> new doors set up in here
end
///////////////////////////////////////////////////
//__________________the calling__________________//
///////////////////////////////////////////////////
//setup for the ground floor (0)
call_floor0:
thread turn_triggers_off
level.eleposnew = 0
thread where_am_i
// $elevator loopsound lighthouse_run
$elevator moveto $way_floor0
$elevator waitmove
wait .5
thread doors_cycle0
// $elevator loopsound lighthouse_run wait
level.eleposold = 0
end
//setup for the 1st floor (1)
call_floor1:
thread turn_triggers_off
level.eleposnew = 1
thread where_am_i
// $elevator loopsound lighthouse_run
$elevator moveto $way_floor1
$elevator waitmove
wait 0.5
thread doors_cycle1
$elevator loopsound lighthouse_run wait
level.eleposold = 1
end
//--------------------------------------------------------------->>>
//setup for the 2nd floor (2) //-->>>
call_floor2: //-->>>
thread turn_triggers_off //-->>>
level.eleposnew = 2 //-->>>
thread where_am_i //-->>>
// $elevator loopsound lighthouse_run //-->>>
$elevator moveto $way_floor2 //-->>>
$elevator waitmove //-->>>
wait 0.5 //-->>>
thread doors_cycle2 //-->>>
$elevator loopsound lighthouse_run wait //-->>>
level.eleposold = 2 //-->>>
end //-->>>
//--------------------------------------------------------------->>> copy all this script and change the 2's to the new floor numbers
//////////////////////////////////////////////////
//__________________the motion__________________//
//////////////////////////////////////////////////
//elevator doors
doors_cycleA:
$elevator playsound lighthouse_lever
$doorA_lt moveSouth 48
$doorA_lt move
$doorA_rt moveNorth 48
$doorA_rt waitmove
wait 5
$elevator playsound lighthouse_lever
$doorA_lt moveNorth 48
$doorA_lt move
$doorA_rt moveSouth 48
$doorA_rt waitmove
$elevator playsound snd_ping
thread turn_triggers_on
end
//floor0 doors
doors_cycle0:
thread doors_cycleA
wait .1
$door0_lt moveSouth 48
$door0_lt move
$door0_rt moveNorth 48
$door0_rt move
wait 5
$door0_lt moveNorth 48
$door0_lt move
$door0_rt moveSouth 48
$door0_rt move
end
//floor1 doors
doors_cycle1:
thread doors_cycleA
wait .1
$door1_lt moveSouth 48
$door1_lt move
$door1_rt moveNorth 48
$door1_rt move
wait 5
$door1_lt moveNorth 48
$door1_lt move
$door1_rt moveSouth 48
$door1_rt move
end
//-------------------------------->>>
//floor2 doors //-->>>
doors_cycle2: //-->>>
thread doors_cycleA //-->>>
wait .1 //-->>>
$door2_lt moveSouth 48 //-->>>
$door2_lt move //-->>>
$door2_rt moveNorth 48 //-->>>
$door2_rt move //-->>>
wait 5 //-->>>
$door2_lt moveNorth 48 //-->>>
$door2_lt move //-->>>
$door2_rt moveSouth 48 //-->>>
$door2_rt move //-->>>
end //-->>>
//-------------------------------->>> AND copy all this script and change the 2's to the new floor numbers
//////////////////////////////////////////////////////
//__________________the tricky bit__________________//
//////////////////////////////////////////////////////
where_am_i:
if (level.eleposnew == level.eleposold)
{
$elevator time 0.25
}
else
if (level.eleposnew > level.eleposold)
{
level.distance = (level.eleposnew - level.eleposold)
$elevator time (level.distance * 5)
$floor_id time (level.distance * 5)
$floor_id rotateZdown (level.indiangle * level.distance)
$floor_id waitmove
}
else
if (level.eleposold > level.eleposnew)
{
level.distance = (level.eleposold - level.eleposnew)
$elevator time (level.distance * 5)
$floor_id time (level.distance * 5)
$floor_id rotateZup (level.indiangle * level.distance)
$floor_id waitmove
}
end
////////////////////////////////////////////////////
//__________________the triggers__________________//
////////////////////////////////////////////////////
//thread to disable all triggers
turn_triggers_off:
$button0 nottriggerable
$button1 nottriggerable
$button2 nottriggerable
//------>>>add all new triggers for buttons in here
$elevator_button0 nottriggerable
$elevator_button1 nottriggerable
$elevator_button2 nottriggerable
$elight_in light 1 0 0 10
$elight_out light 1 0 0 10
end
//thread to enable/re-enable all triggers
turn_triggers_on:
$button0 triggerable
$button1 triggerable
$button2 triggerable
//------>>>AND again in here
$elevator_button0 triggerable
$elevator_button1 triggerable
$elevator_button2 triggerable
$elight_in light 0 1 0 10
$elight_out light 0 1 0 10
end
//as said in the script this will work 4 a lift with however many levels with the mathematics already worked out,
//if you do want to add the indicator on it, then you will need to create it on an 180 degree arc with a central arrow,
//good luck peeps, anymore questions contact me on YAHOO MESSENGER
//i'll give you my bank details 4 all donations then
//BLOODY 5AM bedtime!!!
hope this helps, prob not cos it's all foreign 2 me :-/
Thanks, this looks nice indeed!
But, shouldn't there be s/th like
$elevator_button# waittill trigger
and
$button# waittill trigger
somewhere to make these buttons work? Well, I just read the script and didn't test it because I'll have to rename all buttons and waypoints first.
And please: No credits to me for the indicator, it's tltrude's. Just the lights: I just added them to see when these damn triggers were active
But, shouldn't there be s/th like
$elevator_button# waittill trigger
and
$button# waittill trigger
somewhere to make these buttons work? Well, I just read the script and didn't test it because I'll have to rename all buttons and waypoints first.
And please: No credits to me for the indicator, it's tltrude's. Just the lights: I just added them to see when these damn triggers were active
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
lol, ahhh ok respect removed 4 the indicator and given to tltrude!!!
as 4 the lights, still a gr8 idea and worth keeping on the map
the script doesn't need a waittill trigger, i've put in the map, setthread on the button triggers, this does the same thing but the other way around, (instead of saying don't play it until this has been activated, it's sayin once activated do this) could b done the other way around but there ya go, lol, but if it really means that much 2 ya... ermmm... we'll have 2 find ourselves a guinea pig
i'll make a tut 4 it b4 the end of next week and you will see what i mean, and as 4 sending you the map i'll email it 2 ya as soon as
another good days work at the office
as 4 the lights, still a gr8 idea and worth keeping on the map
the script doesn't need a waittill trigger, i've put in the map, setthread on the button triggers, this does the same thing but the other way around, (instead of saying don't play it until this has been activated, it's sayin once activated do this) could b done the other way around but there ya go, lol, but if it really means that much 2 ya... ermmm... we'll have 2 find ourselves a guinea pig
i'll make a tut 4 it b4 the end of next week and you will see what i mean, and as 4 sending you the map i'll email it 2 ya as soon as
another good days work at the office
hope this helps, prob not cos it's all foreign 2 me :-/
