WTF with item?!
June 21st 2003, 11:45 AM
RadeonGuy
I'm making a D-Mod what player starts with a Gun (item script is based on Paul Zielinski's Counter-Strike mod's P90). Now if game gives this script to the boot, the game crashes... Why?!?
Perhaps you should post the script, so we can see what's wrong with it...
Also giving scripts to a boot isn't a very good thing to do,. you should give the boot to a script... Oh, don't mind, just plain nonsense
Also giving scripts to a boot isn't a very good thing to do,. you should give the boot to a script... Oh, don't mind, just plain nonsense
June 21st 2003, 12:58 PM
RadeonGuy
There's a code:
//item garand
void use( void )
{
&mholdx = sp_x(1, -1);
&mholdy = sp_y(1, -1);
&mydir = sp_dir(1, -1);
if (&ammogarand == 0)
{
playsound(52, 22050,0,0,0);
Say("JONES! I'm out of ammo for my carbine gun!", 1);
wait(250);
return;
}
playsound(50, 22050,0,0,0);
if (&mydir == 6)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 6);
sp_dir(&junk, 6);
}
if (&mydir == 4)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 4);
sp_dir(&junk, 4);
}
if (&mydir == 2)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 2);
sp_dir(&junk, 2);
}
if (&mydir == 8)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 8);
sp_dir(&junk, 8);
}
if (&mydir == 9)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 5);
sp_dir(&junk, 9);
}
if (&mydir == 1)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 1);
sp_dir(&junk, 1);
}
if (&mydir == 7)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 7);
sp_dir(&junk, 7);
}
if (&mydir == 3)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 3);
sp_dir(&junk, 3);
}
sp_speed(&junk, 10);
sp_strength(&junk, 25);
sp_range(&junk, 4);
//this makes it easier to hit stuff
sp_flying(&junk, 1);
sp_script(&junk, "dam-garand");
&ammogarand -= 1;
&magic = &ammogarand;
sp_brain_parm(&junk, 1);
return;
}
void disarm(void)
{
kill_this_task();
}
void arm(void)
{
Debug("Arming Garand.");
&magic = &ammogarand;
int &junk;
int &mydir;
int &mholdx;
int &mholdy;
int &mshadow;
int &mypower;
int &temp;
//init("load_sequence_now graphics\dink\bow\walk\d-bw1- 71 43 30 84 -14 -10 14 10");
//init("load_sequence_now graphics\dink\bow\walk\d-bw2- 72 43 29 86 -21 -10 19 10");
//init("load_sequence_now graphics\dink\bow\walk\d-bw3- 73 43 35 79 -13 -9 13 9");
//init("load_sequence_now graphics\dink\bow\walk\d-bw4- 74 43 41 79 -18 -12 20 12");
//init("load_sequence_now graphics\dink\bow\walk\d-bw6- 76 43 47 78 -23 -10 23 10");
//init("load_sequence_now graphics\dink\bow\walk\d-bw7- 77 43 46 71 -20 -10 20 10");
//init("load_sequence_now graphics\dink\bow\walk\d-bw8- 78 43 35 76 -15 -12 15 12");
//init("load_sequence_now graphics\dink\bow\walk\d-bw9- 79 43 46 78 -13 -9 13 9");
//init("load_sequence_now graphics\dink\bow\idle\d-bi2- 12 250 35 87 -17 -12 16 9");
//init("load_sequence_now graphics\dink\bow\idle\d-bi4- 14 250 37 77 -11 -12 16 10");
//init("load_sequence_now graphics\dink\bow\idle\d-bi6- 16 250 35 83 -15 -9 11 9");
//init("load_sequence_now graphics\dink\bow\idle\d-bi8- 18 250 33 70 -15 -12 15 9");
//init("load_sequence_now graphics\dink\bow\hit\d-ba2- 102 75 27 89 -23 -12 24 11");
//init("load_sequence_now graphics\dink\bow\hit\d-ba4- 104 75 76 79 -23 -13 23 14");
//init("load_sequence_now graphics\dink\bow\hit\d-ba6- 106 75 37 81 -14 -10 14 10");
//init("load_sequence_now graphics\dink\bow\hit\d-ba8- 108 75 31 89 -17 -16 17 10");
//bow weapon diags
//init("load_sequence_now graphics\dink\bow\hit\d-ba1- 101 75 57 84 -20 -12 20 12");
//init("load_sequence_now graphics\dink\bow\hit\d-ba3- 103 75 33 86 -19 -13 19 13");
//init("load_sequence_now graphics\dink\bow\hit\d-ba7- 107 75 54 82 -19 -11 19 11");
//init("load_sequence_now graphics\dink\bow\hit\d-ba9- 109 75 37 78 -21 -10 21 10");
//preload_seq(25);
Debug("Garand Armed.");
}
void pickup(void)
{
Debug("Player now owns this item.");
kill_this_task();
}
void drop(void)
{
Debug("Item dropped.");
kill_this_task();
}
Aha: I don't know, how to give a boot to script
//item garand
void use( void )
{
&mholdx = sp_x(1, -1);
&mholdy = sp_y(1, -1);
&mydir = sp_dir(1, -1);
if (&ammogarand == 0)
{
playsound(52, 22050,0,0,0);
Say("JONES! I'm out of ammo for my carbine gun!", 1);
wait(250);
return;
}
playsound(50, 22050,0,0,0);
if (&mydir == 6)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 6);
sp_dir(&junk, 6);
}
if (&mydir == 4)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 4);
sp_dir(&junk, 4);
}
if (&mydir == 2)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 2);
sp_dir(&junk, 2);
}
if (&mydir == 8)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 8);
sp_dir(&junk, 8);
}
if (&mydir == 9)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 5);
sp_dir(&junk, 9);
}
if (&mydir == 1)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 1);
sp_dir(&junk, 1);
}
if (&mydir == 7)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 7);
sp_dir(&junk, 7);
}
if (&mydir == 3)
{
&junk = create_sprite(&mholdx, &mholdy, 11, 25, 3);
sp_dir(&junk, 3);
}
sp_speed(&junk, 10);
sp_strength(&junk, 25);
sp_range(&junk, 4);
//this makes it easier to hit stuff
sp_flying(&junk, 1);
sp_script(&junk, "dam-garand");
&ammogarand -= 1;
&magic = &ammogarand;
sp_brain_parm(&junk, 1);
return;
}
void disarm(void)
{
kill_this_task();
}
void arm(void)
{
Debug("Arming Garand.");
&magic = &ammogarand;
int &junk;
int &mydir;
int &mholdx;
int &mholdy;
int &mshadow;
int &mypower;
int &temp;
//init("load_sequence_now graphics\dink\bow\walk\d-bw1- 71 43 30 84 -14 -10 14 10");
//init("load_sequence_now graphics\dink\bow\walk\d-bw2- 72 43 29 86 -21 -10 19 10");
//init("load_sequence_now graphics\dink\bow\walk\d-bw3- 73 43 35 79 -13 -9 13 9");
//init("load_sequence_now graphics\dink\bow\walk\d-bw4- 74 43 41 79 -18 -12 20 12");
//init("load_sequence_now graphics\dink\bow\walk\d-bw6- 76 43 47 78 -23 -10 23 10");
//init("load_sequence_now graphics\dink\bow\walk\d-bw7- 77 43 46 71 -20 -10 20 10");
//init("load_sequence_now graphics\dink\bow\walk\d-bw8- 78 43 35 76 -15 -12 15 12");
//init("load_sequence_now graphics\dink\bow\walk\d-bw9- 79 43 46 78 -13 -9 13 9");
//init("load_sequence_now graphics\dink\bow\idle\d-bi2- 12 250 35 87 -17 -12 16 9");
//init("load_sequence_now graphics\dink\bow\idle\d-bi4- 14 250 37 77 -11 -12 16 10");
//init("load_sequence_now graphics\dink\bow\idle\d-bi6- 16 250 35 83 -15 -9 11 9");
//init("load_sequence_now graphics\dink\bow\idle\d-bi8- 18 250 33 70 -15 -12 15 9");
//init("load_sequence_now graphics\dink\bow\hit\d-ba2- 102 75 27 89 -23 -12 24 11");
//init("load_sequence_now graphics\dink\bow\hit\d-ba4- 104 75 76 79 -23 -13 23 14");
//init("load_sequence_now graphics\dink\bow\hit\d-ba6- 106 75 37 81 -14 -10 14 10");
//init("load_sequence_now graphics\dink\bow\hit\d-ba8- 108 75 31 89 -17 -16 17 10");
//bow weapon diags
//init("load_sequence_now graphics\dink\bow\hit\d-ba1- 101 75 57 84 -20 -12 20 12");
//init("load_sequence_now graphics\dink\bow\hit\d-ba3- 103 75 33 86 -19 -13 19 13");
//init("load_sequence_now graphics\dink\bow\hit\d-ba7- 107 75 54 82 -19 -11 19 11");
//init("load_sequence_now graphics\dink\bow\hit\d-ba9- 109 75 37 78 -21 -10 21 10");
//preload_seq(25);
Debug("Garand Armed.");
}
void pickup(void)
{
Debug("Player now owns this item.");
kill_this_task();
}
void drop(void)
{
Debug("Item dropped.");
kill_this_task();
}
Aha: I don't know, how to give a boot to script
It is trying to use &ammogarand and unless that is initiated in main ( as a global), that might crash.
Something else may be that you don't have the right icon for the item, that you're using a frame number that doesn't exist with your add_item("item", 485, 1); or whatever command
June 22nd 2003, 01:34 AM
RadeonGuy
The ammo var is initiated in main.c (as global), and im using the right icon.
The ammo MUST be limited!
The ammo MUST be limited!
Try this:
1. Open Start-1.c ( if you use skeleton ) and scroll down, when you find
"Add_item("item-fst", 438, 1);"
change it to, or just add this line:
"Add_item("Item-g1", 438, 1);"
save the script you typed above ( the weapon script ) as "Item-g1.c"
when dink starts, if it doesnt crash, you should have the gun ( fist graphics )
NOTE:
If you place a new icon graphic for a weapon you should copy all icon graphics to the map, or it will only find your icon and dink crashes because the "add_item("item-fst", 438, 1);" cannot find the fist icon
long story short:
Just copy all icons to the graphics folder
"graphics\inter\menu\"
1. Open Start-1.c ( if you use skeleton ) and scroll down, when you find
"Add_item("item-fst", 438, 1);"
change it to, or just add this line:
"Add_item("Item-g1", 438, 1);"
save the script you typed above ( the weapon script ) as "Item-g1.c"
when dink starts, if it doesnt crash, you should have the gun ( fist graphics )
NOTE:
If you place a new icon graphic for a weapon you should copy all icon graphics to the map, or it will only find your icon and dink crashes because the "add_item("item-fst", 438, 1);" cannot find the fist icon
long story short:
Just copy all icons to the graphics folder
"graphics\inter\menu\"
June 22nd 2003, 04:44 AM
RadeonGuy
So the reason was: the script file has too long name (was item_garand.c , renamed now to item_g1.c , and it works!)
BFThx(*) to theprophet!!
(*) = Big fakkin thanks (from Quake 2's BFG )
BFThx(*) to theprophet!!
(*) = Big fakkin thanks (from Quake 2's BFG )