zebai Posted April 1, 2009 Share Posted April 1, 2009 I have a perk with an attached script and I've verified that the script is indeed being executed however I cannot seem to get it to work right. This is a very simplified version of the script trying to heal the player, the values and everying is just for testing. Unfortunately this does absolutely nothing, it heals for crap, I've tracked the problem down to the simple fact that the player.restoreav is not parsing the variable CF, or any other variable or function I put in there. Can someone tell me why or what I'm doing wrong (if theres another way to heal using a variable amount let me know ). float cfset cf to 500Player.RestoreAv Health cf Link to comment Share on other sites More sharing options...
TGBlank Posted April 1, 2009 Share Posted April 1, 2009 Add a message to the script.More likely than not, the script is not even running. Link to comment Share on other sites More sharing options...
zebai Posted April 1, 2009 Author Share Posted April 1, 2009 If i remove the variable completely and have it set to player.restoreav health 500 It works perfectly well with as a static number, and the script is being called. The script also is changing the radiation amount slightly and that is a static number and works every time. So like I said I've verified the script is being called and that the syntax works perfectly using a static number, I just can't get it to parse a variable. Link to comment Share on other sites More sharing options...
shaikujin Posted April 1, 2009 Share Posted April 1, 2009 I don't have access to GECK at the moment, just throwing crazy ideas out: 1) Maybe try declaring the var as a "short" integer instead of a "float"? 2) add a % sign when calling the variable? ie player.restoreav health %cf 3) If all else fails, you can work around it - if cf == 500 player.restoreav health 500endif if cf == 400 player.restoreav health 400endif if cf == 300 player.restoreav health 300endif Link to comment Share on other sites More sharing options...
zebai Posted April 1, 2009 Author Share Posted April 1, 2009 I think I may have found the issue, it appears that you cannot use local variables when dealing with perk scripts, I made it a global and it works fine. Link to comment Share on other sites More sharing options...
shaikujin Posted April 1, 2009 Share Posted April 1, 2009 Cool, that's good to know! Link to comment Share on other sites More sharing options...
Cipscis Posted April 1, 2009 Share Posted April 1, 2009 There are some problems with using variables in result scripts. In some situations it seems to work alright, as "ref" variables are declared and used successfully in some vanilla result scripts, but this doesn't always seem to be the case. Cipscis Link to comment Share on other sites More sharing options...
nosisab Posted April 1, 2009 Share Posted April 1, 2009 Local variables must be filled before use, with a set statement or a get function (in the same block it'll be used)... The use of global variables is discouraged, but you can use quest variables to emulate them. Variables in a quest script can be accessed from any place in your mod and retain values between sessions, better yet they can be of any valid type (int, float, ref...) That quest may be a dummy quest, don't need even be active anymore and it's script don't need more than the variables declaration block. Indeed quest script variables are like the global ones. The difference being they are restricted to your mod (unless you load the mod that have that quest together yours in the CS/GECK and make sure it's loaded in game too... what isn't a good code or modding practice). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.