Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Newbie Questions
by AndrewAMD. 12/04/23 11:14
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
2 registered members (TipmyPip, izorro), 556 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
i`m confused, again lol #145802
08/04/07 18:11
08/04/07 18:11
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
i`m trying to get a model to scale on it`s x axis (a phaser thing lol), i have it all working sorta but i noticed that the phaser mesh passes through the enemy mesh (it still causes damage though) however i want it to well not pass through the enemy as it looks a bit silly haveing it poke out the other side.
here is what i tried without success.
declared an entity* enemy;

then in the phaser function i put
my.scale_x = enemy.x; ///should only scale out as far as the enemy
my.scale_y = 0.2;
my.scale_z = 0.2;

but it still passes through the enemy, any thoughts on the best way to solve this problem? thanks for any advice.


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: i`m confused, again lol [Re: jigalypuff] #145803
08/04/07 18:27
08/04/07 18:27
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Well, a possible way could be:

You need to know the distance between the ship and the enemy, and then scale the phaser to that distance, so

distance = vec_dist( ship, enemy );

phaser.scale_x = distance / factor; // play with the factor value, if you dont want to scale manually the mdl in order to be 1 unit;

Re: i`m confused, again lol [Re: demiGod] #145804
08/04/07 18:39
08/04/07 18:39
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
ok now bear in mind i`m a bit dense here lol, this is what i just did
Code:

var distance;///assume this should be a var

///added this to the beam weapon so it would scake to the enemy
distance = vec_dist(my.x, enemy.x );
my.scale_x = distance / 0.1;
my.scale_y = 0.2;
my.scale_z = 0.2


sadly does not work, the beam still passes through the enemy, i forgot to add in the first post, in the enemy function i have enemy = my; just in case thats important.


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: i`m confused, again lol [Re: jigalypuff] #145805
08/04/07 18:45
08/04/07 18:45
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Sorry, actually is

my.scale_x = distance * 0.1;

However you probably will need to make some kind of trace, if the phaser fails the enemy it should continue, if hits the target should stop.

Last edited by demiGod; 08/04/07 18:53.
Re: i`m confused, again lol [Re: demiGod] #145806
08/04/07 19:16
08/04/07 19:16
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
still no joy i`m afraid, here is what i have tried, but it still passes through the enemy, one of the reasons i need it to stop is because i want to add in an energy drain code, so the beam stays with the enemy until the charge has run down, once i get this passing through thig sorted i `ll be trying that lol. i think i got it the way you said.
Code:

var phaser_speed;
var distance;
var ship;
function beam_weapons
{
wait(1);
c_setminmax(me);
snd_play(beam_wav, 100, 0);
distance = vec_dist(my.x, enemy );
my.scale_x = distance * 0.1;
my.scale_y = 0.2;
my.scale_z = 0.2;
my.passable = off;
my.oriented = on;
my.flare = on;
my.bright = on;
my.ambient = 100;
my.pan = player.pan;//--->player.pan and tilt set to camera
my.tilt = player.tilt;
my.enable_entity = on;
my.enable_block = on;
my.enable_impact = on;
my.polygon = on;
phaser_speed.x = 50 * time;
phaser_speed.y = 0;
phaser_speed.z = 0;
while (my != null)
{
if (my.roll > 150)
{
my.passable = off;
}
my.roll += 25 * time;
c_move(my,vector(phaser_speed*time,0,0),nullvector,ignore_passable + ignore_you);///
my._frameCt += 1;
if (my._frameCt >= 20) { break; }
wait(1);
}
if (me != null)
{
ent_remove(me);
}
}




Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: i`m confused, again lol [Re: jigalypuff] #145807
08/04/07 19:25
08/04/07 19:25
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Where and when are you calling that function beam_weapons?

You need to put it in a loop in order to calculate the distance all the time, and scale correctly the phaser.

// in the loop
distance = vec_dist(my.x, enemy );
my.scale_x = distance * 0.1; // maybe reduce it like 0.08, test it until you see the phaser reducing

Re: i`m confused, again lol [Re: demiGod] #145808
08/04/07 19:33
08/04/07 19:33
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
well here is the whole code for the beam weapon, by put it in a loop do you mean like a while(1) kinda thingy?
Code:

function c_phaser
{
vec_for_vertex(temp,player,3894);
ent_create (fphaser_mdl, temp, beam_weapons);

}

var phaser_speed;
var distance;
var ship;
function beam_weapons
{
wait(1);
c_setminmax(me);
snd_play(beam_wav, 100, 0);
distance = vec_dist(my.x, enemy );
my.scale_x = distance * 0.1;
my.scale_y = 0.2;
my.scale_z = 0.2;
my.passable = off;
my.oriented = on;
my.flare = on;
my.bright = on;
my.ambient = 100;
my.pan = player.pan;//--->player.pan and tilt set to camera
my.tilt = player.tilt;
my.enable_entity = on;
my.enable_block = on;
my.enable_impact = on;
my.polygon = on;
phaser_speed.x = 50 * time;
phaser_speed.y = 0;
phaser_speed.z = 0;
while (my != null)
{
if (my.roll > 150)
{
my.passable = off;
}
my.roll += 25 * time;
c_move(my,vector(phaser_speed*time,0,0),nullvector,ignore_passable + ignore_you);///
my._frameCt += 1;
if (my._frameCt >= 20) { break; }
wait(1);
}
if (me != null)
{
ent_remove(me);
}
}

on_mouse_left = c_phaser;




Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: i`m confused, again lol [Re: jigalypuff] #145809
08/04/07 20:11
08/04/07 20:11
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Yes,

while (my != null)
{
distance = vec_dist(my.x, enemy );
my.scale_x = distance * 0.1;
...
wait(1);
}

Re: i`m confused, again lol [Re: demiGod] #145810
08/04/07 20:25
08/04/07 20:25
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
O_o

I´m sorry, but i think i didnt paid all the needed atention to your question..

Just one question:
What do you want to do? A phaser that is a model that scales on x axis until reaches the target (no move, just scale), or some kind a torpedo that moves from player to target?

Re: i`m confused, again lol [Re: demiGod] #145811
08/04/07 20:26
08/04/07 20:26
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
ok tried that, but now the beam will not follow my pan or angle, it just goes in a straight line, also it no longer vanishs, just stays there on the screen, and still passes through the enemy. here is the code, i reckon i have put something the wrong way around.
Code:

function c_phaser
{
vec_for_vertex(temp,player,3894);
ent_create (fphaser_mdl, temp, beam_weapons);

}

var phaser_speed;
var distance;
var ship;
function beam_weapons
{
wait(1);
c_setminmax(me);
snd_play(beam_wav, 100, 0);
while (my != null)
{
distance = vec_dist(my.x, enemy );
my.scale_x = distance * 0.01;
my.scale_y = 0.2;
my.scale_z = 0.2;
wait(1);
}

my.passable = off;
my.oriented = on;
my.flare = on;
my.bright = on;
my.ambient = 100;
my.pan = player.pan;//--->player.pan and tilt set to camera
my.tilt = player.tilt;
my.enable_entity = on;
my.enable_block = on;
my.enable_impact = on;
my.polygon = on;
phaser_speed.x = 50 * time;
phaser_speed.y = 0;
phaser_speed.z = 0;
while (my != null)
{
if (my.roll > 150)
{
my.passable = off;
}
my.roll += 25 * time;
c_move(my,vector(phaser_speed*time,0,0),nullvector,ignore_passable + ignore_you);///
my._frameCt += 1;
if (my._frameCt >= 20) { break; }
wait(1);
}
if (me != null)
{
ent_remove(me);
}
}




Why does everyone like dolphins? Never trust a species which smiles all the time!
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