Polyfemus Posted September 22, 2013 Share Posted September 22, 2013 I'm working on a randomizer quest script that gives a 50% chance to either set the quest stage to 5 or 15. The following quest script is attached to my quest aaDDenRepeatableSale. The quest is started by an activator with a button and the script starts the quest using the startquest command AND setstage command in that order. ScriptName aaDDenRepeatableSaleSCRIPT short randone int randtwo int moveonce short start ; Block One. When the quest stage is begun and stage set at 2 this section of the ; script will calculate a random integer for a random customer Begin Gamemode if (getstage aaDDenRepeatableSale 2 && start == 0) set randone to GetRandomPercent if (randone <= 49) setstage aaDDenRepeatableSale 5 endif else if (randone >= 50) setstage aaDDenRepeatableSale 15 endif set start to 1 endif END The problem seems to be that the randomizer portion of the script never seems to run. Using console commands I know for sure that the quest stage is 2 (as set by another activator's script). If I use console commands to setstage to 5 or 15 the rest of my mod works perfectly fine but this particular codes doesn't seem to work. The worst part about all this is that I was actually able to get this whole thing to work earlier! The only difference now is that I was rearranging my codes to make them more tidy and now the randomizer doesn't work anymore. I don't remember exactly what I changed with this script but it was not significant (for example this time I created the variables before the gamemode block). Any help would be appreciated. Link to comment Share on other sites More sharing options...
rickerhk Posted September 23, 2013 Share Posted September 23, 2013 Use an equals in the Getstage statement:if (getstage aaDDenRepeatableSale == 2 && start == 0)And remember that Getstage always returns the highest stage number that has ever been set on the quest. Link to comment Share on other sites More sharing options...
Aonghus Posted September 23, 2013 Share Posted September 23, 2013 My experience with scripts is limited, but have you tried moving the assignment of the randone variable outside of the nested if statement? (i.e. assign a random percentage to the variable before you check the quest stage,and then use that variable only after you've checked the quest stage.) It should mean an additional call every time the script is run, but the hit should be minimal. Link to comment Share on other sites More sharing options...
Polyfemus Posted September 23, 2013 Author Share Posted September 23, 2013 Use an equals in the Getstage statement:if (getstage aaDDenRepeatableSale == 2 && start == 0)And remember that Getstage always returns the highest stage number that has ever been set on the quest.Oh geez that was it. I did that and it worked perfectly. Thanks so very much. Can't wait to get this whole mod done then published. Link to comment Share on other sites More sharing options...
Recommended Posts