Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there any way to attach particle effects to enemy's animation?
DarkPearStudios Offline
Junior Member

Posts: 34
Threads: 5
Joined: Aug 2014
Reputation: 0
#1
Is there any way to attach particle effects to enemy's animation?

Hello everyone!

So, I want to know if is there a way to attach a particle effect to an enemy animation. More specifically, the attack animation.

And if there's a way to delay the particle effect. Explaining better, when the animation starts, it takes like 0,5 seconds to the attack really happen, so I want to know if there is a way to delay the particle effect and that it just spawn in the right time.

Thanks!

Gabriel.
09-12-2015, 12:24 AM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#2
RE: Is there any way to attach particle effects to enemy's animation?

I don't think so. You can attach a particle to the enemy directly, but it doesn't update with the enemy's movement later on, making it look completely awful. You can try to experiment with it if you wish, but if you attach it directly, it's gonna stay there forever with the enemy.

Derp.
(This post was last modified: 09-12-2015, 01:08 AM by Neelke.)
09-12-2015, 01:08 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#3
RE: Is there any way to attach particle effects to enemy's animation?

Is the animation needing to happen when it hurts the player? Or regardless of whether it touches the player or not? If that's the case, you might be able to make something happen with AddEntityCollideCallbacks, but as Neelke above me states, attaching the particle doesn't update with movement.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
09-12-2015, 01:50 AM
Find
DarkPearStudios Offline
Junior Member

Posts: 34
Threads: 5
Joined: Aug 2014
Reputation: 0
#4
RE: Is there any way to attach particle effects to enemy's animation?

Well... The particle should spawn every time that the attack animation plays for hurt the player. Example: You're being chased and the enemy gets near you and then he hurts you. The particle should spawn when the enemy hurts you.
09-12-2015, 02:31 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#5
RE: Is there any way to attach particle effects to enemy's animation?

I threw this together in about 10 minutes. It may or may not work; it is untested, but it gives you a general idea of what I would do if it does work.

PHP Code: (Select All)
//Make sure to read over this code. I didn't test it, so there is probably mistakes.
//Furthermore, never copy+paste code unless you're sure what it does.
//I put some internal documentation if it helps you understand what is going on~
//Feel free to remove it later.

void OnStart()
{
    
AddEntityCollideCallback("Player""servant_grunt_x""check_collide"true0);     //Change enemy name. Cannot be (*).
}

void check_collide(string &in asParentstring &in asChildint alState)
{
    
RemoveCallback(asParentasChild);                            //Stop checking constantly. Comment it out if nothing is working.
    
if(GetPlayerHealth() <> GetLocalVarFloat("player_health")    //Checks if Player health does not equal placeholder float.
    
{
        
SetLocalVarFloat("player_health"GetPlayerHealth());    //Sets placeholder float to the same value as Player's health.
    
}                                                            //It's unlikely that the player will hurt themself
    
AddTimer("anim_trigger"1.0f"play_animation");            //Other than from an enemy in 1 second. Change timer 
}                                                                //if you need it earlier/later.

void play_animation(string &in asTimer)
{
    if(
GetPlayerHealth GetLocalVarFloat("player_health"))        
    {
        
//Run all your CreateParticleSystemAtEntity and anything else here~
        //It will only run this if the Player's health is lower than what it was earlier.
        //Then will run through to re-adding the CollideCallback and resetting the Float.
    
}
    
AddEntityCollideCallback("Player""servant_grunt_x""check_collide"true0);    //Change enemy name.
    
SetLocalVarFloat("player_health"GetPlayerHealth());                                //Comment out Callback if RemoveTimer is also.


Discord: Romulator#0001
[Image: 3f6f01a904.png]
09-12-2015, 03:25 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#6
RE: Is there any way to attach particle effects to enemy's animation?

Humm I actually did this with a monster of mine, you can attach particles to the monster bones, and the particles will move along with it, as far as I know. Dunno if this is what you are currently searching, I hope I helped tho Smile

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
09-12-2015, 02:52 PM
Find
Traggey Offline
is mildly amused

Posts: 3,257
Threads: 74
Joined: Feb 2012
Reputation: 185
#7
RE: Is there any way to attach particle effects to enemy's animation?

This belongs in the development support forum, I have moved the thread.
09-12-2015, 03:26 PM
Find
DarkPearStudios Offline
Junior Member

Posts: 34
Threads: 5
Joined: Aug 2014
Reputation: 0
#8
RE: Is there any way to attach particle effects to enemy's animation?

(09-12-2015, 03:25 AM)Romulator Wrote: I threw this together in about 10 minutes. It may or may not work; it is untested, but it gives you a general idea of what I would do if it does work.

PHP Code: (Select All)
//Make sure to read over this code. I didn't test it, so there is probably mistakes.
//Furthermore, never copy+paste code unless you're sure what it does.
//I put some internal documentation if it helps you understand what is going on~
//Feel free to remove it later.

void OnStart()
{
    
AddEntityCollideCallback("Player""servant_grunt_x""check_collide"true0);     //Change enemy name. Cannot be (*).
}

void check_collide(string &in asParentstring &in asChildint alState)
{
    
RemoveCallback(asParentasChild);                            //Stop checking constantly. Comment it out if nothing is working.
    
if(GetPlayerHealth() <> GetLocalVarFloat("player_health")    //Checks if Player health does not equal placeholder float.
    
{
        
SetLocalVarFloat("player_health"GetPlayerHealth());    //Sets placeholder float to the same value as Player's health.
    
}                                                            //It's unlikely that the player will hurt themself
    
AddTimer("anim_trigger"1.0f"play_animation");            //Other than from an enemy in 1 second. Change timer 
}                                                                //if you need it earlier/later.

void play_animation(string &in asTimer)
{
    if(
GetPlayerHealth GetLocalVarFloat("player_health"))        
    {
        
//Run all your CreateParticleSystemAtEntity and anything else here~
        //It will only run this if the Player's health is lower than what it was earlier.
        //Then will run through to re-adding the CollideCallback and resetting the Float.
    
}
    
AddEntityCollideCallback("Player""servant_grunt_x""check_collide"true0);    //Change enemy name.
    
SetLocalVarFloat("player_health"GetPlayerHealth());                                //Comment out Callback if RemoveTimer is also.



Hi,

Thanks for this code. I will send this code to the programmer of the mod that I'm working.
The mod is Subconscientia, If you want to take a look. Then he sees if it works. Although I don't think that my idea would be possible without modifying the engine.

(09-12-2015, 02:52 PM)The chaser Wrote: Humm I actually did this with a monster of mine, you can attach particles to the monster bones, and the particles will move along with it, as far as I know. Dunno if this is what you are currently searching, I hope I helped tho Smile

Hello.

I don't think that attaching the particle to the bones would work. I was trying to do this with the pigs, to make them vomit instead of the common attack animation (I wrote attack animation for the people undestand.) but the vomit animation is not helping. I know how to make a "scene" with the pig vomiting, but to make this as an attack... I think it's not possible.

I have been in a LONG conversation with Peter Howeel, the co-designer of AAMFP, to talk about the development of Pigs and changes made during it. ( he explained some changes) and I asked him about attaching the particles to the pigs and this was his answer:

"The particles being attached to the pig animations was hardcoded into the engine, so it isn't accessible through script. I'm not a programmer so I don't know the technicalities of it I'm afraid! Smile"

But I will see what I can do. But thanks for your reply!
(This post was last modified: 09-13-2015, 12:53 AM by DarkPearStudios.)
09-13-2015, 12:44 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#9
RE: Is there any way to attach particle effects to enemy's animation?

No problem. Feel free to PM me later if you need help with other stuff, or of course, make a forum post. Most, if not all of us would be glad to help Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
09-13-2015, 01:32 AM
Find




Users browsing this thread: 1 Guest(s)