Donutfiend84 Posted July 4, 2012 Share Posted July 4, 2012 I'm writing a fairly simple script, and adding it to some bandits. Currently I set a function to trigger OnCombatStateChanged. From here, I need to get a reference to the object that called this function. Basically, which ever actor just changed states and triggered it. It feels like this should be easy to do, but I can't seem to figure out how. Is there anything similar to a 'This' keyword, or a way to get the Actor through an event object? (event.getInstigator() or the like?) Link to comment Share on other sites More sharing options...
Donutfiend84 Posted July 5, 2012 Author Share Posted July 5, 2012 Let me be a bit more specific. Here is a section of code that sums up what I am trying to do. This script will be attached in the creation kit, to a series of bandits. Scriptname AlertPlayerOfCombat extends Actor { } Event OnCombatStateChanged(Actor akTarget, int aeCombatState) if (akTarget == Game.GetPlayer()) if (aeCombatState == 1) Actor instigator = <Get a reference to the specific bandit's actor here> endIf endIf endEvent Link to comment Share on other sites More sharing options...
gasti89 Posted July 5, 2012 Share Posted July 5, 2012 If i understand well, the script is attached to the bandit. And you want the one who changed is state to do something? Since the script is attached to the one changing combat state, what about using "self"? Link to comment Share on other sites More sharing options...
Donutfiend84 Posted July 5, 2012 Author Share Posted July 5, 2012 If i understand well, the script is attached to the bandit. And you want the one who changed is state to do something? Since the script is attached to the one changing combat state, what about using "self"? Thanks a ton, that is exactly what I was looking for. I did not even realize that was a keyword. When 'this' didn't work I was crawling through the documentation of get functions, looking for how to get a reference. Somehow dodged that crucial bit of info through some 5 or 6 tutorials too. Nonetheless, thanks again. Link to comment Share on other sites More sharing options...
gasti89 Posted July 5, 2012 Share Posted July 5, 2012 As a quest designer i know how it feels :P I set up 15 stages and make every stage do a little thing of what i need, 1 hour of modding. Then i discover a papyrus function that does everything :D Link to comment Share on other sites More sharing options...
Recommended Posts