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 2 of 2 1 2
Re: what the hecks wrong here? [Re: Fenriswolf] #138306
06/28/07 11:07
06/28/07 11:07
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
if the ent_remove is commented out the torp gets stuck in me, if it`s not commented out it seems to be removed as sson as it`s created as i hear the torp_wav but see no torp.
thanks again for your patience guys


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

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
As Fenriswolf just said.
The ent_remove has to be put after the closing bracket of the while loop.
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
wait(1);
c_updatehull(my,my.frame);
wait(2);
my.event = remove_torp1; // when it collides with something, its event function (remove_bullets) will run
vec_set(my.pan, player.pan);
vec_set(bullet_speed,nullvector);
while (my.skill1)
// this loop will run for as long as the bullet exists (it isn't "null")
{
bullet_speed.x = 40 * time_step;
// move the bullet ignoring the passable entities and store the result in distance_covered
c_move (my, bullet_speed, nullvector, ignore_passable);
wait (1);
}

wait(1);
ent_remove(me);
}

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



edit:
Added some stuff and correct some things, like the ; after the while(..)

Last edited by Xarthor; 06/28/07 12:14.
Re: what the hecks wrong here? [Re: Xarthor] #138308
06/28/07 12:18
06/28/07 12:18
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
ya thats what i did, however i never had that wait(1) before the ent_remove, the torp now appears for a second, does not move and then disapears. also if i have this ; in the while (my.skill1); i get error missing } but if it`s not there i get no errors, i`m damned if i can see were there is a bracket missing.


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

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
There is no bracket missing in the snippet I posted.
And there should not be any semicolon after the while(my.skill1) at all.
That will give you an error too, after you found that missing bracket.

Update to the remove_torp1 function:
Code:

function remove_torp1()
{
if(event_type == event_entity || event_type == event_impact)
{
my.skill1 = 0;
}
}


However that should not make any difference, as the event function is only triggered when an event happens.

Re: what the hecks wrong here? [Re: Xarthor] #138310
06/28/07 12:32
06/28/07 12:32
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
got rid of the semicolon, no errors now, however the torp still just flashs for a second and then vanishes again. it`s like the my.skill1 is somehow stoping the movement code.


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

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Well from the snippet posted in here I cannot tell any more than:
Weird
lol, well you should check all functions that deal with that torpedo if they influence the torpedo's skill1 in any way.

Re: what the hecks wrong here? [Re: Xarthor] #138312
06/28/07 12:54
06/28/07 12:54
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
ok mate, thanks for your help, i had better rewrite everthing i suppose instead of just adding bits in lol.


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

Joined: Jan 2007
Posts: 221
Perhaps the torpedo gets stuck in the player? This could happen if your player entity is not passable.
If so, you can modify your c_move instruction:

..
you = player;
c_move (my, bullet_speed, nullvector, ignore_passable|IGNORE_YOU);
..

Page 2 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