closdumanoir Posted February 4, 2021 Share Posted February 4, 2021 Hi all, I'm tearing my hair out over this one! I am still very new to scripting and am trying to work on a script that uses the race of the actor that killed another actor as a condition. However, I cannot get the game to ever register the condition as true. I made a script to trouble shoot the issue as below: Race Property SabreCatRace AutoEvent OnDying(Actor akKiller)if akKiller.GetLeveledActorBase().GetRace() == SabreCatRaceDebug.trace("Killed by a SabreCat")elseDebug.trace("Killed by" + akKiller.GetLeveledActorBase().GetRace() + "!" )endifEndEvent The script works when the actor is killed but the debug trace returned the following in the log: Killed by[Race <SabreCatRace (00013200)>]! I have no idea why the first condition is not flagged as true. I'd be very grateful if someone could point out what I'm missing... Thanks Link to comment Share on other sites More sharing options...
anjenthedog Posted February 4, 2021 Share Posted February 4, 2021 welll... I'm no CK guru, but if you do a debug trace for SaberCatRace, does it produce the value "<SabreCatRace (00013200)>", which would allow the If-Then to branch to the true conditional ? That is, *maybe if akKiller.GetLeveledActorBase().GetRace() == SabreCatRace.GetRace() or something like that? Clearly, the non equivalence in the two sides of the test produces a logic 0 (false), or the desired behavior would have been effected. Since we know from your debug statement, what the result of the left side is, then the problem can only be on the right side. Right? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 4, 2021 Share Posted February 4, 2021 Did you assign the property with the correct race data? If not, papyrus sees the SabreCatRace variable with a null or none value. And that will always fail as an actor's race can never be none. Link to comment Share on other sites More sharing options...
closdumanoir Posted February 4, 2021 Author Share Posted February 4, 2021 Thanks very much for the replies but, unfortunately, I'm still stumped... Anjen, what you're saying makes a lot of sense but SabreCatRace.GetRace() throws up an error when compiling. Ishara, what do you mean by assigning the property with the correct race data? Is it enough to have included the line "Race Property SabreCatRace Auto" or is there something further I should be doing? Thanks Link to comment Share on other sites More sharing options...
anjenthedog Posted February 4, 2021 Share Posted February 4, 2021 yeah that psuedo code was just for illustrative purposes. I should have been more explicit that it was for that only. My point was what Isahra put more succinctly. Check the value of SabreCatRace to make sure it's defined (and then that it actually holds the same value you're getting from the other call) Sorry for any misdirect... back to lurker mode. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 5, 2021 Share Posted February 5, 2021 Ishara, what do you mean by assigning the property with the correct race data? Is it enough to have included the line "Race Property SabreCatRace Auto" or is there something further I should be doing? Having the property line on the script is not enough. You need to go to the record where the script is attached, highlight the script and press the button labeled "properties". A new window appears, if you gave your property the same name as the EditorID of the object you want, then you can press "auto-fill all" at the bottom. Otherwise, highlight the property and use the data input fields that appear on the right side of the window to assign the correct value or object to your property. Link to comment Share on other sites More sharing options...
Recommended Posts