Xegethra Posted October 14, 2014 Hello there! I'm wondering if switches can have multiple on textures that are chosen at random when a switch is pressed. I have tried making switches before but could not make heads or tails with it, so I just ended up using Slade's method of making them which has been serving well so far. But I can't find a way for it to randomise the on positions. I tried doing it this way. The bottom 5 textures are my switches and the bottom 4 are related to the same switch...as you can see I want that switch to have 4 on images where one is chosen randomly when pressed. So far it only chooses the one texture and always sticks with it. Thanks for any help if anyone knows what to do, I can't quite get it. 0 Share this post Link to post
gggmork Posted October 15, 2014 If you're making a map in zdoom doom in hexen format, you can do low level stuff like this with ACS. So like you have a switch that has an off texture, and when you switch it, you want it to randomly choose between 4 on textures? ACS can play sounds too, so I'd just not even use a conventional switch, just when you push it, have the code play the switch sound and choose among 4 random textures. I never worked with sounds in acs before but think it can do it. 0 Share this post Link to post
Xegethra Posted October 15, 2014 gggmork said:If you're making a map in zdoom doom in hexen format, you can do low level stuff like this with ACS. I certainly am yes! But if I have to ACS script I have to I guess, my previous attempt at such things hasn't really gone very well...I tried custom keys in the past but it didn't come to pass. It'll be a slow thing for me to figure out if I have to ACS, I'll just have to figure out the wiki articles then as I can't find any concrete tutorials on it. 0 Share this post Link to post
gggmork Posted October 16, 2014 I just tested this and it works: make new map in doombuilder 2, doom in hexen format make big square 0 floor, 128 ceil inside that, make 64x64 square 0 floor 0 ceiling all textured as startan2 put player below 64x64 square right click bottom line of 64x64 square, set: action: 121, set line id: 1 click view/script editor, copy paste:#include "zcommon.acs" script 1 open{ setlinespecial(1,acs_execute,2); } script 2(void){ int r,t; r=random(0,2); if (r==0){t="ashwall2";} else if(r==1){t="ashwall4";} else{t="ashwall6";} setlinetexture(1,SIDE_FRONT,TEXTURE_TOP,t); } click compile top right. This chooses a random texture among 3 types of ashwall. But there is no switch sound probably. I have no sound on this comp so cant test sound stuff. If I remember schwerpunk did sound stuff in monochrome mapping project so maybe pm him if he visits here regularly still, or change topic title to something like: Switch with multiple "on" textures (Now need sound help) 0 Share this post Link to post
Xegethra Posted October 16, 2014 Ahh thanks, I shall give this a go! *Edit* This worked brilliantly thanks!! I'll give you credit for the help in my map topic when I put up the next update. 0 Share this post Link to post
Gez Posted October 17, 2014 You can also do that with arrays. str sw2gothic[5] = { "SW2GTHC", "SW2GTHC1", "SW2GTHC2", "SW2GTHC3", "SW2GTHC4" };Then in the script you use:setlinetexture(l, SIDE_FRONT, TEXTURE_TOP, sw2gothic[random(0, 5)]);I find that it's cleaner than using if/else if chains in the function itself. For ultimate nitpick: #define NUMGOTHICSWITCHES 5 str sw2gothic[NUMGOTHICSWITCHES] = { "SW2GTHC", "SW2GTHC1", "SW2GTHC2", "SW2GTHC3", "SW2GTHC4" };Then in the script you use:setlinetexture(l, SIDE_FRONT, TEXTURE_TOP, sw2gothic[random(0, NUMGOTHICSWITCHES)]);That way you can easily add or remove more random textures to your gothic switch by changing only the "definition" part of your ACS source, without touching the part with the actual code. 0 Share this post Link to post
Xegethra Posted October 19, 2014 Oh cool, I'll check this method out too! Thanks a bunch! 0 Share this post Link to post