|
|
door up stop, door down,stop that would be nice
#292937
10/07/09 22:18
10/07/09 22:18
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
Hello, Well I have come to a nother problem, what I neew to happen is when player1 gets close to the door1 it needs to move up so much then stop. Then when player1 one gets so far a way the door1 need to come down so much and stop. I am going have to do this;
1. be able to know the dist. from player1 and door1. I should be able to us vec-dist(plyer1.x,door1.x) This may not be wrintten right but I sure to get my point.
2. Stop the door1 when it gets so high. Now I can move the door1 with c-move, but I do not know how to stop the door1 at let say 150.
3. Now that the player1 have moved away from the door1 the nedds to come down to the point where it stated from and stop.
I was thinking there maybe two way of doing this.
1. put the vec_dist(player1.x,door1.x) in the loop some place and have it go to a function that open the door and stop it at the point it needs to be stoped.
2. put the vec_dist(player1.x,door1.x) in the loop some place and have it go to a function that close the door and stop it at the point it needs to be stoped. where it was.
I could do it all in a function act_door1
Well that is my problem maybe some one can point me to the best way of doing this. I don't know how to stop the door1 going up or down. Thank You renny
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: door up stop, door down,stop that would be nice
[Re: PigHunter]
#292995
10/08/09 13:53
10/08/09 13:53
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
Yes, I found that, I am trying to convert it to moving the door up and then down. I may have some working code to put up soon. thank you renny
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: door up stop, door down,stop that would be nice
[Re: sadsack]
#292999
10/08/09 14:43
10/08/09 14:43
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
Ok this is where I am at. I got the door to go up just fine as I get close to it.. here is the code:
function act_door1(){
{
while(!my){wait(1);}
door1 = my;
my.ambient = 10;
while(my)
{
if(vec_dist(player1.x,my.x) <= 400){c_move (my,vector(0,0,.3),nullvector,IGNORE_MODELS);}
wait(1);
}
}
}
I been working on this for two days now. I need to stop the door so it does not keep going up. I tryed all kinds of things like
if(my.z >40.z){c_move (my,vector(0,0,0),nullvector,IGNORE_MODELS);}
All kinds of stuff like that, could not get anything to work. What I need is this. I made this var door = 0 What I want to do is have so if the var =0 then the door is close, if the var is 1 then the door id open. That way I can say if the var =0 than door is close, open door, than I will make the var =1 else if the var=0 door is close do nothing.or if the var =1 than close door,make the var=0 Now that should work, but as far making the code to do that, I am having a vary hard time with it. any help would be nice. thank you renny I can get the var to compile.
Last edited by sadsack; 10/08/09 20:59.
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: door up stop, door down,stop that would be nice
[Re: sadsack]
#293049
10/08/09 21:01
10/08/09 21:01
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
Oh yes, I need a way to stop the at a level up and down. renny
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: door up stop, door down,stop that would be nice
[Re: sadsack]
#293054
10/08/09 23:14
10/08/09 23:14
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! while(!my){wait(1);} door1 = my;
should be door1 = my; while (!door1) {wait(1);} and this should be out of the loop. But if your not using the name door1 why do this step? Do you know the distance that the door travels? (when the door as reached it destination var=1 and the while stops )
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Re: door up stop, door down,stop that would be nice
[Re: Ottawa]
#293062
10/09/09 02:14
10/09/09 02:14
|
Joined: Mar 2009
Posts: 146 USA
paracharlie
Member
|
Member
Joined: Mar 2009
Posts: 146
USA
|
Have you tried clamp?
var door_up;
door_up = clamp(door_up, 0, 50);
Then put the door_up variable in your c_move on the z. The sole purpose of clamp is to restrict something.
Last edited by paracharlie; 10/09/09 02:16.
A8 Commercial
|
|
|
Re: door up stop, door down,stop that would be nice
[Re: paracharlie]
#293125
10/09/09 13:25
10/09/09 13:25
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
I never heard of clamp, I will have to look that up thanks paracharlie. Thank you to Ottawa I will try that. renny
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: door up stop, door down,stop that would be nice
[Re: sadsack]
#293219
10/09/09 23:29
10/09/09 23:29
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
Hi, I think this is how you wanted me to use clamp Here the code:
function act_door1(){
{
var door1_up;
door1_up = clamp(door1_up,0,200);
door1 = my;
while(!my){wait(1);}
my.ambient = 10;
while(my)
{
if(vec_dist(player1.x,my.x) <= 400){c_move (my,vector(0,0,door1_up),nullvector,IGNORE_MODELS);}
wait(1);
}
}
}
Well the door will not move at all now. But I like how you doing the code, that is neat that you can put var. in the c-move like that. I have many uses for that, Thank you. maybe you can see something in the code I did wrong. Thanks renny
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: door up stop, door down,stop that would be nice
[Re: sadsack]
#293248
10/10/09 05:26
10/10/09 05:26
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
You havent told it ow much to move per frame, so it isnt moving. Try this...
function act_door1()
{
while(!my) {wait(1);}
door1 = my;
my.ambient = 10;
while(my)
{
if(vec_dist(player1.x,my.x) <= 400)
{ c_move (my,vector(0,0,.3),nullvector,IGNORE_MODELS); }
my.z = clamp(my.z, 0, 200);;
wait(1);
}
}
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|