Halstrom Posted March 8, 2018 Share Posted March 8, 2018 I just want to know when the player kills something what it was, human/robot/creature etc. It seems OnKill does not compile unless I make my quest script native which screws up 90% of the script :tongue: Any ideas without adding it to the player Actor? Link to comment Share on other sites More sharing options...
FlashyJoer Posted March 8, 2018 Share Posted March 8, 2018 If your hostiles are attached to a ref alias, you can attach a script to them there with an onDying or OnDeath Event where akKiller == PlayerREF. Event OnDeath(actor akKiller)If akKiller == PlayerREF...EndifEndEvent as an example. Link to comment Share on other sites More sharing options...
Halstrom Posted March 8, 2018 Author Share Posted March 8, 2018 If your hostiles are attached to a ref alias, you can attach a script to them there with an onDying or OnDeath Event where akKiller == PlayerREF. Event OnDeath(actor akKiller) If akKiller == PlayerREF ... Endif EndEvent as an example.Woldn't it be simoler to use OnKill Event in a script on the player, although that means a dirty edit on the player, better than doing a dirty edit on every other actor in the game? Link to comment Share on other sites More sharing options...
FlashyJoer Posted March 8, 2018 Share Posted March 8, 2018 (edited) If your hostiles are attached to a ref alias, you can attach a script to them there with an onDying or OnDeath Event where akKiller == PlayerREF. Event OnDeath(actor akKiller)If akKiller == PlayerREF...EndifEndEvent as an example.Woldn't it be simoler to use OnKill Event in a script on the player, although that means a dirty edit on the player, better than doing a dirty edit on every other actor in the game? But you arent editting anything if you are using a quest with a reference alias fill for that hostile. But if you are talking non-quest related, every day running around in the Commonwealth, then yeah, there are going to be some issues with that. But I suppose you could define some script properties relating to your intended trackable target types, say ActorTypeSynth and then say: Event OnKill(Actor akVictim)If akVictim.HasKeyword(ActorTypeSynth)...EndifEndEvent If this is applied on a script attached to a reference alias pointing to Unique Actor - Player, then the killer should be the player always and it will track via the event WHO the player killed and then in this way, you can define it via keywords or factions. In theory. Edited March 8, 2018 by joerqc Link to comment Share on other sites More sharing options...
Halstrom Posted March 8, 2018 Author Share Posted March 8, 2018 If your hostiles are attached to a ref alias, you can attach a script to them there with an onDying or OnDeath Event where akKiller == PlayerREF. Event OnDeath(actor akKiller) If akKiller == PlayerREF ... Endif EndEvent as an example.Woldn't it be simoler to use OnKill Event in a script on the player, although that means a dirty edit on the player, better than doing a dirty edit on every other actor in the game? But you arent editting anything if you are using a quest with a reference alias fill for that hostile. But if you are talking non-quest related, every day running around in the Commonwealth, then yeah, there are going to be some issues with that. But I suppose you could define some script properties relating to your intended trackable target types, say ActorTypeSynth and then say: Event OnKill(Actor akVictim) If akVictim.HasKeyword(ActorTypeSynth) ... Endif EndEvent If this is applied on a script attached to a reference alias pointing to Unique Actor - Player, then the killer should be the player always and it will track via the event WHO the player killed and then in this way, you can define it via keywords or factions. In theory. Interesting but still can't use the OnKill in any other scripts except actors :tongue: I've got the same issue trying to detect the player swimming with Event PlayerIsSwimming(), it seems I have to put a script in the player which is a dirty edit but there seems to be no other reasonable option. Link to comment Share on other sites More sharing options...
kitcat81 Posted March 8, 2018 Share Posted March 8, 2018 If your hostiles are attached to a ref alias, you can attach a script to them there with an onDying or OnDeath Event where akKiller == PlayerREF. Event OnDeath(actor akKiller)If akKiller == PlayerREF...EndifEndEvent as an example.Woldn't it be simoler to use OnKill Event in a script on the player, although that means a dirty edit on the player, better than doing a dirty edit on every other actor in the game? But you arent editting anything if you are using a quest with a reference alias fill for that hostile. But if you are talking non-quest related, every day running around in the Commonwealth, then yeah, there are going to be some issues with that. But I suppose you could define some script properties relating to your intended trackable target types, say ActorTypeSynth and then say: Event OnKill(Actor akVictim)If akVictim.HasKeyword(ActorTypeSynth)...EndifEndEvent If this is applied on a script attached to a reference alias pointing to Unique Actor - Player, then the killer should be the player always and it will track via the event WHO the player killed and then in this way, you can define it via keywords or factions. In theory. Interesting but still can't use the OnKill in any other scripts except actors :tongue:I've got the same issue trying to detect the player swimming with Event PlayerIsSwimming(), it seems I have to put a script in the player which is a dirty edit but there seems to be no other reasonable option. You don't really need any dirty edits. You can create a reference alias, create a script for the alias and force the alias to player. Alternatively, you can create a constant spell or ability with a script attached to your magic effect and cast this effect on player. Another way is to register your quest script to recieve remote events from player. (RegisterForRemoteEvent).Even OnKill can be used in reference Alias Script and the CK does not ask you to set it to native. Magic effects might work the same.Also you can recieve it in another script (i.e. quest script) as a remote event and in this case it also won't ask you to set it to native. Event OnInit() RegisterForRemoteEvent(Game.GetPlayer(), "OnKill") EndEvent Event Actor.OnKill(Actor AkSender, Actor akVictim) ;do my thing endEvent Link to comment Share on other sites More sharing options...
SKKmods Posted March 8, 2018 Share Posted March 8, 2018 As a hand rolling all my own scripts person I struggled endlessly with the concept and utility of quests and their aliases when I wasn't actually creating formal quest content per say. To underline Kitkat's words: whenever you are tempted to attach a script directly to a base game form or object: DON'T it is totally dirty, conflict prone and unsupportable. Create a quest alias (or collection for multiple same types), attach the script to the quest alias and point it at the object: player, NPC, trigger whatever. Exception is stuff you create or populate in the world yourself (typically magic effects and activator triggers). If they are unique to you then you can attach scripts directly. Maintaining script fragment properties floating around the world is PITA though. Link to comment Share on other sites More sharing options...
Halstrom Posted March 8, 2018 Author Share Posted March 8, 2018 (edited) You don't really need any dirty edits. You can create a reference alias, create a script for the alias and force the alias to player. Alternatively, you can create a constant spell or ability with a script attached to your magic effect and cast this effect on player. Another way is to register your quest script to recieve remote events from player. (RegisterForRemoteEvent). Even OnKill can be used in reference Alias Script and the CK does not ask you to set it to native. Magic effects might work the same. Also you can recieve it in another script (i.e. quest script) as a remote event and in this case it also won't ask you to set it to native.Awesome, that did the trick. I had tried RegisterForRemoteEvent but it didn't seem to work for OnKill, FailPickPocket or IsSwimming. I never played with this Alias Voodoo before, its probably what the others were trying to explain to me, I think I just levelled up in CK! Thanks a million internet cookies :smile: So what ater the cons of moving all my 8 scripts into the Alias instead of the quest? Edited March 8, 2018 by Halstrom Link to comment Share on other sites More sharing options...
Recommended Posts