Gamestudio Links
Zorro Links
Newest Posts
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 (Ayumi, 1 invisible), 584 guests, and 1 spider.
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 2 1 2
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 Offline

X
rayp  Offline

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 ):
Code:
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
D
Dega Offline OP
Member
Dega  Offline OP
Member
D

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: Dega] #414052
12/21/12 16:47
12/21/12 16:47
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
swing_my_sword is a placeholder for your attack script and for now, it does nothing, cause it does not exist grin

I would suggest you to take a look into the zombies-workshop on realspawns page.


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] #414055
12/21/12 17:15
12/21/12 17:15
Joined: Dec 2010
Posts: 100
D
Dega Offline OP
Member
Dega  Offline OP
Member
D

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 Offline
Serious User
Reconnoiter  Offline
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
D
Dega Offline OP
Member
Dega  Offline OP
Member
D

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:

Code:
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 Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Code:
#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;
Page 2 of 2 1 2

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