Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
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
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
c_trace question #225700
09/05/08 19:28
09/05/08 19:28
Joined: Aug 2006
Posts: 155
R
RyuMaster Offline OP
Member
RyuMaster  Offline OP
Member
R

Joined: Aug 2006
Posts: 155
Hi! I need some help figuring out how c_trace works. I have robot model, and a box on my scene. Currently, this how it works:

Quote:
if (c_trace(my.x,vector(my.x,my.y + 10,my.z),IGNORE_ME | IGNORE_PASSABLE | USE_BOX) > 0)
{
you.y+=10;
}

When robot is near the box, box moves by 10. But, it happens, no matter is robot facing the box, or not. How can I check, if robot is facing the box?
Do I have to track it additionaly, or c_trace can handle this?


What kills me not, that makes me stronger.

***Working on RPG/RTS***
Re: c_trace question [Re: RyuMaster] #225717
09/05/08 20:39
09/05/08 20:39
Joined: Jun 2008
Posts: 428
Rasch Offline
Senior Member
Rasch  Offline
Senior Member

Joined: Jun 2008
Posts: 428
at the moment you trace belong the Y-Axis it doesnīt care where your robot is facing it traces from his position belong the Y-Axis.

Take this code from me smile i can explain if you want smile

first define a variable outside the action and then take this in a while loop smile

Code:

var trace_coords;

                vec_set(trace_coords.x, vector(10000, 0, 0); 

		vec_rotate(trace_coords.x, my.pan);

		vec_add(trace_coords.x, my.x);

			
			c_trace(my.x, trace_coords.x, IGNORE_ME | IGNORE_PASSABLE);

			if (!you) // hit a wall?
			{

				wait(1);

			}
			else
			{
				you..y += 10;
			}


Re: c_trace question [Re: RyuMaster] #225743
09/05/08 21:57
09/05/08 21:57
Joined: Aug 2006
Posts: 155
R
RyuMaster Offline OP
Member
RyuMaster  Offline OP
Member
R

Joined: Aug 2006
Posts: 155
Yai, thanks! I'll see if it works for me, but currently I can not get is started. Is this Lite-C?
I get this error:

Quote:
x is not member of the function

because of this line "trace_coords.x"

Then I trying to change "var trace_coords " to "VECTOR trace_coords". I thought maybe "x" is not found because of bad variable type. But now I get syntax error at the same code line. Any ideas what might be wrong?


What kills me not, that makes me stronger.

***Working on RPG/RTS***
Re: c_trace question [Re: RyuMaster] #225744
09/05/08 21:58
09/05/08 21:58
Joined: Jun 2008
Posts: 428
Rasch Offline
Senior Member
Rasch  Offline
Senior Member

Joined: Jun 2008
Posts: 428
this is c-script. try only trace_coords instead of trace_coords.x but use var and not vector

Re: c_trace question [Re: RyuMaster] #225751
09/05/08 22:12
09/05/08 22:12
Joined: Aug 2006
Posts: 155
R
RyuMaster Offline OP
Member
RyuMaster  Offline OP
Member
R

Joined: Aug 2006
Posts: 155
Not working either, probably because I use Lite-C and it has some differences. Anyway, while I have You brilliant part of code smile , I can always stick to manual and try to adapt it to Lite-C. Hopefully I'll get lucky...


What kills me not, that makes me stronger.

***Working on RPG/RTS***
Re: c_trace question [Re: RyuMaster] #225753
09/05/08 22:16
09/05/08 22:16
Joined: Jun 2008
Posts: 428
Rasch Offline
Senior Member
Rasch  Offline
Senior Member

Joined: Jun 2008
Posts: 428
yeah try that ^^ it should work otherwise try this

var trace_coords[3];

if this donīt work i really donīt know cause i donīt want to use lite-c as long as it isnīt needed wink

Re: c_trace question [Re: Rasch] #225768
09/05/08 22:55
09/05/08 22:55
Joined: Aug 2006
Posts: 155
R
RyuMaster Offline OP
Member
RyuMaster  Offline OP
Member
R

Joined: Aug 2006
Posts: 155
Changing vec_set to this soled the problem:

VECTOR trace_coords;
trace_coords.x = 100;
trace_coords.y = 0;
trace_coords.z = 0;

Thanks, it really works! Just I wonder why and how:) Well, I hope I'll get it one day.


What kills me not, that makes me stronger.

***Working on RPG/RTS***
Re: c_trace question [Re: RyuMaster] #225769
09/05/08 22:58
09/05/08 22:58
Joined: Jun 2008
Posts: 428
Rasch Offline
Senior Member
Rasch  Offline
Senior Member

Joined: Jun 2008
Posts: 428
thatīs lite-c ^^


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