- 12
- Posts
- 7
- Years
- Seen Mar 28, 2022
Hi, I am trying to create a map that changes at a certain point in the game. I am aware that I could do this by creating multiple versions of the map and be transferred to different versions depending on a switch. Unfortunately, the area I'm trying to change is part of quite a large connected area, and there is only a small bit I'm trying to change. I could create a copy of the entire connected area, but every map transfer from every door will have to have the same conditions, and any changes I make on one map, I will have to make on others.
I have created a short script that actually manipulates the connections.dat file and it works, but only when I close and open the game. Even leaving the map and returning doesn't work. I have noticed that when I update a connection through the debug menu, the connection changes in real time when I exit the menu. I was wondering what I need to add to my script to make this change? The player will not be on any part of the connected map when the change is made. The connections will be reset when the player starts a new game, so I am not worried about it being permanently changed.
I have created a short script that actually manipulates the connections.dat file and it works, but only when I close and open the game. Even leaving the map and returning doesn't work. I have noticed that when I update a connection through the debug menu, the connection changes in real time when I exit the menu. I was wondering what I need to add to my script to make this change? The player will not be on any part of the connected map when the change is made. The connections will be reset when the player starts a new game, so I am not worried about it being permanently changed.
Code:
def switchconnection(originalmap,newmap)
data = load_data("Data/connections.dat")
newdata= load_data("Data/connections.dat")
for i in (0...data.length)
if data[i][0]==originalmap #|| data[i][3]==originalmap
newdata[i][0]=newmap
elsif data[i][3]==originalmap
newdata[i][3]=newmap
else
next
end
end
if newdata!=data
save_data(newdata,"Data/connections.dat")
end
end
Last edited: