unperfek7 Posted March 14, 2009 Share Posted March 14, 2009 somehow self isnt getting set properly....and so it doesnt work...maybe someone of you knows why ? credits go to Berry of bethesda forums scn EXP Script ref self ref target short min short max short random short reward BEGIN GameMode ;make sure the target exists if target <> 0 set self to getSelf ;check to see if the Dante's combat target is dead if target.getDead == 1 && target.isKiller self set min to 25; Min Exp rewarded set max to 50; Max Exp rewarded ;calculate how much xp to give set random to min + GetRandomPercent*(max - min) /99 ;reward the player with xp RewardXP random endif else ;grab the combat target set target to GetCombatTarget endif END Link to comment Share on other sites More sharing options...
Interfer0 Posted March 15, 2009 Share Posted March 15, 2009 I could be wrong, but I don't think you can use the Ref self. Link to comment Share on other sites More sharing options...
unperfek7 Posted March 15, 2009 Author Share Posted March 15, 2009 what can I use instead? Link to comment Share on other sites More sharing options...
Interfer0 Posted March 15, 2009 Share Posted March 15, 2009 try myselfref it can be almost anything, I think you may have just picked something that you can't use. I think there is a problem with the way you use the target ref too. you are checking to see if target is 0 before you set what target is. Link to comment Share on other sites More sharing options...
Cipscis Posted March 15, 2009 Share Posted March 15, 2009 If the name of your variable is "illegal" then you'll get a compiler error, so that's not the problem. I've never seen "<>" used in place of "!=" in Fallout 3 scripts before, but it compiles so I assume that it works fine. However, you'll want to change it to "==", as at the moment "self" will never be set as it will only be set to the return value of GetSelf if it has already been set. As this is never true, it will never be set. You need to change your condition to "if self == 0". Cipscis Link to comment Share on other sites More sharing options...
unperfek7 Posted March 16, 2009 Author Share Posted March 16, 2009 Thanks Cipscis, it works with !=...but my next problem is, that I get muuuuuuch more EXP then I've set.... I want the player to get an random value of exp where 25 is min and 50 max.... but I get like 2500exp each kill ..... whats wrong ? I've set min to 25 and max to 50 so why do I get like 2500 ? EDIT: or is there a way to make it like this: get gamedifficulty and then if the companion kills something , the player gets HALF of the exp he could get....is that possible somehow ? Link to comment Share on other sites More sharing options...
Cipscis Posted March 16, 2009 Share Posted March 16, 2009 How is that script set up? From the look of it, it is attached to an NPC, and will reward the player with a random amount of experience between 25 and 50 every frame for which "target.getDead == 1 && target.isKiller self" is true. Because "target" is only set to the return value of GetCombatTarget once, once the follower kills a single Actor the player will be rewarded with experience every frame. To fix this, you need to reset "target" after rewarding the player with experience, i.e.RewardXP Random set target to GetCombatTargetOne thing that you should know about using this method of giving the player experience for "companion kills" is that it won't work properly if your companion kills something indirectly (e.g. via an explosion). Cipscis EDIT: As far as I know, there is no way in which the current game difficulty can be returned via script. However, this information is obviously available to the game engine, and is used by GMSTs such as "iXPLevelKillCreatureVeryEasy". You could use this to your advantage by killing a creature/NPC (whichever is appropriate) in the player's name (i.e. "KillActor player") in order to reward the player with a different amount of experience depending on the current difficulty level. If you want to change these values via script, you'll have to use FOSE's con_SetGameSetting, along with GetGameSetting. Cipscis Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.