Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (RealSerious3D, rvl), 1,187 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
whack a snake #82705
07/23/06 17:01
07/23/06 17:01
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

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
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

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] #82707
07/23/06 17:11
07/23/06 17:11
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
you might add the check if the you is a snake (just check a certain flag or skill which is unique for a snake entity) or otherwise you will remove all grass sprites/models or whatever you are walking through/over, because of his magic cane

Re: whack a snake [Re: Xarthor] #82708
07/23/06 17:15
07/23/06 17:15
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Oh yes ofcourse >.< forgot that.

Just put my.skill55 = 1234; in the snake's action and then check if you.skill55 == 1234 -> ent_remove(you);

Re: whack a snake [Re: Excessus] #82709
07/23/06 22:08
07/23/06 22:08
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

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 Offline
Serious User
D3D  Offline
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


smile
Re: whack a snake [Re: D3D] #82711
07/25/06 05:51
07/25/06 05:51
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

Joined: May 2005
Posts: 222
ok thanks dusty I found out my vertex number for the cane it's #225

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 Offline
Expert
Xarthor  Offline
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
T
tek Offline OP
Member
tek  Offline OP
Member
T

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.
Re: whack a snake [Re: tek] #82714
07/25/06 18:11
07/25/06 18:11
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

Joined: May 2005
Posts: 222
Thunder it says empty pointer here in an error

if(you != null && you.skill55==1234)

How would I go about to fix that ?

Page 1 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