clearlove Posted February 19, 2024 Share Posted February 19, 2024 I tried to reset the mapexplorer of player_classified. I tried the following codes, but it did not work. clear_the_mapexplorer = function(player) if player~=nil and player.player_classified~=nil and player.player_classified.MapExplorer then player.player_classified.MapExplorer = nil -- GLOBAL.TheWorld.minimap.MiniMap:ClearRevealedAreas() player.player_classified.entity:AddMapExplorer() return true end end I check whether mapexplorer has been reset using several print functions. As can be seen below. clear_the_mapexplorer = function(player) if player~=nil and player.player_classified~=nil and player.player_classified.MapExplorer then print("old explorer") print(player.player_classified.MapExplorer) print("old data is ") print(player.player_classified.MapExplorer:RecordAllMaps()) print("old tile can see at is ") print(player.player_classified.MapExplorer:IsTileSeeable(200, 300)) print(player.player_classified.MapExplorer:IsTileSeeable(300, 200)) player.player_classified.MapExplorer = nil GLOBAL.TheWorld.minimap.MiniMap:ClearRevealedAreas() player.player_classified.entity:AddMapExplorer() print("check if the mapexplorer is cleared") print(player.player_classified.MapExplorer) print("new data is ") print(player.player_classified.MapExplorer:RecordAllMaps()) print("new tile can see at is ") print(player.player_classified.MapExplorer:IsTileSeeable(200, 300)) print(player.player_classified.MapExplorer:IsTileSeeable(300, 200)) return true else print("the player or the mapexplorer is nil") if player==nil then print("the player is nil") return false end if player.player_classified==nil then print("the player_classified is nil") return false end return false end end The MapExplorer got a new address. However, the "IsTileSeeable" prints True, which indicates it has not been reset. (I reveal the full map before clearing the MapExplorer , I expected "the new tile can see at is" to be followed by "false") Link to comment https://forums.kleientertainment.com/forums/topic/154378-how-to-reset-the-mapexplorer-or-any-other-userdata-variable/ Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now