2 registered members (RealSerious3D, rvl),
1,187
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
whack a snake
#82705
07/23/06 17:01
07/23/06 17:01
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
ok, I made an animation of a snake and my objective is to hit him with my cane not shoot him. I want ro make in my level that some bad guys you have to shoot and some you have to whack with the cain. I already made an animation for my Moses character that Moses moves his arm with the cane to hit an enemy like zelda but how do I implement that when the enemy gets hit with my animation when I press ctrl he dissapears ? I know this is a hard code I think, but if you dont know do you have a tutorial that could expain this.
Last edited by tek; 07/23/06 17:03.
|
|
|
Re: whack a snake
[Re: tek]
#82706
07/23/06 17:06
07/23/06 17:06
|
Joined: Jan 2004
Posts: 2,013 The Netherlands
Excessus
Expert
|
Expert
Joined: Jan 2004
Posts: 2,013
The Netherlands
|
-Get the vertex numbers of a vertex in the top of the cane and one of the botom of the cane(Use MED) -While the animation is playing, get the vertex world-position with vec_for_vertex -c_trace from botom vertex to top vertex -if you hit an entity (if(you != null)) -ent_remove(you) Thats it
|
|
|
Re: whack a snake
[Re: Excessus]
#82709
07/23/06 22:08
07/23/06 22:08
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
thanks all
I got the vertex numbers for the top and bottom of the cane top 528.5 16.2 452.9 bottom 518.5 16.2 332.9
Now I am kinda a noob with scripting I know very little.
so do I make like a variable for the vertexes ? and what should I put in the action snake and action player ?
action snake { my.skill55=1234; //rest of the code }
action player move { if(key_ctrl) { whack_percent=(whack_percent+5*time)%100; ent_animate(me,"whack",whack_percent,ANM_CYCLE); my.enable_impact=on; my.enable_entity=on; (if(you !=null)) if(you.skill55==1234 { ent_remove(you) } } }
Is it something like this although I doubt it. I am sorry I am just not to skill with c. and how would I implement the c_trace ?
Last edited by tek; 07/23/06 22:46.
|
|
|
Re: whack a snake
[Re: tek]
#82710
07/25/06 04:55
07/25/06 04:55
|
Joined: Apr 2006
Posts: 1,551 Netherlands
D3D
Serious User
|
Serious User
Joined: Apr 2006
Posts: 1,551
Netherlands
|
Those numbers look like x,y,z positions of the top and bottom of your cane. What you need are the vertex numbers; They can be found if you switch display to vertex and use select on them, in order to get the proper vertex number(s). All the best, Dusty
|
|
|
Re: whack a snake
[Re: tek]
#82712
07/25/06 13:39
07/25/06 13:39
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
as Excessus described: you need TWO vertex numbers, one of a vertex at the top of the cane and one at the bottom of it. Code:
var whacking = 0; //at the top of your script
//... in your players while loop: if(key_ctrl || whack_percent) { whack_percent=(whack_percent+5*time)%100; ent_animate(me,"whack",whack_percent,ANM_CYCLE); var trace_from[3]; var trace_to[3]; vec_for_vertex(trace_from,player,200); //replace 200 by your number vec_for_vertex(trace_to,player,300); //replace 300 by your number c_trace(trace_from,trace_to,ignore_me+ignore_passable); if(you != null && you.skill55==1234) { ent_remove(you) } }
I doubt this will work, its just some pseudo code to give you an idea about trace. By the way: Are you using A5 or A6? (the script above is written for A6)
|
|
|
Re: whack a snake
[Re: Xarthor]
#82713
07/25/06 16:31
07/25/06 16:31
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
ok thank you for teaching me this I will work with that code. I use A6
Last edited by tek; 07/25/06 17:00.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|