Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, dr_panther), 724 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Trace / Scan_Events and stuff.. #240154
12/09/08 19:02
12/09/08 19:02
Joined: Nov 2008
Posts: 53
Switzerland (Luzern)
F
flutschi Offline OP
Junior Member
flutschi  Offline OP
Junior Member
F

Joined: Nov 2008
Posts: 53
Switzerland (Luzern)
Hi,

I had a problem here with c_trace and that it doesnt jump to its scan_events function..

i think, it doesnt jump to the scan_event function.. but i dont know why..
in c-script it works perfectly! converted to lite-c.. its not working anymore smirk

code is:


void main()
{
...
on_t = tuer;
...
}

function tuer()
{
var trace_target[3];

vec_set(trace_target,player.x);
vec_rotate(trace_target, player.pan);
vec_add(trace_target, vector(1000,0,0));

c_trace(player.x,trace_target,IGNORE_ME|IGNORE_PASSABLE|USE_BOX);
}

function scan_event()
{
if (event_type == EVENT_SCAN)
{
here is the opendoor code..
}
}


and on the door it hits:

action door_schalter()
{
my.emask |= (ENABLE_SCAN);
my.event = scan_event;
}


My System:
Intel Core 2 Duo CPU P8400 @ 2.26 GHz
4 GB Ram
NVIDIA GeForce 9600M GT
32 Bit Windows Vista
***********************************
Gamestudio Pro 7.50 / WED V6.875
Re: Trace / Scan_Events and stuff.. [Re: flutschi] #240245
12/10/08 08:16
12/10/08 08:16
Joined: Jul 2008
Posts: 23
Turkey
H
Hatean Offline
Newbie
Hatean  Offline
Newbie
H

Joined: Jul 2008
Posts: 23
Turkey
var trace_target[3];
vec_set(trace_target,player.x);
c_trace(player.x,trace_target,IGNORE_ME|IGNORE_PASSABLE|USE_BOX);

The problems are in these lines.
1. You can't use anything but vectors in c_trace. So, make your trace_target a vector.
2. vec_set : vector_set smile So you should set vectors with it.
3. If you want to use EVENT_SCAN or other events, you should use c_scan to scan the area. c_trace only sends a beam.

I looked for these on Manual to be sure. Use trace_target as a VECTOR and use c_scan instead of c_trace. It should work with them...


The Life Game is disgustingly bad but the graphics and reality are extremely cool...
Re: Trace / Scan_Events and stuff.. [Re: Hatean] #240602
12/11/08 17:43
12/11/08 17:43
Joined: Nov 2008
Posts: 53
Switzerland (Luzern)
F
flutschi Offline OP
Junior Member
flutschi  Offline OP
Junior Member
F

Joined: Nov 2008
Posts: 53
Switzerland (Luzern)
Hmm

vec_set works.. vector_set is unknown.. so, this isnt right is it?

i used VECTOR.. i did it this way:

Quote:
function tuer()
{
VECTOR trace_target[3];

vec_set(trace_target,player.x);
vec_rotate(trace_target, player.pan);
vec_add(trace_target, vector(1000,0,0));

c_trace(player.x,trace_target,IGNORE_ME|IGNORE_PASSABLE|USE_BOX);
}


but dont work.. ok, as i read ur post right, it cant work with SCAN_EVENT, right?

can c_trace jump to SCAN_EVENT?


i can't get it to work.. i just want to open a door smirk

Last edited by flutschi; 12/11/08 17:43.

My System:
Intel Core 2 Duo CPU P8400 @ 2.26 GHz
4 GB Ram
NVIDIA GeForce 9600M GT
32 Bit Windows Vista
***********************************
Gamestudio Pro 7.50 / WED V6.875
Re: Trace / Scan_Events and stuff.. [Re: flutschi] #240662
12/11/08 20:02
12/11/08 20:02
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
1. you calculate the trace target wrong:
Code:
vec_set(trace_target,vector(1000,0,0));
vec_rotate(trace_target,player.pan);
vec_add(trace_target,player.pan);


2. using trace the door should react on "EVENT_SONAR"
add the trace flag "ACTIVATE_SONAR" to your c_trace instruction to be able to use it.

Re: Trace / Scan_Events and stuff.. [Re: Xarthor] #240744
12/12/08 09:49
12/12/08 09:49
Joined: Nov 2008
Posts: 53
Switzerland (Luzern)
F
flutschi Offline OP
Junior Member
flutschi  Offline OP
Junior Member
F

Joined: Nov 2008
Posts: 53
Switzerland (Luzern)
Hmmm, now my code looks like this:

Quote:
function sonar_event()
{
spawn_sprite(); <- Thats for testing, if it should jump to sonar_event, it should create a bullethole somewhere smirk
}


in the door on WED included on Behavior -> Action:

Quote:
action door_schalter()
{
my.emask |= EVENT_SONAR;
my.event = sonar_event;
}

Quote:
function tuer()
{
VECTOR trace_target[3];

vec_set(trace_target,vector(1000,0,0));
vec_rotate(trace_target, player.pan);
vec_add(trace_target,player.x);

c_trace(player.x,trace_target,IGNORE_ME|IGNORE_PASSABLE|USE_BOX|ACTIVATE_SONAR);
draw_point3d(target,vector(50,50,255),100,3); <- this is still testing, but shouldnt have any effect on the result.. right?
}

void main()
{
...
on_t = tuer;
...
}



I Tried so much out now, all the replies here on the Forum i tested, but nothing works..
strange smirk


My System:
Intel Core 2 Duo CPU P8400 @ 2.26 GHz
4 GB Ram
NVIDIA GeForce 9600M GT
32 Bit Windows Vista
***********************************
Gamestudio Pro 7.50 / WED V6.875
Re: Trace / Scan_Events and stuff.. [Re: flutschi] #240756
12/12/08 11:13
12/12/08 11:13
Joined: Jul 2008
Posts: 23
Turkey
H
Hatean Offline
Newbie
Hatean  Offline
Newbie
H

Joined: Jul 2008
Posts: 23
Turkey
Code:
VECTOR trace_target[3];

A vector already has got three thing: x,y,z. So you should use it like that:
Code:
VECTOR trace_target;


"vec_set works.. vector_set is unknown.. so, this isnt right is it?" Hey! I meant vec_set is for vectors and vec means vector in here. There isn't any vector_set thing of course laugh

So as I understood you are trying to make a door that is going to open by a schalter, right? Actually I didn't understand your code exactly so I m writing one by myself, look at that and I hope I can help:

Code:
#include <acknex.h>
#define DOOR_OPEN skill20

ENTITY* doorEnt;

action door()
{
    var my_z = my.z;
    doorEnt = me;

    while(1)
    {
        if(my.skill20==1)
        {
            while(my.z<my_z+50) { my.z+=3*time_step; wait(1); }
            if(my.z>my_z+50) my.z = my_z + 50;
            // That line depends on your world cordinates and door
            // Also you can add closing door thing 
        }
        wait(1);
    }
}

function schalterEvent()
{
    if(you==player && event_type==EVENT_SCAN)
    {
        // You can make an animation for schalter here
        doorEnt.DOOR_OPEN = 1;
    }
}

action schalter()
{
    my.emask = ENABLE_SCAN;
    my.event = schalterEvent;
}

action player()
{
    player = me;
    // movement codes etc.
    if(key_space) 
    {
        while(key_space) wait(1);
        c_scan(my.x,my.pan,vector(45,0,300),NULL);
    }
}

I don't have time to try if it works but even if it doesn't, it'll help. Wish it helps...

Last edited by Hatean; 12/12/08 11:14.

The Life Game is disgustingly bad but the graphics and reality are extremely cool...
Re: Trace / Scan_Events and stuff.. [Re: Hatean] #240764
12/12/08 12:20
12/12/08 12:20
Joined: Nov 2008
Posts: 53
Switzerland (Luzern)
F
flutschi Offline OP
Junior Member
flutschi  Offline OP
Junior Member
F

Joined: Nov 2008
Posts: 53
Switzerland (Luzern)
Thank you very much, but isnt c_scan not somekind of not precisly? why u use c_scan for this and not c_trace?

i just thought that c_trace would be more efficiently.. am i wrong?


and in this example, it is always in the ...

Quote:
action door()
{
var my_z = my.z;
doorEnt = me;

while(1)
{
if(my.skill20==1)
{
while(my.z<my_z+50) { my.z+=3*time_step; wait(1); }
if(my.z>my_z+50) my.z = my_z + 50;
// That line depends on your world cordinates and door
// Also you can add closing door thing
}
wait(1);
}

}


.. loop? its always in there? doesnt that means its getting a little bit slower then to just wait till i push a button?
or do i get something wrong?


Thanks anyway, i will test this one out, but if its slower then the other one, i dont go with it smile


My System:
Intel Core 2 Duo CPU P8400 @ 2.26 GHz
4 GB Ram
NVIDIA GeForce 9600M GT
32 Bit Windows Vista
***********************************
Gamestudio Pro 7.50 / WED V6.875
Re: Trace / Scan_Events and stuff.. [Re: flutschi] #240765
12/12/08 12:38
12/12/08 12:38
Joined: Jul 2008
Posts: 23
Turkey
H
Hatean Offline
Newbie
Hatean  Offline
Newbie
H

Joined: Jul 2008
Posts: 23
Turkey
Code:
doorOpen = 1;
while(doorOpen)
{
if(my.skill20==1)
{
doorOpen=0;
while(my.z<my_z+50) { my.z+=3*time_step; wait(1); }
if(my.z>my_z+50) my.z = my_z + 50;
// That line depends on your world cordinates and door
// Also you can add closing door thing
}
wait(1);
}

Sorry for the mistake. This should work a lot faster now...

Edit: I don't see any reason to use c_trace. c_scan can be used without any problem. You should just make c_scan parameters right as you wanted wink

I can write down a code with c_trace but I really don't have enough time. Maybe I can write it this evening. Hope I helped...

Last edited by Hatean; 12/12/08 12:47.

The Life Game is disgustingly bad but the graphics and reality are extremely cool...
Re: Trace / Scan_Events and stuff.. [Re: Hatean] #240766
12/12/08 12:46
12/12/08 12:46
Joined: Nov 2008
Posts: 53
Switzerland (Luzern)
F
flutschi Offline OP
Junior Member
flutschi  Offline OP
Junior Member
F

Joined: Nov 2008
Posts: 53
Switzerland (Luzern)
Thanks!

Still, if u put doorOpen to 1 and then ask if doorOpen is 1.. its still.. strange?

Quote:
doorOpen = 1;
while(doorOpen)

...


The problem i have is really strange, because in C-Script it worked perfectly..

now i have the problem that it doesnt react on the "T" Button.. i want to open the Door with the T Button.. but this:

Quote:
if (key_t)
{
c_scan(my.x,my.pan,vector(45,0,300),NULL);
}


doenst do anything.. i did the c_scan line in a ToggleBreak mode.. but it doenst stop there if i Run it in Debug Mode..

i dont get that..

edith says:

if u dont have time, just do it when u have time smile
i appreciate it very much, even the slithest hint to fullfill my project im glad.. smile

and yes, my english isnt the best, i try to do the best i can laugh speaking is a lot easier :p


Last edited by flutschi; 12/12/08 12:51.

My System:
Intel Core 2 Duo CPU P8400 @ 2.26 GHz
4 GB Ram
NVIDIA GeForce 9600M GT
32 Bit Windows Vista
***********************************
Gamestudio Pro 7.50 / WED V6.875
Re: Trace / Scan_Events and stuff.. [Re: flutschi] #240767
12/12/08 12:49
12/12/08 12:49
Joined: Jul 2008
Posts: 23
Turkey
H
Hatean Offline
Newbie
Hatean  Offline
Newbie
H

Joined: Jul 2008
Posts: 23
Turkey
Code:
if(my.skill20==1)
{
doorOpen=0;
while(my.z<my_z+50) { my.z+=3*time_step; wait(1); }
if(my.z>my_z+50) my.z = my_z + 50;
// That line depends on your world cordinates and door
// Also you can add closing door thing
}

Look at the third line...

As I said, you should give the exactly right parameters to c_scan to see what you wanted to see. I'll try my code in the evening wink

Last edited by Hatean; 12/12/08 12:50.

The Life Game is disgustingly bad but the graphics and reality are extremely cool...
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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