I have an ACS routine that on ENTER determines a randomised target sector for a number of teleports; and a script triggered on a number of linedefs to actually teleport. The 80 action special on the relevant linedefs trigger this teleport script with an int (0 to 11) and this represents an array index. This refers to a working array of sector targets that is randomised into `randomIndexAssigned`.
This works as intended:
int arrayLength =12;int randomIndexAssigned[12]={0,0,0,0,0,0,0,0,0,0,0,0};//store the teleTargetSector ID index as they are chosen
script 1 ENTER {/*
set up random array of teleport target sector IDs:
*/int teleTargetSectors[12]={1,2,3,4,5,6,7,8,9,10,11,12};int assigned =0;/* iterate over sector ID array */for(int a =0;a < arrayLength; a++){
log(i:teleTargetSectors[a]);int entryDone =0;while(!(entryDone)){/* if it is not already in place, proceed to get it *//* so we need to get a RANDOM index of the input and put it at the CURRENT index of the output: */int rnd =Random(0,11);/* test if this random index has been used already */if(!(randomIndexAssigned[rnd])){
randomIndexAssigned[rnd]= teleTargetSectors[a];
entryDone =1;}}}}/* triggered on linedef crossing, teleport to randomised sector assigned to this index: */
script 2(int target){
log(s:"triggering teleport at ");
log(i:target);Teleport(0,randomIndexAssigned[target],0);}
Now, the question I have is this - is there a way to persist the randomised assignment across saves? I could of course assign this script to a W1 linedef action somewhere the player will definitely cross (starting teleport sector lines for example), but them presumably it will not be re-triggered after loading a savegame.
Could I do something with a set of hidden linedefs that could be used to store these values? DO values assigned to linedefs at runtime by an ACS script persist across saves at all?
I was planning that the order of visiting the areas reached by the various teleports would not be dependent on an earlier visit to another, so re-ordering the randomised set will not materially matter, but it would be neater if the order was persisted across a save.
Question
smeghammer
Hi all,
I have an ACS routine that on ENTER determines a randomised target sector for a number of teleports; and a script triggered on a number of linedefs to actually teleport. The 80 action special on the relevant linedefs trigger this teleport script with an int (0 to 11) and this represents an array index. This refers to a working array of sector targets that is randomised into `randomIndexAssigned`.
This works as intended:
Now, the question I have is this - is there a way to persist the randomised assignment across saves? I could of course assign this script to a W1 linedef action somewhere the player will definitely cross (starting teleport sector lines for example), but them presumably it will not be re-triggered after loading a savegame.
Could I do something with a set of hidden linedefs that could be used to store these values? DO values assigned to linedefs at runtime by an ACS script persist across saves at all?
I was planning that the order of visiting the areas reached by the various teleports would not be dependent on an earlier visit to another, so re-ordering the randomised set will not materially matter, but it would be neater if the order was persisted across a save.
Edited by smeghammerShare this post
Link to post
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.