i want to create a player ship without haveing to put it in a level and assigning an action to it so i figured useing ent_create would be the way to go, the reason for this is because when you switch camera views from isometric view (exterior) to fps view (interior)you`ll go from seeing your ship to being on the bridge of the ship. to do this i`ll need to be able to make the ship invisible and ent_create the bridge, then purge the ship mesh. and vice versa of course. so i figure at the start i`ll ent_create the ship, then allow players to switch between views. so i did this to try it out.
Code:
function main()
{
level_load("darkfrontiers.wmb");
mouse_map = hempire_pcx;
mouse_mode = 1;
while (1)
{
mouse_pos.x = pointer.x;
mouse_pos.y = pointer.y;
wait (1);
}
wait (3);
ent_create (galor_mdl, vector(0, 0, 0), c_ship);
}
however no ship appears at those coordinates, however it may be a case of the camera view not starting up which is why i`m a bit confused. the c_ship function works as an assigned action, the ship is there (naturly lol as it was added in wed) but as a function maybe it won`t. the function code is below and thanks in advance for any advice.
Code:
function c_ship
{
player = my;
my.scale_x = 2.0;//scale it down to have it's size
my.scale_y = my.scale_x;//same as scale x
my.scale_z = my.scale_x;//same as scale x
var ship_speed;
while (1)
{
if (key_w == on)
{
if (ship_speed.x < 1)
{
ship_speed.x += 1.3 * time;
}
}
else
{
if (ship_speed.x >= 0)
{
ship_speed.x -= 0.05 * time;
}
}
if (ship_speed.x < 0) {ship_speed.x = 0;}
if (key_a == on)
{
my.pan += 3 * time;
my.roll - = 3 * time;
}
if (key_d == on)
{
my.pan -= 3 * time;
my.roll + = 3 * time;
}
if (ship_speed.z < 0) {ship_speed.z = 0;}
if (key_q == on)
{
my.tilt + = 3 * time;
}
if (ship_speed.z < 0) {ship_speed.z = 0;}
if (key_e == on)
{
my.tilt - = 3 * time;
}
ent_move (ship_speed.x, nullvector);
ship_camera();
wait (1);
}
}