Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,459 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to attach a weapon to player? #98287
11/10/06 20:44
11/10/06 20:44
Joined: Dec 2005
Posts: 252
MyOwnKingdom
nipx Offline OP
Member
nipx  Offline OP
Member

Joined: Dec 2005
Posts: 252
MyOwnKingdom
To set the gun at the players positions is quite easy vec_set(gun.x, player.x).

But what I'd like to do is attach it in a way I am not just looking into the weapon.

I could use
Code:
 entity eGun
{
type="gun1.mdl";
view=camera;
....
}



That would be easy but how can I get a vertex....? (if this is possible, but I dont think so )


I think better is to create the weapon with ent_create.

Here's the problem:
I cant figure out how to make it follow the player/camera that it looks like i would do it with entity eGun......

Anyone here has an idea?


thx nipx

Re: How to attach a weapon to player? [Re: nipx] #98288
11/10/06 21:05
11/10/06 21:05
Joined: Oct 2006
Posts: 1,245
A
AlbertoT Offline
Serious User
AlbertoT  Offline
Serious User
A

Joined: Oct 2006
Posts: 1,245
there is an AUM example

Re: How to attach a weapon to player? [Re: AlbertoT] #98289
11/10/06 21:09
11/10/06 21:09
Joined: Dec 2005
Posts: 252
MyOwnKingdom
nipx Offline OP
Member
nipx  Offline OP
Member

Joined: Dec 2005
Posts: 252
MyOwnKingdom
Thanks
what number?

Re: How to attach a weapon to player? [Re: nipx] #98290
11/10/06 21:24
11/10/06 21:24
Joined: Oct 2006
Posts: 1,245
A
AlbertoT Offline
Serious User
AlbertoT  Offline
Serious User
A

Joined: Oct 2006
Posts: 1,245
Honestly I dont remeber
There is also a tutorial in the resources : attaching entities by Alex Russel

Re: How to attach a weapon to player? [Re: AlbertoT] #98291
11/10/06 21:36
11/10/06 21:36
Joined: Dec 2005
Posts: 252
MyOwnKingdom
nipx Offline OP
Member
nipx  Offline OP
Member

Joined: Dec 2005
Posts: 252
MyOwnKingdom
thx, ill get it

nipx

Re: How to attach a weapon to player? [Re: nipx] #98292
11/11/06 00:28
11/11/06 00:28
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
I'm not shure what exactly you want to do
For first person shooter use entity gun_ent_name ... then for muzzle use vec_for_vertex(vector,gun_ent_name,vertex_number); and for shooting do a trace from the screen coordinates (if your video mode is set to 8(1024x768) the middle is 512x and 384y (and trace forward 5000 quants(or bigger number))
For 3-rd person shooter create a normal action gun_ent_name and attach the muzzle again with vec_for_vertex , and then trace from that same vertex again 5000 quants forward (you can get that value using the weapons pan angle)
vec_for_vertex(trace1.x,weapon_entity,vertex_number);
trace2.x = trace1.x + 5000 * cos(weapon_entity.pan);
trace2.y = trace1.y + 5000 * sin(weapon_entity.pan);
trace2.z = trace1.z;
and then do the trace to see if it hits something
Hope you understand what I described.


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: How to attach a weapon to player? [Re: EpsiloN] #98293
11/11/06 01:37
11/11/06 01:37
Joined: Dec 2005
Posts: 252
MyOwnKingdom
nipx Offline OP
Member
nipx  Offline OP
Member

Joined: Dec 2005
Posts: 252
MyOwnKingdom
Yes its a FPS.


Quote:

use entity gun_ent_name ... then for muzzle use vec_for_vertex




Thats the point. I knew this way but it deosnt work at all

I tried:
Code:

entity eCurrent_weapon_ent
{
type=<ak47.mdl>;
x=13;
y=-7;
z=-2.5;
tilt=0;
pan=-10;
flags=visible;//
}

.........
.........
.........
function fadeout
{
sleep(1);
ent_remove(me);
}

var v3Muzzle_pos[3]; //bullet and muzzle pos
while(1)
{ //bit shorter
if(mouse_left)
{
vec_for_vertex(v3Muzzle_pos, eCurrent_weapon_ent, 213);
ent_create("bullet.mdl",v3Muzzle_pos, fadeout); //create bullet
sleep(1.2); //test value
}
}




Im really wondering. I dont get any error, the bullet is spawn, but at the wrong position. (0,0,0) This is strange because on the debug panel I see :

999999
0
0

Hope you can help me


nipx


Edit: sorry my fault. I useed the wrong vars on the debugpanel.

v3Muzzle_pos.a / b / c . Now it shows me the correct value. Why is a/b/c wrong but x/y/z works?

Just add them to the player position, then i get gun position, right?

Last edited by nipx; 11/11/06 04:14.

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