Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (Martin_HH, steyr, alibaba), 509 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
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 Offline OP
Senior Member
sadsack  Offline 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: sadsack] #292950
10/08/09 04:35
10/08/09 04:35
Joined: May 2009
Posts: 137
Ohio, U.S.A.
PigHunter Offline
Member
PigHunter  Offline
Member

Joined: May 2009
Posts: 137
Ohio, U.S.A.
AUM 62

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 Offline OP
Senior Member
sadsack  Offline 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 Offline OP
Senior Member
sadsack  Offline 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:
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

Code:
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 Offline OP
Senior Member
sadsack  Offline 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
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

Quote:

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 laugh

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
P
paracharlie Offline
Member
paracharlie  Offline
Member
P

Joined: Mar 2009
Posts: 146
USA
Have you tried clamp?
Code:
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 Offline OP
Senior Member
sadsack  Offline 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 Offline OP
Senior Member
sadsack  Offline 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:

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 Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
You havent told it ow much to move per frame, so it isnt moving.
Try this...
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);   }
		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
Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1