|
combat code problems
#408147
09/26/12 14:10
09/26/12 14:10
|
Joined: Jan 2010
Posts: 145
Doc_Savage
OP
Member
|
OP
Member
Joined: Jan 2010
Posts: 145
|
hi there, i have a big issue with combat, i have a player with a sword, he is using the c_trace function to hit an enemy and deal damage, 5 points. that is all fine and working, the problem is, he hits multiple times while his sword is passing through the enemy and ends up dealing 15 or 20 damage points!! it is so frustrating, i cant find a single thing to thwart this, can anyone help? i would love for the enemy to be dealt one unit of damage each time the sword passes through him. also is there a way to have the animation set up so you click the mouse and release, he swings his sword and stops when the animation is done? and while holding down the mouse button he swings continually? like in the game diablo. i know this is a lot to ask but i would like a few hints here, ive done a LOT of research and tried hard to solve it through expiramentaion. ive been on these problems for 3 weeks. hopefully i can get some results from the pros thanks guys. im hoping you can help me with these problems and thank you for your time.
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Re: combat code problems
[Re: GameScore]
#408154
09/26/12 15:50
09/26/12 15:50
|
Joined: Jan 2010
Posts: 145
Doc_Savage
OP
Member
|
OP
Member
Joined: Jan 2010
Posts: 145
|
i cant unfortunatley, im away from home, but its your basic c_trace function on a sword model. i hope someone can help me with those problems anyway.
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Re: combat code problems
[Re: Superku]
#408157
09/26/12 17:00
09/26/12 17:00
|
Joined: Jan 2010
Posts: 145
Doc_Savage
OP
Member
|
OP
Member
Joined: Jan 2010
Posts: 145
|
can you please show an example of that? ive never heard of this strategy. i would be very appreciative. also any idea on my animation problem?
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Re: combat code problems
[Re: Doc_Savage]
#408160
09/26/12 17:09
09/26/12 17:09
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
action act_player() { while(1) { if(mouse_left) { my.skill20 = 0; my.skill21 = 1; while(my.skill20 < 100) { my.skill20 += 10*time_step; ent_animate(me,"attack",my.skill20,0); if(my.skill20 > 50 && my.skill21) { my.skill21 = 0; VECTOR temp; vec_set(temp,vector(100,0,0)); // 100 = weapon range vec_rotate(temp,vector(my.pan,0,0)); vec_add(temp,my.x); c_trace(my.x,temp,IGNORE_ME | IGNORE_PASSABLE); if(you) { if(your._type == type_enemy) //identify your enemy somehow, where _type is defined as skill100 or something like that { your.health -= 25; } } } wait(1); } } move & turn; wait(1); } }
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: combat code problems
[Re: Superku]
#408162
09/26/12 17:19
09/26/12 17:19
|
Joined: Jan 2010
Posts: 145
Doc_Savage
OP
Member
|
OP
Member
Joined: Jan 2010
Posts: 145
|
oh WOW. ok. so this is how to do the trace in the middle of the animation huh? so ctrace is a bad idea then.. hm.. ok. im assuming this is a player code. i totally get it now.
edit: i just remembered i have the enemy identified with an entity pointer, will that work here?
Last edited by Doc_Savage; 09/26/12 17:26.
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Re: combat code problems
[Re: Doc_Savage]
#408164
09/26/12 17:35
09/26/12 17:35
|
Joined: Oct 2011
Posts: 1,082 Germany
Ch40zzC0d3r
Serious User
|
Serious User
Joined: Oct 2011
Posts: 1,082
Germany
|
oh WOW. ok. so this is how to do the trace in the middle of the animation huh? so ctrace is a bad idea then.. hm.. ok. im assuming this is a player code. i totally get it now.
edit: i just remembered i have the enemy identified with an entity pointer, will that work here? When your enemies are all having the same entitypointer (what I dont think) then yes.
Last edited by Ch40zzC0d3r; 09/26/12 17:35.
|
|
|
Re: combat code problems
[Re: Ch40zzC0d3r]
#408165
09/26/12 17:40
09/26/12 17:40
|
Joined: Jan 2010
Posts: 145
Doc_Savage
OP
Member
|
OP
Member
Joined: Jan 2010
Posts: 145
|
well funny enough, im having trouble with more than one enemy in the game, some things sync like alert distance and stuff. any idea how to separate them? i need to know how to individualize them. should i be using more than one entity pointer or what?
Last edited by Doc_Savage; 09/26/12 17:41.
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Re: combat code problems
[Re: Doc_Savage]
#408166
09/26/12 17:43
09/26/12 17:43
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
i just remembered i have the enemy identified with an entity pointer, will that work here? well funny enough, im having trouble with more than one enemy in the game, some things sync like alert distance and stuff. any idea how to separate them? Don't use global pointers for that, just handle individual things, attributes and the like with skills.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|