New idea for hook FX
-
I did a short test with
[fuse] name = test_fuse lifetime = 5 death_fuse = false [start_effect] effect = gf_no_largeengine02 hardpoint = HpMount at_t = 0.000000 attached = true ```and
void UserCmd_testfuse(uint iClientID, wstring wscParam)
{
uint iShip;
pub::Player::GetShip(iClientID, iShip);
pub::SpaceObj::LightFuse(iShip, “test_fuse”, 0.000000f);
}And it worked. The last parameter seems to be the delay after which it is triggered.
-
Yes I noticed that too, I have one Idea but I have to try it first.
-
i tryed it with one of ower ftl jumps it was amazing lol
it take fl into a new dimension lol
basically i jumped from one point to another got the fx to kick in at both points and it was nice lol sound and fx all worked
it was in the same system as well
dunno why it stops working its a pain in the ass
so basically i got 2 to activate but then its stopped -
Hey guys… looks great… ;D
Even though i have no idea how to do this stuff myself… i do have an “idea”…If were calling fuses… How’s about a proper Self destruct Sequence…
now that… is an aplication i can clearly see for this find guys… and would be another
great leap forward for FL … call me crazy (cuz i am lol)… but i just cant shake the thought of
initiating a SDS and waiting whilst she countsdown… for the “fireworks”… hehe…Great stuff guys
-
The problem with the fuses is that you have to unburn them in order to use them again, but so far I’m not seeing a way to get a reference to the exact fuse you lit using the LightFuse command. If there’s some way to get the Fuse object back, then I believe it’d be a simple matter of calling the Fuse::Unburn function.
Any thoughts on how to get that reference?
-
Yes that is the problem, I didn’t have time yet, but my approach would have been to load the fuse using the class (found in common.h), then rename it, then trigger it using the spaceobj::lightfuse method and after that reset it. I have no Idea whether this approach would actually work and I don’t think I will have time to test it any time soon due to stuff I have to do for university.
-
But the question then is how do you load the fuse using the Fuse or FuseAction class?
I know it’s possible within the engine, as you can get your ship to burn, use a nanobot, then get it to burn again (I tested it yesterday just to be sure) So the engine supports burning, unburning, and reburning. Now we just have to get a handle on the Fuse object…
The only constructors for the Fuse take (ID_String &, float) or (Fuse) so only the first one is actually useful to us, just gotta figure out how the ID_String can reference the ship/fuse/whatever else it could be, and what the float means -
Looking through the flhookSDK, I noticed in the FLCoreCommon.h file, there’s a class called FuseIgnitionList, but it was never defined… judging from the name, it could possibly be used to store the lit fuses which would be useful for us to unburn them so they can be relit. Unfortunately, since the class was never created, I don’t know what kind of information it stores nor how to access it.
-
I finally got around to looking into the problem. The solution was to call the function to unburn the fuse; it was immediately below the function for lighting it in the VFT.
Here are the two new helper functions I wrote for activating/deactivating fuses.
__declspec(naked) bool __stdcall HkLightFuse(IObjRW *ship, uint iFuseID, float fDelay, float fLifetime, float fSkip) { __asm { lea eax, [esp+8] //iFuseID push [esp+20] //fSkip push [esp+16] //fDelay push 0 //SUBOBJ_ID_NONE push eax push [esp+32] //fLifetime mov ecx, [esp+24] mov eax, [ecx] call [eax+0x1E4] ret 20 } } //Returns true if a fuse was unlit __declspec(naked) bool __stdcall HkUnLightFuse(IObjRW *ship, uint iFuseID, float fDunno) { __asm { mov ecx, [esp+4] lea eax, [esp+8] //iFuseID push [esp+12] //fDunno push 0 //SUBOBJ_ID_NONE push eax //iFuseID mov eax, [ecx] call [eax+0x1E8] ret 12 } } ```HkUnLightFuse only seems to work with the unknown float set to 0\. It's passed on to the Fuse::Unburn function as the second float parameter. The ship parameter in both of the functions can be obtained by calling the GetIObjRW function.
#define ADDR_SRV_GETIOBJRW 0x20670 // 06D00670
typedef IObjRW * (__cdecl *_GetIObjRW)(uint iShip);I'm not entirely sure the float parameters for HkLightFuse are correct. If in doubt on what to put, HkLightFuse(IObjRW *ship, uint iFuseID, 0, 0, -1) should work (it's what's used by pub::SpaceObj::LightFuse). Also, here are the declarations of the functions being called by HkLightFuse and HkUnLightFuse, respectively.
bool __thiscall IObjRW::LightFuse(float fLifetime, uint &iFuseID, ushort iSubObj, float fDelay, float fSkip)
bool __thiscall IObjRW::UnLightFuse(uint &iFuseID, ushort iSubObj, float fDunno) -
That’s GREAT M0tah, well done!
Now we can use server-side programming to create extremely nice effects
And could the float be a timing? Maybe a delay before the fuse gets “unlit”?