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 (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Falling killer light #66091
03/11/06 18:09
03/11/06 18:09
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline OP
User
Trooper119  Offline OP
User

Joined: Apr 2004
Posts: 516
USA
My code is refusing to work so it is simple enough, I just cant get it, it is supposed to read that an object hit it (perferable a bullet but I can just use my character for impact right now for testing purposes) and when it hits the light the light falls and kills anyone below it. Damage code is not inputed, I'm getting a critical error when I try to run the code though.
Code:
 function light_fall
{
if (event_type == event_impact)
{

temp.z -= 4000; //calculate a spot 4000 quats below entity (playing with this value)
trace_mode = ignore_me+ignore_sprites+ignore_models+use_box; //calculate box around player for collision, only detects level geometry and

entities
dist.z = -trace(my.z,temp);
sleep (5); // let me get out of the way
while (dist.z > 0)
{
dist.z = -trace(my.z,temp);
my.z -= 3; // move the light
wait (1);
}
}
}

action light
{
my.push = 20; //push must have higher value on light then object hit to trigger
my.enable_impact = on;
you.push = 15;
my.event = light_fall;
}



EDIT: So how about this then, I still get a crititical error set off my microsoft and I still think it is because of this code, please help.

Last edited by Trooper119; 03/12/06 14:52.
Re: Falling killer light [Re: Trooper119] #66092
03/11/06 23:08
03/11/06 23:08
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline
Serious User
Lion_Ts  Offline
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
you have infinite while() loop - checked dist.z while changing my.z
think about it

Re: Falling killer light [Re: Lion_Ts] #66093
03/13/06 01:11
03/13/06 01:11
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline OP
User
Trooper119  Offline OP
User

Joined: Apr 2004
Posts: 516
USA
This code is deffinately in need of help, I got rid of the code and ran the level and it went fine, so something in the light code is causing the loading of the level to crash, no error, just crash.


A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C
Re: Falling killer light [Re: Trooper119] #66094
03/14/06 11:18
03/14/06 11:18
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline OP
User
Trooper119  Offline OP
User

Joined: Apr 2004
Posts: 516
USA
With lots of help from Gordon he came up with (and I messed with a bit) to get this code but it still doesn't move when I hit it. Help
Code:
 var lightvec[3];

function light_fall_func
{
sleep (5); // let me get out of the way
// this also returns to the event function so it can terminate.
trace_mode = ignore_me+ignore_sprites+ignore_models+use_box;
//calculate box around player for collision,
// only detects level geometry and entities
dist.z = -trace(my.x,lightvec);
while (dist.z > 0)
{
trace_mode = ignore_me+ignore_sprites+ignore_models+use_box;
//can't be sure it is the same after a wait
dist.z = -trace(my.x,lightvec);
my.z -= 100; // move the light
wait (1);
}
}

function light_fall
{
if (event_type == event_impact)
{
you.push = 1;
vec_set(lightvec,my.x);
lightvec.z -= 10000; //calculate a spot 10000 quats below entity
// (playing with this value)
light_fall_func(); // start the real function now
}
}

action light
{
my.push = 5; //push must have higher value on light
// then object hit to trigger
my.enable_impact = on;
my.event = light_fall;
}




A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C
Re: Falling killer light [Re: Trooper119] #66095
03/14/06 23:19
03/14/06 23:19
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline OP
User
Trooper119  Offline OP
User

Joined: Apr 2004
Posts: 516
USA
I'm letting you know I found a lot of stupid mistakes I checked alot of things and everything seems to work until I hit trace, I think that is where I messed up here it is. Code:
 var light_impact = 1;	//makes sure impact only is triggered once
var lightvec[3];
var light_target;

function light_fall_func
{
sleep (1); // let me get out of the way
// this also returns to the event function so it can terminate.
trace_mode = ignore_me+ignore_you+ignore_sprites+ignore_models+ignore_passable+use_box;
//calculate box around light for collision,
// should only detect level geometry
light_target = trace(my.z,lightvec); //I think it detects something besides geometry
if (target < 50)
{
msg_show ("less than 50", 5); //testing purposes
}
while (my.z > target) //when there is still distance between the target
{
msg_show ("Now I'm in the trace loop", 5); //testing purposes
trace_mode = ignore_me+ignore_you+ignore_sprites+ignore_models+ignore_passable+use_box;
//can't be sure it is the same after a wait
my.z -= 1; // move the light
wait (1);
}
}

function light_fall
{
if (light_impact == 1)
{
light_impact = 0; //stop trigger, only happens once
wait(1); //let everything settle for a frame
you.push = 0; //value is already at 0, put in for good measure
vec_set(lightvec,my.z);
lightvec.z -= 100; //calculate a spot 100 quats below entity
// (playing with this value)
light_fall_func(); // start the real function now
}
}

action light
{
my.push = 1; //push must have higher value on light
// then object hit to trigger
my.enable_impact = on;
my.event = light_fall;
}



Last edited by Trooper119; 03/15/06 03:38.

A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C
Re: Falling killer light [Re: Trooper119] #66096
03/16/06 21:31
03/16/06 21:31
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline OP
User
Trooper119  Offline OP
User

Joined: Apr 2004
Posts: 516
USA
I got fed up with trace and overwrote the hole thing just for me to hand put in the amount it needs to fall, I'm tired of messing with this thing. Hopefully if anyone is looking for a similar work they can try this code out. Code:
  var light_impact = 1;	//makes sure impact only is triggered once
var lightvec[3];

function light_fall_func
{
sleep (1); // let me get out of the way
// this also returns to the event function so it can terminate.
while ( my.z > lightvec.z ) //when there is still distance between the target
{
my.z -= 2; // move the light
if (your.z <= my.z) //if impact is above the light then don't kill
{
your._health = 0; //kill anyone the light falls on
}
wait (1);
}
}

function light_fall
{
if (light_impact == 1) //make sure the light is only triggered once
{
light_impact = 0; //stop trigger, only happens once
wait(1); //let everything settle for a frame
you.push = 0; //value is already at 0, put in for good measure
vec_set(lightvec,my.z);
lightvec.z -= 75; //calculate a spot 75 quats below entity
// (playing with this value)
light_fall_func(); // start the real function now
}
}

action light
{
my.push = 1; //push must have higher value on light
// then object hit to trigger
my.enable_impact = on;
my.event = light_fall;
}




A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free 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