Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Opening doors in the right way

Page: 1 of 1
 [ASJN] Balboa
02-07-2004, 6:53 PM
#1
hi, i'm currently working on a castle map, and i saw in one of the sp levels t3_rift maybe? where your in that trench, that theres this door that opens by going outwards. hard to explain, but first after you kill three reborns, you see this door. you use seeing, and then pull, and it opens towards you, like the entire door is changing. how do i make something like that? not the force part, just a door that opens outwards like that? is it even a func_door?
 vas_zag
02-07-2004, 7:05 PM
#2
ah you mean like that door in christmas in whoville?
i believe he made some script to do that check in the pk3
 WadeV1589
02-07-2004, 10:09 PM
#3
It's a func_static with an origin brush at one edge of it. You use icarus to tell it to rotate


affect("func_static_name", FLUSH){
//rotate 90 degrees on Z axis over a period of 2 seconds
rotate (<0 0 90>, 2000);
}

//wait 3 seconds
wait(3000);

affect("func_static_name", FLUSH){
//rotate back to origin over a period of 2 seconds
rotate (<0 0 0>, 2000);
}


Knowing my luck I probably put the 90 in the wrong place now ^.^
 lassev
02-07-2004, 10:45 PM
#4
Here's a little picture to remind of the angles (as they are sometimes hard to remember, even for me, and I have rotated God knows how many items over time):

http://www.student.oulu.fi/~lvaarisk/angles.jpg)

Just think of the rectangles with letters as flags winding around the axes. And then imagine your object to be rotated to replace one of the flags :)

In this case a door would most obviously be B, just like Wade said. Yeah, take note of the Axes names in my pic. You must imagine it as a 3D image, not like 2D as in Radiant XY view. That is, the Radiant standard 2D is in my image the surface that recedes (goes farther away from the beholder).

The most important thing to remember with rotate command is that it doesn't actually rotate anything from its current position, but rather it sets the absolute facing direction every time you set a new value. It is equivalent to setting angles in Radiant entity properties.
 vas_zag
02-10-2004, 5:53 PM
#5
erm heres a question
how do i use that code to tell the func_static to do such a thing?
sry i have never used icarus ever :(
 lassev
02-10-2004, 6:11 PM
#6
Well, first of all you must make the func_static. You will make that by first making the door itself (but don't yet turn it into a func_static, you'll that a little later). After that's finished, you must place there an origin brush (that's a piece of brush wholly textured with system/origin, and ugly orange shader-texture). The origin can be a piece of brush of any size; it won't even show in game. Just place it so that the exact middle of the origin brush will be the axis of rotation (hinges) of your door. Then select the actual door brush(es) and the origin brush. When they are all selected, turn them into a func_static.

Bring up entity properties for the func_static and enter:

script_targetname
rotadoor1

or whatever you want to call it ("func_static_name" in the script example above)... I don't remember with 100% certainty, but I think it's useless to enter a soundset, since those won't play while rotating. So, you must deal with the sound some other way.

Then place a target_scriptrunner somewhere near the door. Bring up the entity properties, enter:

count
-1

usescript
mymapname/myscriptname

Count -1 allows the script to be launched more than once. Mymapname is the name of your map. In your scripts folder you must create such a folder, and inside that you must create then the script .ibi file myscriptname. Don't add .ibi to the end of the usescript key value, though.

Then you must place a trigger in front of the door (if you want it to be automatic) or a button or something, and target it to the target_scriptrunner. You should also give the trigger some wait value so that the script can be launched only once per some sensible time. You can also give a wait value for the target_scriptrunner, if you want (I normally give 'em both, because I like to think it will spare some processor time :) ).
 vas_zag
02-10-2004, 6:43 PM
#7
ty thats extremely helpful
cept one thing how do i make a .ibi file?
i would of thought it would just be edited in notepad or something but when i open it in notepad it comes up with stuff like
IBI ГхИ?     \B    `A    ґB    Ђ;E    @њE    `A        Ђ;E  
  \B    `A    ґB    Ђ;E    @њE    `A        Ђ;E 

which is nice :confused:
 lassev
02-10-2004, 7:10 PM
#8
Right. The script Wade gave above is a script source. However, the game doesn't use script sources. You must make the script in BehavEd, which is the script editor. It's included in the editing tools. In BehavEd you first make the script like Wade described, then you hit the compile button (you'll find it easily enouh in the program. That will produce you the .ibi in the same place, where you saved the script (when you save the script, it'll be a text file). The .ibi file you must include with your level.
 Mercenary
02-10-2004, 8:41 PM
#9
Kengo has a tutorial for setting up BehavED and some basic scripting tutorials to help you get started.

http://www.geocities.com/kengomaps/tutorials.html)
 vas_zag
02-11-2004, 7:35 PM
#10
thanks very helpful
im just having trouble getting hold of the sdk (56k)
:mad:
 vas_zag
02-11-2004, 10:23 PM
#11
ok i made the ibi file following the stuff wade said as closly as i could, this is the txt file i got tell me if this is done right please :)

//Generated by BehavEd

rem ( "comment" );

affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{
}

rotate ( < 0.000 0.000 45.000 >, 2000.000 );
wait ( 198000.000 );

affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{
}

rotate ( < 0.000 0.000 0.000 >, 2000.000 );
 WadeV1589
02-11-2004, 10:58 PM
#12
//Generated by BehavEd
rem ( "comment" );

affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{

rotate ( < 0.000 0.000 45.000 >, 2000.000 );

wait ( 198000.000 );

rotate ( < 0.000 0.000 0.000 >, 2000.000 );
}


Just to be sure you do realise that's 198 seconds right?
 [ASJN] Balboa
02-12-2004, 12:22 AM
#13
thanks a bunch, these doors will look nice on the castle's chapel
 vas_zag
02-12-2004, 10:03 AM
#14
yeah thanks wade you see im making a turntable arm for a dj booth thingy move onto a record
then it plays a song and when the song is done it moves back
 vas_zag
02-12-2004, 5:22 PM
#15
bah guys its not working :(
ok what i got is....:
a finc_static that includes the origin covered brush for where i want it to rotate
the key/values for it are the following:
script_targetname / turntablearm1

ok also i got a trigger_multiple with these keys/values:

target / turntable1
wait / 203
spawnflags / 4 (use_button)

ok what else?
o yeah the target_scriptrunner which has these key/values...
spawnflags / 128 (inactive)
targetname / turntable1
count / -1
origin / 1600 -266 -595
usescript / vas_party/turntablearm
wait / 198
delay / 0

ok thats everything related in the map ill do the script now..
ok i put it in a .pk3 in the path scripts/vas_party/turntablearm.ibi
//Generated by BehavEd


affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{
}

rotate ( < 0.000 0.000 45.000 >, 2000.000 );
wait ( 198000.000 );

affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{
}

rotate ( < 0.000 0.000 0.000 >, 2000.000 );


i think thats everything hopefully thats all the infomation you need to tell me where ive gone wrong...
ty in advance:)
 WadeV1589
02-12-2004, 7:07 PM
#16
Let's just compare our scripts again shall we?

Yours:
//Generated by BehavEd


affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{
}

rotate ( < 0.000 0.000 45.000 >, 2000.000 );
wait ( 198000.000 );

affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{
}

rotate ( < 0.000 0.000 0.000 >, 2000.000 );

Mine:
//Generated by BehavEd
rem ( "comment" );

affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{

rotate ( < 0.000 0.000 45.000 >, 2000.000 );

wait ( 198000.000 );

rotate ( < 0.000 0.000 0.000 >, 2000.000 );
}

You'll see, apart from the fact mine is simplified, that there is one thing that is quite important:
The location of the brackets - { and }

For the code to work, the rotate function must be inside the brackets that come after the affect line, you have
affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{
}
Which is basically saying "Whatever is in the following brackets, run the commands on turntablearm1"...but then your brackets are empty!

You don't need to use behaveed here, I've created the correct code for you. Just paste it into your text file then compile using ibize.exe into the IBI file.

But take note of the way brackets work!
 lassev
02-12-2004, 7:37 PM
#17
Why is your target_scriptrunner inactive? That is not normally necessary. Basically the only time you want to inactive a scriptrunner is when you want to prevent the script from being run, or stop a script already running (as long as it's not affecting). If you inactivate it, you need a target_activate to target it first to be able to run the script in game.

Yeah, but I only got here to correct my previous statement that soundset wouldn't work while rotating. Maybe you had already noticed that information false. It seems to work alright, now that I tested it. I guess I had my mini-hifi system turned off the first time...

What comes to the scripts - many people find the Raven ICARUS manual pretty boring or even intimidating, but things like the error in your script are explained there quite nicely.
 Mercenary
02-12-2004, 8:28 PM
#18
Why do you have wait:198 in your target_scriptrunner?
 shukrallah
02-13-2004, 2:12 AM
#19
[ASJN] Balboa? Remember me, from the Defenders of the Force where I was an admin? :)

Here's a little picture to remind of the angles (as they are sometimes hard to remember, even for me, and I have rotated God knows how many items over time):

http://www.student.oulu.fi/~lvaarisk/angles.jpg)

Yeah, i know!!!! Its annoying :D Anyways... thanks for the pic. Ill be sure to check that when im scripting stuff. :whtsmile:
 vas_zag
02-13-2004, 11:35 AM
#20
ok thanks yay it works!
i made the script runner active i dont really know y i had it inactive
i made it wait 198 because the tuntable arm has to move onto a func_rotate which is a record
the trigger also links to a target_speaker that plays a song that happens to last 198 seconds.....
 [ASJN] Balboa
02-13-2004, 6:22 PM
#21
hmm you said to make a scripts folder, yet one already existed, so i put castle (which i named the script for the doors) in there, and it said ingame cannot open castle9/castle . any reasons for this? do i not use that script folder?
 lassev
02-13-2004, 9:17 PM
#22
Originally posted by [ASJN] Balboa
hmm you said to make a scripts folder, yet one already existed, so i put castle (which i named the script for the doors) in there, and it said ingame cannot open castle9/castle . any reasons for this? do i not use that script folder?

You indeed have the scripts root folder. Basically you could put your scripts right into that folder, but that would be inconsiderate and bad behavior, so that is why I said you should create a subfolder named after your map into the scripts folder. So, in the end you would have scripts/castle9. Scripts is the scripts root folder that already exists, and castle9 is obviously the name of your map. In your post the game searches for a script called "castle" located in scripts/castle9/.

Check that you have an .ibi file (compiled script of that name) in your castle9 subfolder. If it is there, the game should find it.
 [ASJN] Balboa
02-13-2004, 10:26 PM
#23
well it would save as a txt file, so i thought, why don't i rename it .ibi? well that gave the same results and after scratching my head, i thought of something. a crucial step i must have missed: compiling! yeah, today is literally my first time for behavED and so i don't yet understand how it operates, but at least i know i should compile the script. thanks, i'll tell you if it works

hmm.... for some reason it still wont work. i'm missing something but i don't know what
 shukrallah
02-14-2004, 1:58 AM
#24
Post the script :) just highlight everything in behaved and hit ctrl + c, then load up the post comment window, and hit ctrl+v to paste it ;)
 vas_zag
02-14-2004, 9:58 AM
#25
what i did in the end was copy wades cript, paste it into the .txt behaveED makes and then i opened that using behaveED, then i just coompiled and that worked perfectly
 WadeV1589
02-14-2004, 11:01 AM
#26
BehaveEd, marvellous tool...but it doesn't beat notepad :p

There's a simple fact about computers, if you have a choice between notepad and a front-end program, notepad will be the better choice! Just takes more learning!
 [ASJN] Balboa
02-14-2004, 3:42 PM
#27
//Generated by BehavEd

rem ( "comment" );

affect ( "rotadoor1", /*@AFFECT_TYPE*/ FLUSH )
{
}

rotate ( < 0.000 0.000 90.000 >, 2000.000 );
wait ( 3000.000 );

affect ( "rotadoor1", /*@AFFECT_TYPE*/ FLUSH )
{
rotate ( < 0.000 0.000 0.000 >, 2000.000 );
}

ok this is the txt file in my scripts/castle9/ area. this is called castle. my target script runner points to this but ingame first it wont work, then by restarting the map, it then says cannot open castle9/castle now in behavED it says when saving that its an icarus file but in reality its a txt. when compiling it, it saves it as an icarus file right under the txt. but it still seems to not work anything i'm doing wrong?
 WadeV1589
02-14-2004, 5:10 PM
#28
I'll quote myself...from this very thread!
Originally posted by WadeV1589
Let's just compare our scripts again shall we?

Yours:
//Generated by BehavEd


affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{
}

rotate ( < 0.000 0.000 45.000 >, 2000.000 );
wait ( 198000.000 );

affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{
}

rotate ( < 0.000 0.000 0.000 >, 2000.000 );

Mine:
//Generated by BehavEd
rem ( "comment" );

affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{

rotate ( < 0.000 0.000 45.000 >, 2000.000 );

wait ( 198000.000 );

rotate ( < 0.000 0.000 0.000 >, 2000.000 );
}

You'll see, apart from the fact mine is simplified, that there is one thing that is quite important:
The location of the brackets - { and }

For the code to work, the rotate function must be inside the brackets that come after the affect line, you have
affect ( "turntablearm1", /*@AFFECT_TYPE*/ FLUSH )
{
}
Which is basically saying "Whatever is in the following brackets, run the commands on turntablearm1"...but then your brackets are empty!

You don't need to use behaveed here, I've created the correct code for you. Just paste it into your text file then compile using ibize.exe into the IBI file.

But take note of the way brackets work!
 [ASJN] Balboa
02-14-2004, 6:44 PM
#29
how do i use this IBIze.exe? when i click it it pops up a command window then that window disappears as fast as it came
 WadeV1589
02-14-2004, 7:00 PM
#30
Just drag and drop a plain text file onto it (containing icarus script) and it'll compile it into an ibi file.
 [ASJN] Balboa
02-14-2004, 9:11 PM
#31
ok two things. like before, when i played the map, restarting would make it say cannot open scripts castle9/castle, and not restarting wouldn't do anything... now it still says can't find if i restart but if i don't, the game crashes! i think its working now since it crashes, but i don't understand why it would crash. playing the sp level with the same doors doesn't crash...
 vas_zag
02-18-2004, 9:59 AM
#32
did you put the script in the right place?
 *Dark
02-18-2004, 10:45 AM
#33
could you use a script to rotate a func_static with buttons. erm, so you press one button and the func_static will rotate round a bit, you press the button agn, and it will rotate a bit more, press another button and it will rotate the opposite way.
Basically, if you dont put a return rotating command into the script and then the script is run again, will the new position be 0,0,0 or will the origional position remain 0,0,0

if ya want to know why i want to know, i am making an ion cannon that you can direct the fire of
 WadeV1589
02-18-2004, 2:11 PM
#34
You can script rotation easily. You can rotate from whatever the current position is to an angle of your choice too...what you can't do (that I can find) is get the current angle and do any basic arithmetic like add 5 degrees or take 15 degrees away.
 lassev
02-18-2004, 4:04 PM
#35
Originally posted by WadeV1589
You can script rotation easily. You can rotate from whatever the current position is to an angle of your choice too...what you can't do (that I can find) is get the current angle and do any basic arithmetic like add 5 degrees or take 15 degrees away.

Can't you use declared variables? I have no idea, and I have certainly never tried it, but the thought just came into my mind...

Since you can do basic sums with variables, and if you just could use them in the rotate command (this is the question mark), you could in theory make a button that launched a script that decreases, say 5 degrees of the variable's value, and then rotates the func_static using the variable (now 5 degrees less than previously).

If this doesn't work, you might just do it indirectly by dividing the allowed shooting sector to, say, ten pieces, and nominating for the variable value "1": ten degrees (absolute value), "2": 15 degrees, "3": 20 degrees, and so forth. Then, if the player uses the button, the script decreases (or increases) one to the reference variable value. Then it would launch another script that would check the variable (with a lengty list of if statements), and rotate the func_static with a fixed value inside the particular if that matches the reference variable value.

So, *Dark, why don't you go forward and try either way, and then tell us how it works... ;)
 WadeV1589
02-18-2004, 5:20 PM
#36
But in Icarus variables are set and got using the same methods as an entity and so abide by the same annoying fact they cannot be added, I have never seen an Icarus script that does any basic arithmetic either...however I could be wrong but it requires someone to post how to actually do it for me to believe otherwise.
 *Dark
02-18-2004, 5:53 PM
#37
the code looks simmilar to java and that lot
maybe you could just have the variable as Yrotation then you have the following

yrotation = yrotation + 5

btw, what do i need for the script editing? i have never tried to do any scripting before
 WadeV1589
02-18-2004, 6:44 PM
#38
Icarus doesn't use basic variables like that, you have to:
set("variableName",FLOAT) = 1
Or something..I've forgot now! lol but either way that method failed for me.
 lassev
02-18-2004, 7:37 PM
#39
Originally posted by WadeV1589
But in Icarus variables are set and got using the same methods as an entity and so abide by the same annoying fact they cannot be added, I have never seen an Icarus script that does any basic arithmetic either...however I could be wrong but it requires someone to post how to actually do it for me to believe otherwise.

"Mess with a viper and you'll get the fangs," as the former pirate said...


set ( "kolmonen", "+1" );

if ( $get( FLOAT, "kolmonen") > 4$ )
{
set ( "kolmonen", "0" );
}


Here's a piece of code for you. It will increase the variable "kolmonen" (which means number three in Finnish), until it increases to be more than 4. When that happens, it will reset it to zero.

If you play through my Project Lighthouse (assuming you own JO), you'll also see the script in action, almost in the end in the Array Chamber puzzle.
 lassev
02-18-2004, 7:41 PM
#40
Originally posted by *Dark
btw, what do i need for the script editing? i have never tried to do any scripting before

Well, as long as this thread is, you need only to read it through to get the answer for your question :)
 Mercenary
02-18-2004, 9:31 PM
#41
To anyone learning Icarus, using variables will give you so much more power and possibilities, learn how to use them.
 vas_zag
02-18-2004, 9:31 PM
#42
yeah dark read it through its helped me out loads and i was a total scripting newbie
 shukrallah
02-18-2004, 9:58 PM
#43
could you use a script to rotate a func_static with buttons. erm, so you press one button and the func_static will rotate round a bit, you press the button agn, and it will rotate a bit more, press another button and it will rotate the opposite way.

Youll need different scripts. (ive never tried it with an ion cannon... i have done it with md3s and static brushes) Make the ion cannon (what are you using, and MD3? Or the one premade by Raven for use in the SP game, its called a misc_ion_cannon)

anyways, if its an MD3, make a misc_model_breakable, or possibly, a misc_model_static (im not sure if that will work!) And if your ion cannon is made out of brushs, make it a func_static, or just right click in the 2D Display, and click msic, then misc_ion_cannon. After that, press N, then for the key: targetname then for the value: (Whatever_you_want_here) think of this as its name. For the example, ill use ion1.

So it should look like this:

key: targetname
value: ion1

now then. make a script like this:

//(BHVD)
rem ( "makes ion cannon turn" );

affect ( "ion1", /*@AFFECT_TYPE*/ FLUSH )
{

task ( "turns_cannon" )
{
rotate ( < 0.000 90.000 0.000 >, 1000.000 );
}

do ( "turns_cannon" );
}



Ok, the affect command tells the script what to affect put the targetname there... see how i used ion1 in the script above?

Next, you have to tell "ion1" to do a task. The task can be anything. I could have put "Jump_off_a_Bridge" for the task, and it wont have any affect on the script. Now, for the Rotate command, i might have the number in the wrong place. One set of numbers moves it up and down (you can use negatives, like -90 etc) one makes it left and right, and another turns it sideways. Put the number of degrees you want it to turn. Now you have to tell the script to actually "do" what you told it to do... see the do command? Put whatever you typed for the task under the do. Youll need to make multiple scripts, to turn it back and forth. Just put the trigger_multiple on the switch, and connect them to different target_scriptrunners, which run different scripts. oh and one more thing, you see the 1000 in the script, under rotate? Thats the time is takes for it to rotate. 1000=1 second, 2000=2 seconds... etc...etc.

-luke
 lassev
02-19-2004, 6:36 AM
#44
I don't think your method works, not at least with some more work or explanations, lukeskywalker1. He wanted a method to rotate the ion cannon so that it would give the impression of somewhat stepless (free) control over the shooting direction.

Right now you have a fixed 90 degrees script. And what did you mean with different scriptrunners? How does the game decide which one to use, which not, ir they are all launched with the same trigger_multiple? Or do you deactivate and later reactivate the other scriptrunners, one by one, so that only one of them is activate at a time?

Yeah, and you accidentally tried to affect an ordinary targetname...
 *Dark
02-19-2004, 7:03 AM
#45
Yes i do want there to seem like you have free control over the cannon, but this cannon is made out of brushes. the only problem with that is the fact that the 'shot' effect the the position entity have to be part of the func_static, i have not tried to do this yet, but there maybe be a problem there. would it be possable to make the script als edit the position of an entity?
 [ASJN] Balboa
02-21-2004, 6:48 PM
#46
hey cool i got the doors to work! i think what had happened was when putting in the numbers for the door to turn for x y z, i had messed up the zeros and that made it crash. but i got it to work now! cheers to wade and everyone else who helped me. nice stargate map btw wade

edit--------------------------------------
oh crap... now i cannot get into the map at all. you see after getting the door to work, i decided to get the other door which was a simple brush at the time to rotate as well. so basically i deleted it, and duplicated the origin and func static brush i had and named it rotadoor2. and i made a duplicate script named castle2 with rotadoor1 changed to 2, and a target scriptrunner that used the castle9/castle2. well now i cannot get into the map, cause it comes up with an error on the menu saying sv_setbrushmodel: NULL. anyone know what this means?
Page: 1 of 1