Serious Sam Fusion 2017 (beta)

Serious Sam Fusion 2017 (beta)

Custom maps, mods, skins & campaigns
Discover and download custom maps, character skins, weapon modifications, skins, enemy modifications, campaign mods, and much more.
GetKillerWeapon()
Hello!

I have an issue, can't figure out how to make GetKillerWeapon() function to work. It listed in F1 functions list and as i can see it must be used in CDiedEvent.
Something like monster:GetKillerWeapon().

Strangely to me monster:GetKiller() works perfectly, unlike this one.

Also strange when i hover my cursor over it, there is no description shown, in comparison with GetKiller(). And in F1 description instead of "Handle<CBaseEntity>" only thing i see for this function is IDENT.

Is this function even working and if it is what am i doing wrong?

Thank you in advance!
Last edited by ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥; 20 Aug, 2024 @ 2:09pm
< >
Showing 1-5 of 5 comments
Ryason55 29 20 Aug, 2024 @ 7:17pm 
This is a function from an event payload. Certain events return a payload, so in this case the Died event returns a payload of type "CDiedScriptEvent", which has information about the event that you can access by using its functions.

For RunHandleds, it'd be like this:

On(Event(Monster.Died)), function(DiedEvent) local KillerWeapon = DiedEvent:GetKillerWeapon() --Do stuff end

And for Waits:

local DiedEvent = Wait(Event(Monster.Died)) local KillerWeapon = DiedEvent:GetKillerWeapon()
Thank you!

I didnt know this. Where to find more information about Fusion editor native functions?

But anyway, it seems to be working as i can get weapon from event, as condition "weapon ~= nill", where "weapon" is GetKillerWeapon, is met. But in more trivial function i has wierd. at least for me error. As when i try to weapon:GetParams():GetFileName(), the following error is displayed: "attempt to call method 'GetParams' (a nil value)". This is odd to me because the "GetParams()" action is inside the condition which checks is weapon != nil.

Did i missed something?
Well, i get it the problem why i cant get Params was because "GetKillerWeapon()" And "GetInflictorWeapon()" return weapon index, unlike, as i can understand, "GetRightHandWeapon()". And also, sadly if weapon done by scripts, like Weapon Engine, there is no tie between it and its projectile and index is always "-1" as with monsters weapon.

Anyway thank you for the help.
Ryason55 29 22 Aug, 2024 @ 10:25pm 
You can get the weapon params via:

worldInfo:GetWeaponParamsForIndex(Index)

Though yeah, when spawning projectiles via script, you cannot assign a weapon at all. You *can* assign a weapon when doing damage directly via script, just you have to do the extra step of figuring out what weapon index the weapon was assigned to via a player, with:

Player:GetWeaponIndex(WeaponParams)

Not sure if Kuber ever did it, but I've done it for the custom hitscan hits for my Quake weapons.
Ironically enough i studied your code for QWP just yesterday, but for now its look like to me what only Carmack could do. I really like how complicated your system is.

And when i studied it, after abandoning the idea with monster hit tracking for scripted weapons, my eyes catch that part with weapon indexing. Sadly its only for hitscan, sa you said, but in my case i tried to achive one for projectile based weapons.
< >
Showing 1-5 of 5 comments
Per page: 1530 50