TheLordofNyrin Posted December 3, 2016 Share Posted December 3, 2016 Hello everyone! I have been trying to get this script to work for some time and It is beyond me why it continues to have runtime errors or fails to compile. I have made a script that fires when the player is struck by another actor, the script is tied to the player character using an activemagiceffect so that is not the problem. the problem is that the OnHit event is not passing the value of akaggressor to a Actor type variable that can be used later in the script. I need to be able to find the baseactor of akaggressor so i can test to see what its race is or if it has specific keywords. The point of this script is to make different things happen depending on what type of creature it was that hit the player. such as if it is a wolf it does X and if its a skeleton it does Y and if its an NPC it does Z and so on. but as it is right now, I can't get it to test to see what the base actor is of akaggressor so i can check what race it is, what keywords it has and so on. I really need help on this b/c I cannot figure out what is wrong. I posted the full script below in its current state in a pastebin. http://pastebin.com/8G3Tfrkm My papyrus log is pasted below for when the script compiled but had runtime errors. http://pastebin.com/MiPpeKXv i will be checking back here regularly to see what anyone has suggested or said. Link to comment Share on other sites More sharing options...
mrpwn Posted December 3, 2016 Share Posted December 3, 2016 (edited) I got the following two errors when trying to compile the script source you posted: H:\Mod Organizer\Skyrim\overwrite\Scripts\Source\ChocolateHitEffectScript.psc(83,22): GetLeveledActorBase is not a function or does not existH:\Mod Organizer\Skyrim\overwrite\Scripts\Source\ChocolateHitEffectScript.psc(83,44): cannot cast a none to a actor, types are incompatible You are trying to call GetLeveledActorBase on an ObjectReference. You would need to cast akAggressor as an Actor: Target = (akAggressor as Actor).GetLeveledActorBase() However, you still have the problem of Target having been declared as an Actor variable while GetLeveledActorBase returns an ActorBase value. The script compiles just fine with the following substitution: Target = akAggressor as Actor Edited December 3, 2016 by mrpwn Link to comment Share on other sites More sharing options...
TheLordofNyrin Posted December 4, 2016 Author Share Posted December 4, 2016 (edited) thank you for the advice. i will try to implement those two suggestions into my code before i run off to work tomarrow. in a previous version of the script where it did compile it instead had runtime errors that caused the script to stop working in-game. ill post my results once i try and test the methods you suggested. Edited December 4, 2016 by TheLordofNyrin Link to comment Share on other sites More sharing options...
Recommended Posts