|
Fixing the code.
#391573
01/13/12 22:26
01/13/12 22:26
|
Joined: Nov 2009
Posts: 70
Siwler
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2009
Posts: 70
|
Can someone tell me what em I doing wrong with this code
#include <acknex.h> #include <default.c>
#include "t_shooter_weapons.c"
function level_restore () { while (player == 0) {wait (-1);} if (t_shooter_pistol == 1) {ent_create(pistol_mdl, NULLvector, gun1);} if (t_shooter_machinegun == 1) {ent_create(machinegun_mdl, NULLvector, gun2);} if (t_shooter_snipergun == 1) {ent_create(snipergun_mdl, NULLvector, gun3);} if (t_shooter_muzzle == 1) {ent_create(muzzle_mdl, NULLvector, gun4);} gun_loaded = 1; gun_select(); }
/// this is not my main script I'm trying to include it to main from .c file
I also tried this way too:
if (t_shooter_weapon == 1) {ent_create(pistol_mdl, NULLvector, gun1);}
then this way:
if (t_shooter_weapon == 1) {ent_create(pistol_mdl, NULLvector, weapon1);}
I ran out of options please help.
Honesty will get you far, were dishonesty will get you only so far in life.
|
|
|
Re: Fixing the code.
[Re: Rei_Ayanami]
#391578
01/13/12 22:59
01/13/12 22:59
|
Joined: Nov 2009
Posts: 70
Siwler
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2009
Posts: 70
|
I also tried the nullvector like this:
if (t_shooter_weapon == 1) ent_create(weapon1_mdl, nullvector, pistol);
and like this:
if (t_shooter_weapon == 1) ent_create(t_shooter_weapon1_mdl, nullvector, pistol);
its no good, most of the time it gives me this error:
"weapon1_mdl" undeclared indentifier
so does for t_shooter_weapon1_mdl same error
Honesty will get you far, were dishonesty will get you only so far in life.
|
|
|
Re: Fixing the code.
[Re: Siwler]
#391579
01/13/12 23:12
01/13/12 23:12
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
#include "t_shooter_weapons.c"
is wrong. Change that to:
#include <t_shooter_weapons.c>
unless you have copied that file into your project folder.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Fixing the code.
[Re: Uhrwerk]
#391585
01/13/12 23:43
01/13/12 23:43
|
Joined: Nov 2009
Posts: 70
Siwler
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2009
Posts: 70
|
Thank you for tring to help me out I appreciate your help. Its not in project file but its not in GStudio7 ether. I have a separated folder with all the codes, models etc. Folder is in Documents and I opened t_shooter_temple main.c in WED everything worked fine until I came across snniped code to restore and ent_create all weapons or entities that were collected in previous levels. Code: #include <t_shooter_weapons.c> its not fixing my problem 
Honesty will get you far, were dishonesty will get you only so far in life.
|
|
|
Re: Fixing the code.
[Re: Siwler]
#391586
01/13/12 23:49
01/13/12 23:49
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
"t_shooter_weapons.c" should be located inside the "include" folder in your gamestudio installation folder. If it isn't your gamestudio installation is most likely damaged. If you located the file somewhere else you have to give the relative file name in your script, e.g.
#include "myfiles\\t_shooter_weapons.c"
Although this will work I don't recommend copying game studio files around your harddisk. Once you change one of those files or upgrade your game studio version you will get inconsistent versions. The safest way is to keep them in the "include" folder and not touching them.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Fixing the code.
[Re: Uhrwerk]
#391600
01/14/12 03:06
01/14/12 03:06
|
Joined: Nov 2009
Posts: 70
Siwler
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2009
Posts: 70
|
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.
Honesty will get you far, were dishonesty will get you only so far in life.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|