Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (7th_zorro), 1,390 guests, and 2 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 2 of 4 1 2 3 4
Re: c_trace and shooting projectile help [Re: Joozey] #168156
11/21/07 17:04
11/21/07 17:04
Joined: Nov 2007
Posts: 73
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

Joined: Nov 2007
Posts: 73
woot! you rock! thanks soooo much!

this works now!

however when do you think, or how do you think, a good way to get them to be removed is? like how would i do it based off distance or time?

Re: c_trace and shooting projectile help [Re: immolat3] #168157
11/21/07 17:05
11/21/07 17:05
Joined: Nov 2007
Posts: 73
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

Joined: Nov 2007
Posts: 73
ah crap, i realized it's only shooting one direction no matter what, hrmm, that is because im not doing it based off my pan and rotation im guessing?

Re: c_trace and shooting projectile help [Re: immolat3] #168158
11/21/07 17:24
11/21/07 17:24
Joined: Nov 2007
Posts: 73
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

Joined: Nov 2007
Posts: 73
Code:
action bulletFly
{
my.pan = camera.pan;
my.x = plBiped01_entity.x;
my.y = plBiped01_entity.y;
my.z = plBiped01_entity.z;
while(me)
{
my.passable = on;
c_move(me, vector(bulletSpeed,0,0), vector(0,0,0), ignore_me);
wait(1);
}
}



did that and now it shoots in the right direction but isnt taking into account if im aiming up or down

Re: c_trace and shooting projectile help [Re: immolat3] #168159
11/21/07 17:27
11/21/07 17:27
Joined: Nov 2007
Posts: 73
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

Joined: Nov 2007
Posts: 73
ah ok nvm got it working completely now.

now i gotta figure out how to remove them at a good time

Re: c_trace and shooting projectile help [Re: immolat3] #168160
11/21/07 18:11
11/21/07 18:11
Joined: Nov 2007
Posts: 73
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

Joined: Nov 2007
Posts: 73
Code:
var shootEnergy = 1;
var shootDmg = 0.1;
sound laserPew = <laserPew.wav>;
sound laserEmpty = <laserEmpty.wav>;
sound laserNoHit = <laserNoHit.wav>;
var bulletSpeed = 50;

action bulletFly
{
// Set the bullet positions and angles correctly to be fired.
my.pan = camera.pan;
my.roll = camera.roll;
my.tilt = camera.tilt;
my.x = plBiped01_entity.x;
my.y = plBiped01_entity.y;
my.z = plBiped01_entity.z;

// Start the ticker.
var ticker = 0;

while(me)
{
ticker = ticker + 1;
my.passable = on;
c_move(me, vector(bulletSpeed,0,0), vector(0,0,0), ignore_me);
my.z = my.z + 5;

if (ticker == 50) // Length of time in pseudo-ticks that bullet stays "alive."
{
ent_remove(me);
}

wait(1);
}
}

// Fire Gun Function
function PewPew()
{
var theTarget;
vec_set(theTarget.x, vector(10000, 0, 0)); // shoots 10000 quants
vec_rotate(theTarget.x, camera.pan); // shoots in the direction of the player (cameras pan, b/c 3rd person)
c_trace(my.x, theTarget.x, ignore_me + scan_texture | ignore_passable | use_aabb );

if(str_cmpi(tex_name, "TESTBOSS.MDL") == 1 && getEnergy() >= shootEnergy)
{
doDamage(shootDmg);
subtractEnergy(shootEnergy);
snd_play(laserPew, 100, 0);
ent_createlocal("bullet.mdl", plBiped01_entity.x, bulletFly);
}
if(getEnergy() < shootEnergy)
{
snd_play(laserEmpty, 100, 0);
subtractEnergy(0);
}
else
{
snd_play(laserNoHit, 100, 0);
subtractEnergy(shootEnergy);
ent_createlocal("bullet.mdl", plBiped01_entity.x, bulletFly);
}
snd_stop(laserPew);
snd_stop(laserEmpty);
snd_stop(laserNoHit);
}




Thanks so much for your help. The above code works perfectly ;P

Re: c_trace and shooting projectile help [Re: immolat3] #168161
11/21/07 18:19
11/21/07 18:19
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Code:

result = c_move(me, vector(bulletSpeed,0,0), vector(0,0,0), ignore_me);
...
if (result > 1000 || result < 0) //or traveled over 1000 quants, or blocked
{
ent_remove(me);
}




Click and join the 3dgs irc community!
Room: #3dgs
Re: c_trace and shooting projectile help [Re: Joozey] #168162
11/22/07 01:43
11/22/07 01:43
Joined: Nov 2007
Posts: 73
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

Joined: Nov 2007
Posts: 73
works great, thanks sooo much...but one more question! i used a similar code for my enemy to shoot, so whats a good way that if one of the models created and shot with c_move hits the player to subtract health?

if (target == player)
{
remDocHealth(10);
}


doesnt wanna work

Re: c_trace and shooting projectile help [Re: immolat3] #168163
11/22/07 06:40
11/22/07 06:40
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
target is a position, not a pointer. Try you == player.


Click and join the 3dgs irc community!
Room: #3dgs
Re: c_trace and shooting projectile help [Re: Joozey] #168164
11/22/07 06:46
11/22/07 06:46
Joined: Nov 2007
Posts: 73
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

Joined: Nov 2007
Posts: 73
Code:
  action bossShootRand
{
my.pan = random(360);
my.roll = random(360);
my.tilt = 90 - random(165);

// Start the ticker.
var ticker = 0;

while(me)
{
var theTarget;
vec_set(theTarget.x, vector(100,0,0));
ticker = ticker + 1;
my.passable = off;
c_move(me, vector(30,0,0), vector(0,0,0), use_aabb + glide);

if (you == player)
{
remDocHealth(10);
}

my.z = my.z + 5;
if (ticker == 50) // Length of time in pseudo-ticks that bullet stays "alive."
{
ent_remove(me);
}

wait(1);
}
}



not working either, the bullets definite hit the player model because they bounce off, which is fine, but they dont want to do damage.

Re: c_trace and shooting projectile help [Re: immolat3] #168165
11/22/07 08:02
11/22/07 08:02
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
hm, indeed c_move does not modify 'you' according to the manual. You can also use if (vec_dist (my.x, player.x) < 100) {} but it wont work properly if the player happens not to be a round ball . Another option would be to use c_content which returns you for scanned entities, but im not sure if this works well with models (the manual specifically says map entities, but you can try on models).


Click and join the 3dgs irc community!
Room: #3dgs
Page 2 of 4 1 2 3 4

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