Scripting questions

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

ok... so do make the Trigger>use have these:
Key: targetname
Value: ES

and the Script>Object have these:
Key: targetname
Value: EB
and then have my script be...

Code: Select all

main:

level waittill prespawn

thread E1

level waittill spawn

end

E1:
$E1 waittill trigger
$EB loopsound lighthouse_run
$EB time 10
$EB movexup 300
$EB waitmove
$EB stoploopsound lighthouse_run
wait 5
$EB loopsound lighthouse_run
$EB time 10
$EB movexdown 300
$EB waitmove
$EB stoploopsound lighthouse_run
wait 1
goto E1
end
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

switch

Post by tltrude »

I thought your switch was named "ES"? Anyway, if you have renamed the trigger to ES then change this line and it should work.

$ES waittill trigger
Tom Trude,

Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

LOL! wow, im dumb. Ok tom, ill try it out and if it dosnt work I will be sad > :(
Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

oh, I put my .scr in my DM folder right? Im not sure :(
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

scr

Post by tltrude »

The script (.scr) goes in the same folder as your map (.bsp). They must both have the same name.

main/maps = Singleplayer
main/maps/dm = FFA, Team Match, and Round Based Match
main/maps/obj = Objective Based Match
Tom Trude,

Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

ok, my .bsp name and my .scr name are exactly the same, case wise and everything. they are both in my DM folder. I load the map in MOHAA, press the switch and nothing happens. the best I can do right now is make a Func>Door brush that is as high as I want the thing to go and make it go up... but unfortunatly, that sounds like a wooden door. I dont even know how to make it sound metal at least :( here is exactly what my script looks like.

Code: Select all

main:

level waittill prespawn

thread ES

level waittill spawn

end

ES:
$ES waittill trigger
$EB loopsound lighthouse_run
$EB time 10
$EB movexup 300
$EB waitmove
$EB stoploopsound lighthouse_run
wait 5
$EB loopsound lighthouse_run
$EB time 10
$EB movexdown 300
$EB waitmove
$EB stoploopsound lighthouse_run
wait 1
goto ES
end
And I give both the Trigger>use AND the Script>object a Key of Targetname not target or something like that right? it has to be
Key: targetname for them both right? and
Value: ES (for switch) and Value: EB (for script object)

Please check for even the slightest error. i will keep trying things too but I need expirience to back me up. plz help me in my time of noob.
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

moveup

Post by tltrude »

Yes, "targetname" is the Key and the Values are the different names you choose. I think you are getting mixed up on the names of things. The switch, I think, is a model of a little animated switch. And the trigger is a brush, with trigger texture, that has been turned into a trigger_use. It might help you to keep track of the names, if you use longer names.

trigger ==========

Key: targetname
Value: eleb_trigger

elevator ==========

Key: targetname
Value: eleb

switch ==========

Key: targetname
Value: eleb_switch

Notice that I am not using capital letters at all. Using capitals just adds to posibilities of making more errors in your script. If you change the targetnames, your script would look like this.

Code: Select all

main: 

     level waittill prespawn 

     //$eleb_switch bind $eleb  // attaches the switch to the elevator (not in use)
     //$eleb_trigger bind $eleb  // attaches the trigger to the elevator (not in use)

     $eleb time 10 // sets the travel time in seconds
     thread elevator_mover 

     level waittill spawn 

end 

elevator_mover: 

     $eleb_trigger waittill trigger 
     $eleb loopsound lighthouse_run  
     $eleb moveup 300 
     $eleb waitmove 
     $eleb stoploopsound
 
     wait 5 

     $eleb loopsound lighthouse_run 
     $eleb movedown 300 
     $eleb waitmove 
     $eleb stoploopsound 

     goto elevator_mover 

end
Tom Trude,

Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

dosnt work, I even resorted to copying that script and renaming my stuff. it dosnt work :( :( :( :(
Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

where does the text "Elevator_mover" come from? is that relevant info?
Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

!!!!!!!!! I GOT IT WORKING! IT WORKS! I DID IT! THANK YOU SOOOO MUCH TOM! YOU RULE. Thnx for not getting too impatient with me. The one scripting skill will revolutionize my mapping skill :) thanx again :!:

Now uhhh, heres another question... how do I make it be able to be used by 2 switches? so that when one is pressed, they can only be used again when it comes down? I will learn this sometime so be patient. I got one down at least so im happy!
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

elevator_mover

Post by tltrude »

The name "elevator_mover" is just a name I made up for that thread. The name just helps you remember what the thread does. Notice too that the same thread name is used to "call" the thread under "level waittill prespawn" (when your map starts). At the bottom of the thread "goto" makes the thread loop by calling the name again.

I can't tell what you want for the two switches. Please try harder (take more time) to describe it. Start off by describing how the elevator works now. Do the switch and trigger move with it?
Tom Trude,

Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

no, I turned the switch into a panel so the only thing moving is the Elevator Brush. I have the EB at the bottom of the map and it has to go 704 World Units to get to the top. I want a switch at the bottom and one at the top. It goes VERY VERY VERY VERY VERY slowly though. I cant figure out how to make it go faster. heres what the script looks like now.

Code: Select all

main:

level waittill prespawn

$ET bind $EB

$EB time 80
thread elevator_mover

level waittill spawn

end

elevator_mover:

$ET waittill trigger
$EB loopsound lighthouse_run
$EB moveup 704
$EB waitmove
$EB stoploopsound

wait 10

$EB loopsound lighthouse_run
$EB movedown 704
$EB waitmove
$EB stoploopsound

goto elevator_mover

end
I figured that by changeing the time, it would go faster but it goes really slow still.

But the panel looks like this:
Image

and it goes here:
Image

What I want to do is to be able to call that EB up from the top again so basically I just want a second switch at the top to do the same exact thing as the first one. Also can you tell me how to speed up the darn thing? thnx.
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

time

Post by tltrude »

The "time" is travel time in seconds, so the smaller the number is, the faster it will go.

For a second trigger, just make another trigger_use and give it this key/value.

Key: target
Value: ET

I think that will work. If you want "ET" to stay on the ground, remove this line "$ET bind $EB".
Tom Trude,

Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

oh cool. thnx!
Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

I have used my new found talent with elevators in my newest map called Snipervalley_Extreme. The bridge acts like an elevator in the sense that it only goes up about 200 world units. The map is a TDM/DM/RB map that is pretty simple. It isnt that big either but I think a lot of people will enjoy it. It is kind of like the original snipervalley but the bridge allows for invasions of either side. I dont have anything available to show you right now but i will later. I am still in the process of beta testing it. Once I have finalized it i will have screenies AND the PK3 file or a link to the URL that I have it on. So get ready to try it out :)
Image
Post Reply