HenKonen Posted December 7, 2010 Hi! I was wondering, can one add customly named true/false variables to their scripts when using Zdoom? I'm only learning how to script, and I thought that it would be neat to be able to script picking up an object (an ID card) turn a customly named variable (for example securitylevel4) true. Later you could find doors, switches and such that require the variable securitylevel4 to be true to open. This could also be used with more purposes. For example, a starbases generator is not working, making many switches unoperateable. Trying to click the switch, player gets a message saying "power must be restored to operate electric switches", but after turning the variable Starbaseelectricity true by flicking a switch or collecting cartain items. I would use this trick in an upcoming wad of mine. Help a newbie out :) 0 Share this post Link to post
Gez Posted December 7, 2010 Herska said:I was wondering, can one add customly named true/false variables to their scripts when using Zdoom? Of course. http://zdoom.org/wiki/ACS 0 Share this post Link to post
Bishop Posted December 7, 2010 This is probably the place where you'd wanna be looking That's the way I learned... Look in the "Variables and data types" subpage. Anyways, doing this is so easy, I'll give a away a quick demonstration: - step 1, declare your variable: int var1; It can be done inside or outside any script, only if you define it inside a script, it cannot be acsessed by any other script. You can give the variable any name instead of "var1" you can also give your variable a value on the spot... int var1 = <any decimal value>; if you want a variable that can only have 2 values (0 or 1)... bool booleanflag1; - step 2, giving it a value: at any given moment, you can alter your variable's value simply by doing this: var1 = <any decimal value>; or by doing math operations: var1 = 10 + (5 * 8) or using the value of another variable... var1 = var2 * 3 and with the boolean flags: booleanflag1 = TRUE; There's a lot of possibilites, I can't explain them all. Just use the wiki for reference and practice. 0 Share this post Link to post
RestlessRodent Posted December 8, 2010 Is there a limit as to how many variables you can have? 0 Share this post Link to post