Attaching fx to player in open world?

[V] IdolNinja

Volition Staff
Many missions use a function that attaches fx to a part of the player's body. For example, in m24 Gangstas in Space, it is called when a homie dies and attaches a blood fx to their head as if they got sniped:
Code:
effect_play_on_human( "Effect BloodHit", homie, "Head" )

In deckers.die we have this:
Code:
m16_vfx_spawn = "Vfx Cyberspace Spawn"
effect_play_on_human(m16_vfx_spawn, LOCAL_PLAYER)

I have been able to successfully duplicate these fx for the player at will using Sandbox+ to call this function in the mission itself, but not in the open world. This seems to indicate that the actual fx that is being referenced in misc_tables.vpp_pc/effects.xtbl is part of the mission files and being loaded that way.

So, my question is: How do I preload the fx files that are referenced in effects.xtbl so that I can proc them in the open world using that function?

In case you're curious, I want to be able to attach fire fx to the player's head so that I can run around as Ghost Rider while wearing the skull mask. :D
 
This doesn't answer your question but at least I can sorta confirm your suspicions. The strings referenced in mission scripts aren't the actual VFX, but are instead the names of VFX nodes created in the CTG editor that then reference the VFX name found in the table. This node can then be exported as a navpoint for other purposes or even be left to always play while in the mission. Additionally, if a VFX isn't in always-loaded (AL), it's added to the mission resources in the editor, which actually takes the VFX name found in the table.

I wouldn't be surprised if there was a fire VFX already in the AL, however. I believe explosions (that have their own dedicated table) are in the AL. I doubt that's useful but if an explosion is in the AL it stands to reason the VFX for it is as well. (I could be wrong!)
 
Ah, that makes perfect sense. The reason it wasn't working in the open world is that it was trying to reference a navpoint that doesn't actually exist outside the mission. So, the new question is: Is there an alternate way to approach this in the open world? i.e. is there another function that attaches fx to objects like the LOCAL_PLAYER (and hopefully specific parts?)

For example, I can use explosion_create() and attach them to the character, but that's only for explosion table entries, and not fx. For example:
Code:
explosion_create("Ammo - Incendiary", LOCAL_PLAYER)

If I create a thread that keeps looping with a short delay that will actually proc flaming footprints to the character's position. The problem with this function is that I'm limited to only the explosion fx, and that I can't specify body parts.
 
If you can play always loaded effects now, I would think it is just a matter of getting the effect you want added to the AL. This would require putting the str2 into the preload effect packfile and moving the asm data from effects to the preload effects. I would also change the effects table to say that effect is preloaded just so the game didn't get too confused. All of this would require enough slush space in the effects preload mempool though. I'm not sure how much was shipped, but traditionally we keep the effects preload mempool pretty tight. On the other hand, we traditionally try to keep the PC mempools pretty big. Not sure which side won there. :)
 
I looked into this a little more and we don't have an interface for lua that doesn't require a navpoint to get the effect handle into the game. We do this so that the effect is properly packaged with the zone that requires the effect. We could possibly add an interface to pass the handle it to play, but then it would put the data requirement on you for getting it loaded.

With the base game, I would expect you could move a navpoint object into the AL or possibly create your own. This wouldn't be 100% straight forward though since the object handle would need to be unique. From there, you'd put the effect into the preload and that should be it.
 
Back
Top