Problem 1:
Mini map shows only units, not obstacles. I think at the moment there's no way to get shapes of obstacles on the level.
Problem 2:
I couldn't find the function, which returns current facing of unit. Insted of it i'm using velocity of unit, that sometimes looks weird on the minimap.
Problem 3:
I couldn't find the way to move minimap to the corner of screen, or the function, returning screen size. So minimap is placed near the center of screen.
Mod installation:
1. Place minimap.html to Overgrowth\Data\UI\dialogs
2. Replace Overgrowth\Data\Scripts\level.as with my level.as or use instruction below to modify it.
3. ??????
4. PROFIT
If you want to modify level.as by yourself follow these steps:
1. Place
Code: Select all
uint32 minimap = 0;
bool mapPreload = true;
2. Place
Code: Select all
if ((has_gui && minimap != 0) || GetPlayerCharacterID() == -1){
gui.RemoveGUI(minimap);
minimap = 0;
} else if (!has_gui && minimap == 0 && GetPlayerCharacterID() != -1){
minimap = gui.AddGUI("minimap","dialogs\\minimap.html",600,400);
if (mapPreload){
gui.RemoveGUI(minimap);
minimap = gui.AddGUI("minimap","dialogs\\minimap.html",600,400);
mapPreload = false;
}
}
UpdateMap();
Code: Select all
void Update() {
gui.Update();
Code: Select all
void UpdateMap(){
int player_id = GetPlayerCharacterID();
if(minimap == 0 || player_id == -1){
return;
}
MovementObject@ player_char = ReadCharacter(player_id);
float x = player_char.position.x,
y = player_char.position.z;
int num = GetNumCharacters();
for(int i=0; i<num; i++){
MovementObject@ char = ReadCharacter(i);
float cx = char.position.x,
cy = char.position.z;
float vx = cx - x,
vy = cy - y;
float dist = sqrt(vx * vx + vy * vy);
int state = 0;
if (char.controlled)
state = 1;
if (char.IsKnockedOut() != _awake)
state = 2;
vx += 50.0f;
vy += 50.0f;
vx *= 2.0f;
vy *= 2.0f;
vec3 vel = char.velocity;
float an = atan2(vel.z, vel.x);
gui.CallFunction(minimap, "addObject(" + vx + "," + vy + "," + an + "," + state + ")");
}
gui.CallFunction(minimap, "draw();");
}
Code: Select all
const float _reset_delay = 4.0f;
float reset_timer = _reset_delay;
5. PROFIT AGAIN