Sure, be warned, code may be non understandable, I don't have the time to go through and explain it all in detail, but it should give you the rough concept.

I would place the code below in a loop in a starter function. static_info is the array which stores object information, ID, xyz, rotation, and a value which is set if the object has been created already or not (to determine if it needs to create it). I am using variables you may have to define yourself such as result2 etc.

Code:

result2 = 1; //start at the beginning of the array
WHILE (1) {
IF (static_info[result2] > 0) { //if our ID is greater than 0
vec_set(temp.x,vector(static_info[result2 + 1],static_info[result2 + 2],static_info[result2 + 3])); //find the position of the object
result = vec_dist(vector(camera.x,camera.y,0),vector(temp.x,temp.y,0)); //find distance from object to camera
IF (result < 5000 && static_info[result2 + 7] == 1) { //if object is within 5000 quants and isn't already created
find_static(static_info[result2]); //find the object using it's ID
static_info[result2 + 7] = 2; //set to 2 means the object is now created
you = ent_create(temp_string,temp.x,static_ent); //create the object at the location specified in the array
vec_set(you.pan,static_info[result2 + 4]); //set object rotation
you.visible_range = 5000; //this is a skill I made used to determine how far the object needs to be from the camera to be removed, so that I could assign different values to different objects, you may not need this
you.skill1 = result2; //set the objects skill1 to the value the object exists in the array
}
} ELSE {
IF (next_static == -1) { next_static = result2; } //next_static is the point in the array the next object gets created at, I initially set it to -1 upon level load, then the moment the script finds an ID in the array which is at 0 it sets this point in the array to create the new object at
break;
}
result2 += 8; //go to the next object in the array
IF (result2 >= 9000) { break; } //if we have reached the array limit (in this case 9000) break the loop.
}



This is what I did to create a new object, in the same loop but at the bottom section:

Code:

IF (key_caps == 0 && key_b == 0 && b_press == 1) { b_press = 0; }
IF (key_caps == 1 && key_b == 1 && b_press == 0) {
beep;
b_press = 1;
result3 = 1;
WHILE (1) {
find_static(1);
you = ent_create(temp_string,camera.x,static_ent);
you.skill1 = next_static;
static_info[next_static] = store_static_ID;
vec_set(vector(static_info[next_static + 1],static_info[next_static + 2],static_info[next_static + 3]),camera.x);
next_static += 8;
result3 -= 1;
IF (result3 <= 1) { break; }
}
}



The find_static function looks like this, I am separating the .mdl part of the string to stop WED looking for the models when it loads:

Code:

FUNCTION find_static(static_ID) {
vec_set(temp_scale.x,vector(1,1,1));
str_cpy(temp_string,"lamppost1");
IF (static_ID == 1) { str_cpy(temp_string,"lamppost1"); }
IF (static_ID == 2) { str_cpy(temp_string,"woodhouse1"); }
IF (static_ID == 3) { str_cpy(temp_string,"woodbridge1"); }
str_cat(temp_string,".mdl");



You can then use a pointer such as clicked_object, set it to the entity you click on through event_click or something. In the objects while loop I added something like this when saving the data:

Code:

WHILE (saving_objects == 1) {
static_info[my.skill1 + 7] = 1;
wait(1);
}
IF (saving_objects == 0) { static_info[my.skill1 + 7] = 2; }



Saving_objects is set to 1 when you press a key, it waits a few frames then every object that exists is currently set to non existant 1, to write to the file so that the next time you load the objects are placed in. The after saving has stopped it is set back to existant. I use some function to move and rotate the object, then store the new data:
Code:

vec_set(static_info[my.skill1 + 1],my.x);
vec_set(static_info[my.skill1 + 4],my.pan);



to remove the object if it moves far enough away from the camera I used something like this:

Code:

static_info[my.skill1 + 7] = 1;
ent_remove(my);
return;