3 registered members (Ayumi, Akow, monk12),
1,413
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: First person RPG example
[Re: Reconnoiter]
#414039
12/21/12 15:09
12/21/12 15:09
|
Joined: Dec 2010
Posts: 100
Dega
OP
Member
|
OP
Member
Joined: Dec 2010
Posts: 100
|
Offtopic: That game is called Eternal Ring for the playstation 2. I play that game still with my friends. It is hard at first but then it gets soooooo fun. You start out with a sword and then create rings to use magic while in search of the Eternal ring. It's really fun!
Ontopic: I am thinking of using as many weapons as I can think up but so far I am going to start with a basic sword and go from there.
To PadMalcom: Hey thanks! I can't read German but I can use Google Translate! If it is a big piece then I can just work with it page by page. Thanks very much!<------okay never mind that lol. I was thinking you were showing me a pdf file for some reason. Sorry! The movie is perfect for what I am doing though. Thanks anyways! I just reposted.
Do you think you could show me a simple example on how to code an entity picking up three different weapons and using them? Weapon examples: sword, mace, and an axe. That's all I really need.
Last edited by Dega; 12/21/12 15:36.
boolean my.awesomeness = so true;
|
|
|
Re: First person RPG example
[Re: Dega]
#414041
12/21/12 15:49
12/21/12 15:49
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Well if you only have a few weapons you can add an action for each weapon. So when you pick up the item you can can create the item with its action:
ent_create("ShortSword.mdl",vector_myrightarm,ShortSword);
The action of the item can than have things like *when is the model visible (e.g. through a variable: var_weaponslot == 1) *when it deals damage to an enemy (e.g. through c_trace or c_scan to check whether the weapon touches an enemy) *its x, y and z coordinates (just use vec_for_bone to transfer the x/y/z coordinates of e.g. the 'right hand bone' to 'vector_myrightarm') *the animations the sword uses etc. If you have alot weapons, you can use an action for your 'right weapon' (or 'left weapon'). Through variables like e.g. var_weaponslot you can check which weapon the player has equiped. There are ofcourse more possible ways and I dont know if this is the best one, but for me it works.
|
|
|
Re: First person RPG example
[Re: Reconnoiter]
#414042
12/21/12 16:03
12/21/12 16:03
|
Joined: Dec 2010
Posts: 100
Dega
OP
Member
|
OP
Member
Joined: Dec 2010
Posts: 100
|
Okay thanks. I will do that. However, I am wondering on how I get the sword to animate with the player. Do I use c_rotate() with the code and if yes how to code that or how do I animate with MED somehow???
boolean my.awesomeness = so true;
|
|
|
Re: First person RPG example
[Re: Dega]
#414043
12/21/12 16:14
12/21/12 16:14
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
X
|
X
Joined: Jul 2008
Posts: 2,107
Germany
|
void _apply_sword(){
VECTOR _ang, _pos;
while (you){ // do as long player != NULL
// move with players animation
vec_for_bone(_pos, you, "Right Hand"); // get xyz pos of hand bone
ang_for_bone(_ang, you, "Right Hand"); // get rotation of hand bone
vec_set(my.x, _pos.x); // set xyz
vec_set(my.pan, _ang); // set rotation
// optional animation
//my.skill1 += time_step;
//ent_animate(me, "idle", my.skill1, ANM_CYCLE);
wait(1);
}
ptr_remove(me); // no more player ? remove weapon
}
..
action myPlayer()
{
player = me;
// create the sword and apply to players hand
ent_create("sword.mdl", vector(player.x, player.y, player.z), _apply_sword);
}
Last edited by rayp; 12/21/12 16:19.
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]
#414044
12/21/12 16:21
12/21/12 16:21
|
Joined: Dec 2010
Posts: 100
Dega
OP
Member
|
OP
Member
Joined: Dec 2010
Posts: 100
|
Instead of "idle" can I code that the same way as "swinging"? Do I make the model animate "swinging" in MED?
boolean my.awesomeness = so true;
|
|
|
Re: First person RPG example
[Re: rayp]
#414048
12/21/12 16:30
12/21/12 16:30
|
Joined: Dec 2010
Posts: 100
Dega
OP
Member
|
OP
Member
Joined: Dec 2010
Posts: 100
|
Sorry I couldn't find any tutorials for GStudio A8 for something like this and are you saying for "swinging" I animate it in MED and code it to move at the same time? I am trying to use a different model for the player and the weapons.
Last edited by Dega; 12/21/12 16:39.
boolean my.awesomeness = so true;
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|