Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
2 registered members (TedMar, AndrewAMD), 1,344 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Bullets are Scary #177884
01/14/08 17:35
01/14/08 17:35
Joined: Jan 2007
Posts: 59
C
Creepinbox Offline OP
Junior Member
Creepinbox  Offline OP
Junior Member
C

Joined: Jan 2007
Posts: 59
Well, I'm having trouble getting my bullets to ignore me. Couldn't make the push thing work, so I thought id just create the bullets a bit in front of the player right?.. but I couldn't get this to work either. well .. I tryed doing it this way ent_create ("bullet.mdl",player.x + 20, Bullet); and .. that won't work ..

so what CAN I DO ! im lost. . ^ ^ HELP ;P

Re: Bullets are Scary [Re: Creepinbox] #177885
01/14/08 17:47
01/14/08 17:47
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
The reason that you couldn't get it in front of the player is because '+ 20' does not get affected by player rotation.
Try searching for vec_for_angle in the manual and see if you can figure out .

For your other problem, I can't read your script from here, so I have no clue .


Click and join the 3dgs irc community!
Room: #3dgs
Re: Bullets are Scary [Re: Joozey] #177886
01/14/08 18:20
01/14/08 18:20
Joined: Jan 2007
Posts: 59
C
Creepinbox Offline OP
Junior Member
Creepinbox  Offline OP
Junior Member
C

Joined: Jan 2007
Posts: 59
How can I use vec_for_angle ? Example?

Re: Bullets are Scary [Re: Creepinbox] #177887
01/14/08 18:37
01/14/08 18:37
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
vec_for_angle(temp, player.pan); //rotate the vector to the player rotation
vec_normalize(temp, 20); //move the rotated vector 20 quants forward
vec_add (temp, player.x); // put it in front of the player

temp will now be in front of the player, regardless of how you turn


Click and join the 3dgs irc community!
Room: #3dgs
Re: Bullets are Scary [Re: Creepinbox] #177888
01/14/08 18:41
01/14/08 18:41
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
vec_set(temp,vector(20,0,0));
vec_for_angle(temp,my.pan);
vec_add(temp,my.x);
ent_create("bullet.mdl",temp,bullet_func);

dont know if its rigth i dont have lite-c


"empty"
Re: Bullets are Scary [Re: flits] #177889
01/14/08 19:35
01/14/08 19:35
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
@flits
vec_for_angle resets 'temp', so if you first use vec_set, it will be overwritten by vec_for_angle . Vec_normalize is used to stretch a vector along it's length, so it will be placed [n] quants ahead of where it is facing (in this case, vec_scale will do too).

Last edited by Joozey; 01/14/08 19:36.

Click and join the 3dgs irc community!
Room: #3dgs
Re: Bullets are Scary [Re: Joozey] #177890
01/14/08 20:58
01/14/08 20:58
Joined: Jan 2007
Posts: 59
C
Creepinbox Offline OP
Junior Member
Creepinbox  Offline OP
Junior Member
C

Joined: Jan 2007
Posts: 59
Well .. It works untill i look up .. then it get wired.. but isn't there any other way to do this with out a trace?

Re: Bullets are Scary [Re: Creepinbox] #177891
01/14/08 21:34
01/14/08 21:34
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
=_O it shouldn't be weird.

So what I understood is that you want to trace from player to [distance in front of the player] and trace for a target? And IGNORE_ME does not work? Presumably you have done something wrong then .

But you can do it many ways without trace, just depends what you want precisely. moving the bullet can be done through c_move or just count up the position with vector calculation. Scanning for entities can be done with c_scan and checking for blocks with c_content (this in combination with c_move). Now you really move the bullet instead of just tracing whether it will hit an object or not. While moving you scan if you hit something. Downside of this method is that it is slower than c_trace.


Click and join the 3dgs irc community!
Room: #3dgs
Re: Bullets are Scary [Re: Joozey] #177892
01/14/08 21:51
01/14/08 21:51
Joined: Jan 2007
Posts: 59
C
Creepinbox Offline OP
Junior Member
Creepinbox  Offline OP
Junior Member
C

Joined: Jan 2007
Posts: 59
Yeah .. eh .. What I want I for the bullet model to go from point A to Point B with out hitting the player at all .. and without it being passable. And how should I do that ? Why am i having such a hard time doing this.. ^^ not my day i guess

Re: Bullets are Scary [Re: Creepinbox] #177893
01/14/08 22:59
01/14/08 22:59
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Ok, then I suggest you try c_move.

This code works:

Code:

...
ent_create ("bullet.mdl", my.x, bullet_behaviour);
...

function bullet_behaviour() {
var covered_distance = 0;

vec_for_angle (my.x, you.pan);
vec_scale (my.x, 10);
vec_add (my.x, you.x);

vec_set(my.pan, you.pan);

//we need to store the you (parent entity) because it will be emptied after the next wait(1)
ENTITY* parent_ent = you;

while (me) {
you = parent_ent; //search back for the parent entity
covered_distance = c_move (me, vector(40 * time_step, 0, 0), nullvector, IGNORE_YOU); //move 40 quants ahead and ignore the parent entity

//bullet is stuck on impact, do possible damage and remove
if (covered_distance <= 0) {
you = c_trace (target.x, target.x, IGNORE_ME); //search for the entity hit
if (you) {you.health -= 5;} //If theres an entity, remove health. or whatever you had in mind ;)
ent_remove(me); //ptr_remove(me) if you have the newest version
}
wait(1);
}
}




Last edited by Joozey; 01/14/08 23:02.

Click and join the 3dgs irc community!
Room: #3dgs
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