Thanks for the help I have fixed it, here is the working code that somehow works for me even duo I haven't moved t_shooter_template from Documents
working Code:
function change_levels_WepShoppe ();
function restore_WepShoppe ();
//////////////////////////////////////////////////////////////////////////////////////////////////////
STRING* WepShoppe_wmb = "WepShoppe.wmb";
STRING* weapon1_mdl = "snipergun.mdl";
STRING* weapon2_mdl = "machinegun.mdl";
STRING* City1_wmb = "City1.wmb";
//////////////////////////////////////////////////////////////////////////////////////////////////////
action new_level_loader() // attach this action to an entity at the end of the first level
{
while (!player) {wait (1);} // wait until the player is loaded
while (vec_dist (player.x, my.x) > 100) // wait until the player comes close to this entity
{
wait (1);
}
wait (-1); // wait for a second
level_load (WepShoppe_wmb); // now load the second level
}
action new_level1_loader() // attach this action to an entity at the end of the second level to come back to the first level
{
while (!player) {wait (1);} // wait until the player is loaded
while (vec_dist (player.x, my.x) > 100) // wait until the player comes close to this entity
{
wait (1);
}
wait (-1); // wait for a second
level_load (City1_wmb); // now load the second level
}
function restore_WepShoppe()
{
while (player == 0) {wait (-1);} // wait for the player to be created
if (t_shooter_weapon == 1) // if the player has picked up weapon1
{
ent_create (weapon1_mdl, nullvector, t_shooter_snipergun); // create the weapon again
}
if (t_shooter_weapon == 1) // if the player has picked up weapon2
{ ent_create (weapon2_mdl, nullvector, t_shooter_machinegun); // create the weapon again
}
t_shooter_weapon = 1; // make sure that it is loaded
}
/// code needs more work but for now works fine for me. Thanx for all your help.