Jump to content

Home

Opening doors in the right way


[ASJN] Balboa

Recommended Posts

//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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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, {NJO}*Dark, why don't you go forward and try either way, and then tell us how it works... ;)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...