Need help with rotating script.
Moderator: Core Staff
Need help with rotating script.
Hi, im making a new map (secret to me, Golden and levi atm) but i need help on a rotating air vent door.
It will start off vertical, and when pressed i would like it to rotate about 170 degrees on its (invisible) hinges, downwards to the ground so it is 10 degrees up if you understand.
if anyone could make me a script for this id be chuffed!
Thanks.
It will start off vertical, and when pressed i would like it to rotate about 170 degrees on its (invisible) hinges, downwards to the ground so it is 10 degrees up if you understand.
if anyone could make me a script for this id be chuffed!
Thanks.
JDogg: 'I have a video of me pissing, wanna see?'
Well you can do it much like a door script and edit the values as needed:
Code: Select all
main()
{
thread vent();
}
vent()
{
vent = getent ("vent","targetname");
vent_trig = getent ("vent_trig","targetname");
while (1)
{
vent_trig waittill ("trigger");
vent rotateto ((0, 170,0), 1); //this will rotate 170 degrees on the y axis in 1 second
}
}
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php
If you've not got any scripting in your map yet, then you can just paste this into notepad and save it as yourmapname.gsc, then put it in the same folder as your d3dbsp file(maps/mp).
For the mapping part, create the vent then create a brush where the hinge would be and give that the origin texture. The origin brush is where it will pivot, it will pivot from the very center of this brush. Now select the vent and the origin brush and while both are selected, right click and select script>brushmodel. Now give the brushmodel a targetname, by selecting it and pressing N, then type targetname in the key field, and vent in the value. Hit enter to apply, press N again to close.
Create a trigger_use and give a targetname of vent_trig(assuming you know how to make a trigger). And that's it!
Code: Select all
main()
{
maps\mp\_load::main();
thread vent();
}
vent()
{
vent = getent ("vent","targetname");
vent_trig = getent ("vent_trig","targetname");
while (1)
{
vent_trig waittill ("trigger");
vent rotateto ((0, 170,0), 1); //this will rotate 170 degrees on the y axis in 1 second
}
}
Create a trigger_use and give a targetname of vent_trig(assuming you know how to make a trigger). And that's it!
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php
nope i havent used triggers in my map yet. so what i need is to start with my 'before' vent, give it the details etc and make a hinge for it to pivot around? could this be made out of caulk? and how could i measure how many degrees are in this rotation?
JDogg: 'I have a video of me pissing, wanna see?'
Luke already said, it needs the 'origin' texture (found in common). If it's caulk, it'll block people and mess up your map a bit.jimbojetuk wrote:nope i havent used triggers in my map yet. so what i need is to start with my 'before' vent, give it the details etc and make a hinge for it to pivot around? could this be made out of caulk? and how could i measure how many degrees are in this rotation?
As for the angle it is rotated through, it tells you in the script.
No, as i said thats the mapping done. Unless you want this door to look different after its rotated so all you should be doing is creating it at the position you want it to be rotated from, the script will do the rest.
Triggers: I'll suggest my favourite trigger, the use_touch. When the player touches this trigger, a use icon will appear.
All you need to do is create a brush at the place you want this to happen, while the brush is selected, right click and select trigger>use_touch(the texture will change to the trig texture by its self). Then give it a targetname like you did with the vent door, except this time you name it vent_trig.
Triggers: I'll suggest my favourite trigger, the use_touch. When the player touches this trigger, a use icon will appear.
All you need to do is create a brush at the place you want this to happen, while the brush is selected, right click and select trigger>use_touch(the texture will change to the trig texture by its self). Then give it a targetname like you did with the vent door, except this time you name it vent_trig.
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php
Yes, when they're touching it and press the use key at the same time.
It can be placed anywhere.
It can be placed anywhere.
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php
You could do that, but if you're planning on making several of them, then it would best to use an array, then you can add as many as you want without adding more code.
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php
Who is online
Users browsing this forum: No registered users and 37 guests