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
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 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
Page 1 of 2 1 2
what the hecks wrong here? #138296
06/26/07 20:09
06/26/07 20:09
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
this is weird, useing code from one of the aum tuts which works ok in one project but not in another, i`m stumped. please please tell me were the heck is this wrong? the torp just goes straight through the dummy target.
Code:

string redflare_pcx = "redflare.pcx";

sound torp_wav = <torp.wav>;

function move_torp1();
function remove_torp1();

function f_torp1
{
vec_for_vertex (temp, player, 3088) ;
ent_create (redflare_pcx, temp, move_torp1);
snd_play (torp_wav, 50, 0);
}

function move_torp1
{
var bullet_speed; // this var will store the speed of the bullet
var trace_coords;
my.enable_entity = on;
my.enable_block = on;
my.enable_impact = on;
my.polygon = on;
my.visible = on;
my.transparent = on;
my.bright = on;
my.passable = off;
my.scale_x = 0.5;//scale it down to have it's size
my.scale_y = my.scale_x;//same as scale x
my.scale_z = my.scale_x;//same as scale x
my.event = remove_torp1; // when it collides with something, its event function (remove_bullets) will run
vec_set(my.pan, player.pan);
bullet_speed.x = 40 * time; // adjust the speed of the bullet here
bullet_speed.y = 0; // the bullet doesn't move sideways
bullet_speed.z = 0; // then don't allow the gravity to have its ways with the bullet
while (my != null) // this loop will run for as long as the bullet exists (it isn't "null")
{
// move the bullet ignoring the passable entities and store the result in distance_covered
c_move (my, bullet_speed, nullvector, ignore_passable);
wait (1);
}
}

function remove_torp1() // this function runs when the bullet collides with something
{
wait (1);
my.passable = on;
my.visible = off;
sleep (2);
ent_remove (my);
}


this works ok in the tut i did, but now it won`t? here is the dummy function
Code:

function f_ship
{

wait(1);
my.scale_x = 3.0;
my.scale_y = my.scale_x;
my.scale_z = my.scale_x;
my.enable_impact = on;
my.enable_entity = on;
my.polygon = on;
my.enable_scan = on;
my.enable_detect = on;
my.passable = off;
my.event = got_shot;

}

function got_shot()
{
my.event = destroy_me;
wait(1);
}




Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: what the hecks wrong here? [Re: jigalypuff] #138297
06/26/07 21:02
06/26/07 21:02
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Add this after each my.scale_x/y/z block:
wait(1);
c_updatehull(my,my.frame);
wait(2);

Re: what the hecks wrong here? [Re: Xarthor] #138298
06/27/07 16:10
06/27/07 16:10
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
if you mean like this the nit did`nt work, have i done it wrong?
Code:

my.scale_x = 0.5, ;//scale it down to have it's size
wait(1);
c_updatehull(my,my.frame);
wait(2);
my.scale_y = my.scale_x;//same as scale x
wait(1);
c_updatehull(my,my.frame);
wait(2);
my.scale_z = my.scale_x;//same as scale x
wait(1);
c_updatehull(my,my.frame);
wait(2);




Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: what the hecks wrong here? [Re: jigalypuff] #138299
06/27/07 17:12
06/27/07 17:12
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
No I meant it this way:
Code:

my.scale_x = bla
my.scale_y = bla
my.scale_z = bla
wait(1);
c_updatehull(my,my.frame);
wait(2);



However it makes no difference.
But: Did you also do this change to the bullet's function?

EDIT:
argh I guess I know whats wrong.
You set the my.polygon flag for the torpedo to ON.
Here it comes:
NEVER ever use the polygon flag for dynamic (moving) entities. It may mess up your collision detection!

EDIT:
further more, your torpedo only adjusts its speed to the framerate once and not every frame.
write:
bullet_speed.z = 40;
while(my!=null)
{
c_move(my, bullet_speed*time_step, nullvector, ignore_passable);
wait(1);
}

Last edited by Xarthor; 06/27/07 17:17.
Re: what the hecks wrong here? [Re: Xarthor] #138300
06/27/07 17:59
06/27/07 17:59
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
that *time_step gives a crash in the c_move instruction, when it`s not there the torp fires but passes through the target if it`s in i get the crash, what i don`t understand is why the function works in one project but not this one, i copied and pasted the code, should it not work?


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: what the hecks wrong here? [Re: jigalypuff] #138301
06/27/07 19:03
06/27/07 19:03
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
oh yeah, it probably crashes because bullet_speed is a vector, sry.
Then just write this line into your while loop:
bullet_speed.z = 40 * time_step;

Did you remove that polygon flag instruction?

Re: what the hecks wrong here? [Re: Xarthor] #138302
06/27/07 19:25
06/27/07 19:25
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
ya i removed the polygon flag, still not working, i just tried turning my.passable = off in the remove_torp1 function, the torp gets stuck to the ship, is it possible that for some reason the my.passable = on in that function is activateing to early?


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: what the hecks wrong here? [Re: jigalypuff] #138303
06/27/07 19:38
06/27/07 19:38
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Maybe not to early but the torpedo just keeps flying after it has hit a target (passable = on and my != null)
So why not change the argument in the while loop to:
my.skill1 = 1;
while(my.skill1)
{
...
}
wait(1);
ent_remove(me);

And then in the event function, nothing more than:
my.skill1 = 0;

Re: what the hecks wrong here? [Re: Xarthor] #138304
06/27/07 20:21
06/27/07 20:21
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
i`m getting empty pointer in move torp, here is what i did, and thanks for all this help
Code:

function move_torp1
{
var bullet_speed; // this var will store the speed of the bullet
var trace_coords;
my.skill1 = 1;
my.enable_entity = on;
my.enable_block = on;
my.enable_impact = on;
my.visible = on;
my.transparent = on;
my.bright = on;
my.passable = off;
my.scale_x = 0.5;//scale it down to have it's size
my.scale_y = my.scale_x;//same as scale x
my.scale_z = my.scale_x;//same as scale x
my.event = remove_torp1; // when it collides with something, its event function (remove_bullets) will run
vec_set(my.pan, player.pan);
bullet_speed.x = 40 * time_step; // adjust the speed of the bullet here
bullet_speed.y = 0; // the bullet doesn't move sideways
bullet_speed.z = 0; // then don't allow the gravity to have its ways with the bullet
while (my.skill1);
// this loop will run for as long as the bullet exists (it isn't "null")
{
// move the bullet ignoring the passable entities and store the result in distance_covered
c_move (my, bullet_speed, nullvector, ignore_passable);
wait (1);
ent_remove(me);
}
}

function remove_torp1() // this function runs when the bullet collides with something
{
my.skill1 = 0;

}




Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: what the hecks wrong here? [Re: jigalypuff] #138305
06/27/07 22:05
06/27/07 22:05
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
You have misassigned Xarthor's code a litte bit: The ent_remove should not be within the while loop, but right after it!

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