2 registered members (Ayumi, 1 invisible),
584
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: First person RPG example
[Re: Dega]
#414049
12/21/12 16:34
12/21/12 16:34
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
X
|
X
Joined: Jul 2008
Posts: 2,107
Germany
|
Look u dont have a swinging animation. Player has a attack animation. You just give him a weapon in his hands. When the player now plays its attack animation, your sword is in his hands, so theres no need for a swinging animation in the sword. If you wanna make an fps, weapon holding is a complete other thing. There i wouldnt use hand bones at all. fps weapon holding basic ( in this case u would need a swinging animation ):
void _hold_fps_weapon()
{
set(my, PASSABLE | ZNEAR);
while(my){
// place weapon on screen
vec_set(my.x, camera.x);
vec_set(my.pan, camera.pan);
my.skill1 += time_step;
ent_animate(me, "idle", my.skill1, ANM_CYCLE);
if (mouse_left) swing_my_sword(); //fex attack now
wait(1);
}
}
action myPlayer(){
ent_create("sword.mdl", vector(my.x, my.y, my.z), _hold_fps_weapon);
}
Maybe u take a look into this site ( fex Zombies-Workshop ) http://www.rp-interactive.nl/ws/index.html
Last edited by rayp; 12/21/12 16:43.
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|
|
|
Re: First person RPG example
[Re: rayp]
#414051
12/21/12 16:44
12/21/12 16:44
|
Joined: Dec 2010
Posts: 100
Dega
OP
Member
|
OP
Member
Joined: Dec 2010
Posts: 100
|
Hey I am very sorry if I am annoying you. I am trying to figure out what " swing_my_sword(); " does. Is it just an ent_animate(); or do I use that and c_move/c_rotate ?
boolean my.awesomeness = so true;
|
|
|
Re: First person RPG example
[Re: rayp]
#414055
12/21/12 17:15
12/21/12 17:15
|
Joined: Dec 2010
Posts: 100
Dega
OP
Member
|
OP
Member
Joined: Dec 2010
Posts: 100
|
Okay I see what you are saying now. However, the gun in the tutorial just stays still and plays a sound when it fires. What I am trying to do is make a sword "swing" when I right click. I am trying to figure out what to code when I make the script for the right click button. Please also note when I am coding this I want to have two different models. One is the player and the other is the other weapon. The reason is because I want to use different weapons. So for the code do I use an animation with the model or do I just code it to move so I can make it "swing"?
P.S. in the tutorial when I try to fire directly at the zombie it pops up an error box saying something about an unsupported feature.
Last edited by Dega; 12/21/12 17:21.
boolean my.awesomeness = so true;
|
|
|
Re: First person RPG example
[Re: Dega]
#414056
12/21/12 17:29
12/21/12 17:29
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Are you making a fps? Because if so, you propably wont need a complex player model, except if it is multiplayer or has alot of mirrors etc. Maybe it is an idea to make a model of a right or/and left arm(s) with different animations for different weapons. Give this arm (or arms) an action and give the weapon a seperate action.
So you than have: 1. the player model as a dummy model for collision checks with enemy attacks and missiles and for things like player movement. 2. an arm model with various animations and which is passable. 3. a weapon model that 'follows' the player arm, does the damage when it touches an enemy and is passable too.
Last edited by Reconnoiter; 12/21/12 17:30.
|
|
|
Re: First person RPG example
[Re: Reconnoiter]
#414057
12/21/12 17:49
12/21/12 17:49
|
Joined: Dec 2010
Posts: 100
Dega
OP
Member
|
OP
Member
Joined: Dec 2010
Posts: 100
|
Yes I am making a first person game but it isn't a shooter. It is a game with swords and magic. Thank you all for your help. I was reading AUM 107 and came across a code that might do the trick although I have not tried it yet. Here it is:
VECTOR palm1, palm2, sword_direction;
STRING* sword_mdl = "sword.mdl";
function attach_sword()
{
proc_mode = PROC_LATE;
set (my, PASSABLE); // the sword shouldn't slow down the player
while (you)
{
// get the vertex at the bottom of the palm in Med
vec_for_vertex (palm1, you, 28);
// get the vertex that separates the thumb and the pointer finger in Med
vec_for_vertex (palm2, you, 9);
// compute the vector that will be used by the sword
vec_diff (sword_direction, palm2, palm1);
// rotate the sword accordingly
vec_to_angle (my.pan, sword_direction);
// put the origin of the sword in the vertex that is placed at the bottom of the palm
vec_set (my.x, palm1);
wait (1);
}
}
action spearman_action()
{
var anim_percentage = 0;
ent_create (sword_mdl, my.x, attach_sword); // attach the sword to the player
while (1)
{
anim_percentage += 3 * time_step; // 3 = "walk" animation speed
ent_animate(my, "walk", anim_percentage, ANM_CYCLE); // play the "walk" animation
c_move (my, vector(5 * time_step, 0, 0), nullvector, IGNORE_PASSABLE | GLIDE);
my.pan += 2 * time_step; // 2 sets the radius of the circle
wait (1);
}
}
That way whatever weapon will move how I want it when animate the player model's arm.
boolean my.awesomeness = so true;
|
|
|
Re: First person RPG example
[Re: Dega]
#414058
12/21/12 17:55
12/21/12 17:55
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
X
|
X
Joined: Jul 2008
Posts: 2,107
Germany
|
#define anm skill100
#define idle 0
#define attack 1
void _hold_fps_weapon()
{
set(my, PASSABLE | ZNEAR);
while(my){
// place weapon on screen
vec_set(my.x, camera.x);
vec_set(my.pan, camera.pan);
my.skill1 += time_step;
if (my.anm == idle) ent_animate(me, "idle", my.skill1, ANM_CYCLE);
if (my.anm == attack)ent_animate(me, "attack", my.skill1, NULL);
if (mouse_left && my.anm != attack){
my.skill1 = 0;
my.anm = attack;
}
// my.skill1 %= 100;
if (my.skill1 >= 100){
my.anm = idle;
my.skill1 = 0;
}
wait(1);
}
}
action myPlayer(){
ent_create("sword.mdl", vector(my.x, my.y, my.z), _hold_fps_weapon);
}
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|