ObLars Posted April 13, 2011 Share Posted April 13, 2011 Hey guys. Need some help with this.. This is a part of my Quest script and it seems something is wrong. I want it to be able to do something like this; If i buy 1 "Brahmin" - Brahmin1REF is enabled, completing the quest objective. But i also want to be able to return to buy more Brahmin after the quest. How would i do that? Im trying to do some random stuff with no luck at all. Ask me if you dont understand what im talking about, haha :P Scn RanchStorySCRIPT Begin GameMode If getstage Ranch == 40 If Player.getitemcount Brahmin == 1 Brahmin1REF.enable Setstage Ranch 60 If getstage Ranch == 60 Setstage Ranch 100 ShowMessage QuestBrahminsBought If Player.getitemcount Brahmin == 2 Brahmin2REF.enable If Player.getitemcount Brahmin == 3 Brahmin3REF.enable endif endif endif endif endif end Link to comment Share on other sites More sharing options...
Floatsup Posted April 13, 2011 Share Posted April 13, 2011 YEah, I would have to look at your quest mod, to make sense of it. Theres not a lot for me to go on there. Link to comment Share on other sites More sharing options...
PaladinRider Posted April 14, 2011 Share Posted April 14, 2011 It's always good to have indentation. I'm not sure it effects the ability of the compiler, but still good. If condition one do stuff here. Elseif condition two do stuff here Else do stuff here Endif It works similarly for nested If-Endif statements. If condition one if condition two do stuff endif endif Link to comment Share on other sites More sharing options...
tunaisafish Posted April 14, 2011 Share Posted April 14, 2011 Hi ObLars, yep it makes it much easier to follow if you endent as PaladinRider states :) Your problem is that your code will only ever run once (when stage = 40)You increased the stage within that, so that's why your additional stage code only ran once too.Reorganising your code, this would probably work. Hard to tell exactly without seeing your quest but this seems what your logic was trying to achieve... Scn RanchStorySCRIPT Begin GameMode If getstage Ranch == 40 If Player.getitemcount Brahmin == 1 Brahmin1REF.enable Setstage Ranch 60 EndIf ElseIf getstage Ranch == 60 Setstage Ranch 100 ShowMessage QuestBrahminsBought ElseIf getstage Ranch == 100 If Player.getitemcount Brahmin == 2 Brahmin2REF.enable ElseIf Player.getitemcount Brahmin == 3 Brahmin3REF.enable EndIf EndIf End Now for some out of the box thinking.The problem with the above is that you would need to keep the quest running for the checks to take place.The code will also 'continually' keep enabling the Brahmin, even though there is no need.It's just a waste of CPU. So... as the ref's only need to be enabled when the user purchases your 'Brahmin' token, then place the code there.And once the token has enabled the particular cattle, it no longer needs to be in the players inventory. Scn ObLarsBrahminTokenSCRIPT Begin OnAdd If Brahmin1REF.GetDisabled Brahmin1REF.enable ElseIf Brahmin2REF.GetDisabled Brahmin2REF.enable ElseIf Brahmin3REF.GetDisabled Brahmin3REF.enable EndIf RemoveMe End Wherever you sell the 'Brahmin' token to the player, add the condition 'If Brahmin3REF.GetDisabled == 1', so it will only be available if there are Brahmins to actually buy. Hope that makes sense :) Link to comment Share on other sites More sharing options...
Recommended Posts