Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
My 5 minute level editor; One simple script
Topic Started: Dec 16 2009, 02:06 AM (619 Views)
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
Here you have it, the most simple level editor you can get, all in a few lines of code (assuming that you have a instance_create_3d() script). Put this in a key press event:
Code:
 

var object_string,x_string,y_string,z_string,roty_string,edit_file,instance_create_string;
//Object variables
object_string=get_string("Instance name","");
x_string=string(get_integer("X position",""));
y_string=string(get_integer("Y position",""));
z_string=string(get_integer("Z position",""));
roty_string=get_string("Roty","");
instance_create_string="instance_create_3d("+x_string+","+y_string+","+z_string+","+object_string+","+roty_string+");";
//File variables
edit_file="level_edit.txt";
//Check for the file and append creation code to it
file=file_text_open_append(edit_file);
file_text_writeln(file);
file_text_write_string(file,instance_create_string);
file_text_close(file);
//Execute the code string
execute_string(instance_create_string);

Then you just copy n' paste your file data into you game. Done! It sure made my life easier.
Edited by Despellanion, Dec 16 2009, 06:49 PM.
Offline Profile Quote Post Goto Top
 
Xeniczone
Elite Member
[ *  *  *  * ]
I came up with this idea a while ago, but never found time to work on it. Beautiful done Despellanion.
Posted ImageComcast sucks!Posted Image
Offline Profile Quote Post Goto Top
 
zelda4evr
Member Avatar
Forum God
[ *  *  *  *  *  * ]
very nicely done, i might just have to use it

Posted Image
Offline Profile Quote Post Goto Top
 
hanson
Advanced Member
[ *  *  * ]
For the simplicity and ease of implementation, it's great!
In terms of ease of use... I think for most of my projects the investment of time in a simple WYSIWYG level editor easily pays for itself
Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
hanson
Dec 16 2009, 06:21 AM
For the simplicity and ease of implementation, it's great!
In terms of ease of use... I think for most of my projects the investment of time in a simple WYSIWYG level editor easily pays for itself
I hear what you're saying and I agree. This is not easy to use whatsoever because you can't alter individual objects once they're placed. I just made this so I could have something that wrote down the code for me instead of creating my levels through the debugger and typing in notepad manually.
Edited by Despellanion, Dec 16 2009, 12:01 PM.
Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
Sorry for this bump, but I just wanted to update it with this tweaked script I recently made, for vegetation randomization and such. It's what I use right now and it works quite well.

Code:
 

var object_string,x_string,y_string,z_string,roty_string,solid_string,edit_file,instance_create_string,edit_string,rand_spread,x_rand,y_rand,roty_rand,scaling_rand;
//Object variables
object_string=get_string("Instance name",0);
x_string=string(get_integer("X position",0));
y_string=string(get_integer("Y position",0));
z_string=string(get_integer("Z position",0));
roty_string=get_integer("Roty",0);
scaling=get_integer("Scaling","1");
solid_string=string(get_integer("Non Solid",1));
area=get_integer("Spread area",100);
repeat_numb=get_integer("Repeat",1); //This is how many repetitions you want the object to be created

//Repeat the process
repeat(repeat_numb)
{

rand_spread=random(10);

if(rand_spread>=5)
{
x_rand=real(x_string)+random(area);
y_rand=real(y_string)+random(area);
}
else
if(rand_spread<5)
{
x_rand=real(x_string)-random(area);
y_rand=real(y_string)-random(area);
}

roty_rand=random(roty_string);
scaling_rand=irandom_range(1,scaling);

instance_create_string="instance_create_3d("+string(x_rand)+","+string(y_rand)+","+z_string+","+object_string+","+string(roty_rand)+",0,"+string(scaling_rand)+","+solid_string+");";
//File variables
edit_file="level_edit.txt";
edit_string="instance_create_3d("+string(x_rand)+","+string(y_rand)+","+z_string+","+object_string+","+string(roty_rand)+",0,"+string(scaling_rand)+");";
//Check for the file and append creation code to it
file=file_text_open_append(edit_file);
file_text_writeln(file);
file_text_write_string(file,edit_string);
file_text_close(file);
//Execute the code string
execute_string(instance_create_string);

}
Offline Profile Quote Post Goto Top
 
« Previous Topic · Off-topic · Next Topic »
Add Reply