Originally Posted By: 3dgs_snake
Hi,

Do you want to create entity when you hit space bar or do you want to show it? In your code, you have 2 functions that use the "my" pointer, you must call them in an entity function.

Best regards.
The my parameter can only be used in a function called when creating the entity or with its action set in WED, then any subsequent functions called by these will also retain the my pointer

try something like
Code:
#include <acknex.h>
#include <default.c>

action none(){
	
	my.ambient = 50;
	my.lightrange = 300;
	vec_set(my.blue,vector(255,50,50));
	set(me,BRIGHT);
	
	vec_scale(my.scale_x,0.15);
}

void create_entity(){
	
	ent_create("2.mdl", vector(1000, 50, -40), none);
}

function main()
{
	video_mode = 7; //sets video to 800x600 (which is already default)
	
	screen_color.blue = 150; //is useless, loading a level doesn't display any screen color
										//use sky_color to change this
	level_load(NULL);
	
	on_space = create_entity;
}

this will allow you to keep pressing space to create entities

if you only want to be able to create one either do this by:
creating a variable for storing if the entity has been created
or
set on_space to NULL

hope this helps