In "load" event at Scene.Map, I would like to create a simple object in loaded scene. Can I do that? How?
Thanks
You should check how the event command work, it implies to change some of the map properties to avoid bugs/side effects. It's in EventCommand/CreateObjectInMap.js:
let id = ++Scene.Map.current.maxObjectsID;
let position = Position.createFromVector3(currentState.position);
let globalPortion = position.getGlobalPortion();
Scene.Map.current.allObjects[id] = position;
let newObject = new MapObject(System.MapObject.createFromModelID(this.modelID.getValue(), id), currentState.position);
if (this.isStockID) {
Game.current.variables[this.stockID.getValue(true)] = id;
}
Game.current.getPortionDatas(Scene.Map.current.id, globalPortion).m.push(newObject);
Game.current.getPortionDatas(Scene.Map.current.id, globalPortion).min.push(newObject);
newObject.changeState();