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


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Particle System help
Author Message
Anxt Offline
Senior Member

Posts: 588
Joined: Mar 2011
Reputation: 10
Post: #1
Particle System help

Hi, new to these forums, sorry if I am making a duplicate thread here, but I couldn't find a solution to the specific problem I am having with particle systems.

I have been attempting to add particle effects to my map when a particular action is taken (in this case, using an item on an entity). I have:

CreateParticleSystemAtEntity("E1PS", "ps_orb_light_core.ps", "PSE1", true);

I know my names are meaningless, but its exactly how it is worded in my code, maybe there's a typo I don't see.

Yet upon using the action, no particle effects are generated. I have preloaded the one I want, and I have the Create function inside the function that is called when the player uses the item.

Anyone know why it isn't being created? I have tried other methods as well, such as generating a PS inside a script area, but that failed as well.

Thanks in advance for the help.

P.S.(no pun intended Smile) I have also noticed that if I place a particle system in a map, and set it to inactive inside the level editor, it remains active when in the game. Why is that?

03-04-2011 08:23 PM
Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,085
Joined: Mar 2009
Reputation: 67
Post: #2
RE: Particle System help

Can you provide more code?

Plus, is PSE1 an entity? I mean, if it's a script area, is this the name of the area?

03-04-2011 08:40 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Anxt Offline
Senior Member

Posts: 588
Joined: Mar 2011
Reputation: 10
Post: #3
RE: Particle System help

void ActivateEagle1(string &in asItem, string &in asEntity)
{
SetEntityActive("BlueShardStatic1", true);
SetEntityInteractionDisabled(asEntity, true);
SetEntityInteractionDisabled("BlueShardStatic1", true);
CreateParticleSystemAtEntity("E1PS", "ps_orb_light_core.ps", "PSEagle1", true);
SetLocalVarInt("B1", 1);
RemoveItem(asItem);
}

PreloadParticleSystem("ps_orb_light_core.ps");
^ is in my OnEnter function.
PSE1 is an entity that I shrank down to .001 in all dimensions so it would not be visible in game, but still provide an anchor for the PS. I was hoping it would work, since I couldn't get it to appear otherwise.

Basically what I want to happen is this:

The player has acquired a glowing blue shard of glass from an adjacent room to the one this code is for. Upon placing the shard on its pedestal, I want this particle system to appear at an eagle statue's mouth, which is where PSE1 is located. Does the size of the entity affect the appearance of the PS? Or is there something I am doing wrong? In case it matters, the particle system is not present in the level editor, since for some reason they remained active in game when I set them to inactive in the editor. All other parts of the function are working properly.

Sorry if I am not providing the right info, I am new to programming and this type of thing in general, so hopefully I'm not making a huge fool out of myself.

03-04-2011 09:08 PM
Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,085
Joined: Mar 2009
Reputation: 67
Post: #4
RE: Particle System help

Entity size doesn't affect anything, but you can use a Script Area which is not visible, also not an obstacle to the user. You can put it somewhere, where the particle can be seen.

03-04-2011 10:11 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Anxt Offline
Senior Member

Posts: 588
Joined: Mar 2011
Reputation: 10
Post: #5
RE: Particle System help

Well that's what I tried, and it didn't produce the particle system. It hasn't created the system I want regardless of whether I used an area or entity. I triple-checked to make sure the entity/area names were correct for the code, and I'm still not getting anything. I suppose I will keep trying.

03-04-2011 10:15 PM
Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,085
Joined: Mar 2009
Reputation: 67
Post: #6
RE: Particle System help

Don't put the .ps extension?

03-04-2011 10:23 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Anxt Offline
Senior Member

Posts: 588
Joined: Mar 2011
Reputation: 10
Post: #7
RE: Particle System help

Still didn't work, I just tried it.

03-04-2011 10:32 PM
Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,085
Joined: Mar 2009
Reputation: 67
Post: #8
RE: Particle System help

This is how Frictional uses it:
CreateParticleSystemAtEntity("Sparks", "ps_orb_room_rod_sparks.ps", "AreaRod2Effect", false);

03-05-2011 07:26 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Anxt Offline
Senior Member

Posts: 588
Joined: Mar 2011
Reputation: 10
Post: #9
RE: Particle System help

Yeah, and that's why I can't figure out why mine isn't working. I have tried using both areas and entities, both true and false for the bool abSavePS, and it still won't produce the effect.

Do I need to have the particle system present in the map for it to be created? I wouldn't think so, but I am all out of ideas.

Thanks for the help thus far, though.
I just built a small room for the sake of testing this out, and I managed to get the particle system to appear in my test room. I have no idea what is different though. For the test room I used a collide callback with one area, and set it to create the system at another area. The code I used is:

void OnStart()
{
AddEntityCollideCallback("Player", "PS1", "CreateCore", true, 1);
}

void CreateCore(string &in asParent, string &in asChild, int alState)
{
CreateParticleSystemAtEntity("Core", "ps_orb_light_core.ps", "PS2", true);
}

void OnEnter()
{

}

void OnLeave()
{

}


Any idea why this would work but trying to create the particle system inside of a use item function doesn't?

(This post was last modified: 03-06-2011 12:44 AM by Anxt.)
03-06-2011 12:19 AM
Find all posts by this user Quote this message in a reply
Anxt Offline
Senior Member

Posts: 588
Joined: Mar 2011
Reputation: 10
Post: #10
RE: Particle System help

Update:

I re-did the map and code to use an area as an anchor for the PS, and an area to activate the function to create the PS, however I had to go a long way around to get it to actually work, so I would still like to see if I can find a solution. Anyway, thanks a lot for the help, I really appreciate it Big Grin

03-06-2011 04:44 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)