Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
1 registered members (henrybane), 1,499 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
vec_for_vertex and animation #128474
05/07/07 15:55
05/07/07 15:55
Joined: Apr 2006
Posts: 265
V
vartan_s Offline OP
Member
vartan_s  Offline OP
Member
V

Joined: Apr 2006
Posts: 265
I have a simple hit box system in the works. An head hitbox entity (passable for now) is created by the enemy entity and aligned to the head every frame - this is done successfully when the enemy entity moves. However, when the entity plays its death animation, the head entity does not move according to the animation. here is code:

Code:
 

function me_die()
{
var die_percentage = 0;
while (die_percentage >= 0) // death_percentage will range from 0 to 100 here
{
ent_animate(my, "DeathA", die_percentage, 0); // "death" one-shot animation
die_percentage += 5 * time; // 3 = animation speed for "death"
wait (1);
}
}

function handle_hit_me()
{
if (you.skill1 == 4)
{
effect(blood_cloud1,cloud_number,target.x,nullvector);
my.skill20 -= 10;
effect(blood_dropsspezial,blood_dropsAnzahlPartikel,target.x,nullvector);
if (my.skill20 <= 0)
{
me_die();
my.passable = on;
}
}
}

function hit_head()
{
var target_look;
var target_ver;
my.passable = on;
while(you)
{
vec_for_vertex (target_ver, you, 240);
vec_for_vertex (my.x, you, 239);
vec_sub(target_ver,my.x);
vec_to_angle(my.pan,target_ver); // now MY looks at YOU
wait(1);
}
}

action dummy
{
my.enable_impact = on;
my.event = handle_hit_me;
my.skill96 = 1;
my.skill20 = 100;
ent_create(headhitbox,my.x,hit_head);
main_ai();
}




The code is very experimental at the moment and is not meant to be tidy. What I want to know, how do I make it align to animation? I know this is possible, it is mentioned in the vattach file which I downloaded when I first found that it didn't work, only to find it used the same concept.

Re: vec_for_vertex and animation [Re: vartan_s] #128475
05/07/07 16:04
05/07/07 16:04
Joined: Oct 2003
Posts: 702
Z
zazang Offline
User
zazang  Offline
User
Z

Joined: Oct 2003
Posts: 702
I couldn't check the full code but it seems you are initialising death_percentage to 0 and in the while loop u have >= 0...so it could be exiting without executing your loop.I think you need a <= 100 in the loop.

Re: vec_for_vertex and animation [Re: vartan_s] #128476
05/07/07 16:10
05/07/07 16:10
Joined: Oct 2003
Posts: 702
Z
zazang Offline
User
zazang  Offline
User
Z

Joined: Oct 2003
Posts: 702
sorry double post

Re: vec_for_vertex and animation [Re: zazang] #128477
05/07/07 16:11
05/07/07 16:11
Joined: Apr 2006
Posts: 265
V
vartan_s Offline OP
Member
vartan_s  Offline OP
Member
V

Joined: Apr 2006
Posts: 265
It does execute the loop and the animation plays. (what you said just means die_percentage plays forever ). But I fixed that, and it doesn't fix my problem. The entity animates, and thus the position of the vertex must change based on this must change. But the hitbox doesn't move accordingly, so the animation is not altering the vertex position as it should.

Re: vec_for_vertex and animation [Re: vartan_s] #128478
05/07/07 16:25
05/07/07 16:25
Joined: Oct 2003
Posts: 702
Z
zazang Offline
User
zazang  Offline
User
Z

Joined: Oct 2003
Posts: 702
oh indeed I screwed the expressions ..maybe your main_ai or any function that it calls has a proc_kill somehwhere ?


I like good 'views' because they have no 'strings' attached..
Re: vec_for_vertex and animation [Re: zazang] #128479
05/07/07 16:40
05/07/07 16:40
Joined: Apr 2006
Posts: 265
V
vartan_s Offline OP
Member
vartan_s  Offline OP
Member
V

Joined: Apr 2006
Posts: 265
Nope no proc_kill. All it does, is index the AI (so it can be "seen" by enemies), and turning it to look towards enemies. In any case, commenting it out didn't help.

Re: vec_for_vertex and animation [Re: vartan_s] #128480
05/08/07 02:20
05/08/07 02:20
Joined: Oct 2003
Posts: 702
Z
zazang Offline
User
zazang  Offline
User
Z

Joined: Oct 2003
Posts: 702
Are the vertex 239,240 on the head of the main entity and do they
animate along with the head when it dies ?
Also,try testing if the hitbox entity's while loop is
playing or not when the main entity dies.

Re: vec_for_vertex and animation [Re: zazang] #128481
05/08/07 09:17
05/08/07 09:17
Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
Captain_Kiyaku Offline

Dichotomic
Captain_Kiyaku  Offline

Dichotomic

Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
i had problems with the "you" pointer yesterday too.

What happens if you write this:


function hit_head()
{
var target_look;
var target_ver;
my.passable = on;
my.skill1 = handle(you);
while(ptr_for_handle(my.skill1))

{
vec_for_vertex (target_ver, you, 240);
vec_for_vertex (my.x, you, 239);
vec_sub(target_ver,my.x);
vec_to_angle(my.pan,target_ver); // now MY looks at YOU
wait(1);
}
}

action dummy
{
my.enable_impact = on;
my.event = handle_hit_me;
my.skill96 = 1;
my.skill20 = 100;
ent_create(headhitbox,my.x,hit_head);
main_ai();
}

not sure if i wrote it correct


My Blog

"Tag und Nacht schrei ich mich heiser,
Wind weht alle Worte fort,
Tag und Nacht schrei ich mein Krähenwort!"

Subway To Sally - Krähenkönig
Re: vec_for_vertex and animation [Re: Captain_Kiyaku] #128482
05/08/07 10:53
05/08/07 10:53
Joined: Oct 2003
Posts: 702
Z
zazang Offline
User
zazang  Offline
User
Z

Joined: Oct 2003
Posts: 702
If you are trying Kikahu's code then also it will need a replacement for "you" (skill1 converted to entity pointer) within the while loop in these lines :-

vec_for_vertex (target_ver,you,240);
vec_for_vertex (my.x,you,239);

Re: vec_for_vertex and animation [Re: zazang] #128483
05/08/07 10:55
05/08/07 10:55
Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
Captain_Kiyaku Offline

Dichotomic
Captain_Kiyaku  Offline

Dichotomic

Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
oh yeah, you are right, totally forgot about this part.

so just replace the "you" in the while with "ptr_for_handle(my.skill1)"

or simply right in the beginning of the while "you = ptr_for_handle(my.skill1)", should work too


My Blog

"Tag und Nacht schrei ich mich heiser,
Wind weht alle Worte fort,
Tag und Nacht schrei ich mein Krähenwort!"

Subway To Sally - Krähenkönig
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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