2 registered members (AndrewAMD, Ayumi),
1,405
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
3rd Person Shooting Script Help!
#259366
04/05/09 17:19
04/05/09 17:19
|
Joined: Jul 2008
Posts: 56
iam_ufo973
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2008
Posts: 56
|
Hey Folks It is first time i am scripting first person shooting game so i am very confused. Help me please. When player touches the gun model how to attach it to player and let the player shoot with it? Is there any tutorial out there? Or can someone give me some example scripts please? Many Many thanks from advance
|
|
|
Re: 3rd Person Shooting Script Help!
[Re: iam_ufo973]
#259470
04/06/09 10:44
04/06/09 10:44
|
Joined: Jul 2008
Posts: 56
iam_ufo973
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2008
Posts: 56
|
|
|
|
Re: 3rd Person Shooting Script Help!
[Re: iam_ufo973]
#260212
04/09/09 14:06
04/09/09 14:06
|
Joined: Nov 2008
Posts: 946
the_clown
User
|
User
Joined: Nov 2008
Posts: 946
|
Well, I'd not recommend to buy Intense X if the goal only is attaching a gun to the player... However, Intense X is great and everything, but attaching the gun to the player and let him shoot through it indeed IS simple. But how to do that still depends on the kind of game you are making, first person or third person? The principe is the same anyway. In both modes, you have to define a position for the gun model, a vector of course. For example:
VECTOR gun_position;
Then you have to update that vector; the x, y and z values have to be set. So you have a function, call it update_gun_pos or whatever. Now, in third person mode, you would attach the gun to the player's hand vertices, using vec_for_vertex:
function update_gun_pos() { while(1) { vec_for_vertex(gun_position,my,2230); // change the vertex number to the desired!!! wait(1); } }
This is very basic; Now, in first person mode, you would set the vector relative to the camera:
function update_gun_pos() { while(1) { vec_set(gun_position,vector(30,-20,-10)); // play with the vector values vec_rotate(gun_position.x,camera.pan); vec_add(gun_position.x,camera.x); wait(1); } }
I suppose you understand all of these vector functions.
The last thing to do is to set the actual model to the position; This can now easily be done. The following code works with both of the snippets above. It turns a weapon model to a item that can be picked up and will stay at the desired position all the time:
action sample_gun() { while(vec_dist(my.x,player.x)<30) { wait(1); } while(1) { vec_set(my.x,gun_position.x); // now decide: if in third person mode, write this line: my.pan = player.pan; // if in first person mode, write this line: vec_set(my.pan,camera.pan);
wait(1); } }
The gun won't fire yet; I unfortunaly don't have the time to write this down now. If you want, I can try and write a little tutorial for gun code. But someone'll have to tell me how to upload it...
|
|
|
Re: 3rd Person Shooting Script Help!
[Re: the_clown]
#260214
04/09/09 14:28
04/09/09 14:28
|
Joined: Jul 2008
Posts: 56
iam_ufo973
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2008
Posts: 56
|
the_clown many many thanx for taking your time and writing this tutoirla though it is still incomplete i wish you could make a complete tutoiral with sample project . I will be waiting for the rest of the tutorial. Once again thanx Edit:: As for uploading there are hudreds of free hosting servers there like rapidshare, mediafire, filefactory etc a simple google search will bring thousands of these free file hosting servers
Last edited by iam_ufo973; 04/09/09 14:31.
|
|
|
Re: 3rd Person Shooting Script Help!
[Re: the_clown]
#260240
04/09/09 16:53
04/09/09 16:53
|
Joined: Jan 2008
Posts: 1,580
Blade280891
Serious User
|
Serious User
Joined: Jan 2008
Posts: 1,580
|
If you want i can always host the file for you
My Avatar Randomness V2"Someone get me to the doctor, and someone call the nurse And someone buy me roses, and someone burned the church"
|
|
|
|