Problems with my New weapons script

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Problems with my New weapons script

Post by Macil »

I'm trying to make a wad with LilWhiteMouse's ewpns.wad as a base, so i can use all of its weapons. Well, DooMBuilder says there is something wrong with this script:

Code: Select all

#include "zcommon.acs"
str WpnType[16] = { "ClipBox", "9mm", "Shotgun", "SuperShotgun", "Chaingun", "HMachineGun", "RocketLauncher", "SnubCannon", "PlasmaRifle", "TriLaser", "ParticleBlaster", "Tesla", "BFG9000", "Freeze", "Flamer", "Grenade" };
str WpnActor[16] = { "ClipBox", "GoldWand", "Shell", "Shell", "ClipBox", "Blaster", "RocketAmmo", "PhoenixRod", "Cell", "Crossbow", "SkullRod", "CWeapFlame", "Cell", "MWeapFrost", "Mace", "ArtiPoisonBag3" };
str WpnAmmo[16] = { "ClipBox", "GoldWandAmmo", "Shell", "Shell", "ClipBox", "BlasterAmmo", "RocketAmmo", "PhoenixRodAmmo", "Cell", "CrossbowAmmo", "SkullRodAmmo", "Mana2", "Cell", "Mana1", "MaceAmmo", "ArtiPoisonBag3" };

int numOfWep = 1;

/*
ClipBox, ClipBox, ClipBox
9mm, GoldWand, GoldWandAmmo
HMachineGun, Blaster, BlasterAmmo
SnubCannon, PhoenixRod, PhoenixRodAmmo
TriLaser, Crossbow, CrossbowAmmo
ParticleBlaster, SkullRod, SkullRodAmmo
Tesla, CWeapFlame, Mana2
Freeze, MWeapFrost, Mana1
Flamer, Mace, MaceAmmo

Grenade, ArtiPoisonBag3
Machette, CWeapMace
Kick, Staff
StunRod, Gauntlets
LaserPistol, MWeapWand
*/

script 1 OPEN
{
	int i;
	GiveInventory ("CWeapMace", 1);
	GiveInventory ("Staff", 1);
	GiveInventory ("Gauntlets", 1);
	GiveInventory ("MWeapWand" ,1);
	print (s:"Check the bottoms of the Controls Menu\nfor the Grenade key.");
	
	For(i=1,i<=numOfWep,++i)
	{
		SpawnSpot(WpnType[i],i+300,i+300,0);
		SetThingSpecial(i+300,ACS_ExecuteAlways,2,0,i);
	}	
}

script 2 (int Wpn)
{
	GiveInventory (WpnActor[Wpn - 1], 1);
	SetWeapon (WpnActor[Wpn - 1]);
	GiveInventory (WpnAmmo[Wpn - 1], 999);
}
script 2 is to give the player the weapon when he grabs it. script 1 is to give the player the starting weapons and spawn the new guns. The area with the problem is this area:

Code: Select all

	For(i=1,i<=numOfWep,++i)
	{
		SpawnSpot(WpnType[i],i+300,i+300,0);
		SetThingSpecial(i,ACS_ExecuteAlways,2,0,i+300);
	}
What on Earht is wrong with it?
[EDIT]I changed the code 'cuz i saw a problem, but it wasn't responsible for the compilation errors[/EDIT]
Last edited by Macil on Thu Oct 14, 2004 6:02 pm, edited 1 time in total.
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

Please! I need help!
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Post by wildweasel »

Give it time!! We're not a bunch of supermen. We can't be expected to evaluate and respond to your request in twenty minutes. Wait a day - THEN you can start complaining.
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

No supermen??!
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

Is the ACS_ExecuteAlways ment to be used like that?
In the wiki it had this to say about its syntax:
"ACS_ExecuteAlways (script, map, s_arg1, s_arg2, s_arg3)"

-PS: chances are I don't know what I'm talking about though.. this isn't java :wink:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49238
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

If you'd say what doesn't work more precisely there won't be much help. What do you want to do and how doesn't it work?
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

Oh, sorry. I want the for loop to go through and spawn a weapon at a mapspot that is equal to 300+the weapon's number in the top array. Then I set the special to script 2 so that it will give me the weapon when i grab it (currently, you can't just pick up a weapon from a different game).

The for loop seems very unstable, and one little slight change and bugs vanish and reappear in the for loop. try compiling that script yourself and you'll see the problems.
User avatar
LilWhiteMouse
Posts: 2270
Joined: Tue Jul 15, 2003 7:00 pm
Location: Maine, US
Contact:

Post by LilWhiteMouse »

Code: Select all

For(i=1,i<=numOfWep,++i)
Change the , to ;

And unless something has changed and I missed it, you can't set a thing's args to any value over 255 can you?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49238
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

No, you can't. They are stored as bytes. That was recently reported as a bug but dismissed by Randy. :(
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

I was wondering why it gave me a missing ; error. Didnt remember the byte limit ;)
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

Thanks! It works!!!!
User avatar
Cutmanmike
Posts: 11354
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

well done now DIE!!!1
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

Actually, once this wad is finished, I'll kill you with an arsenal of weapons you've probably never seen (unless you've played LilWhiteMouse's Extra Weapons WAD).
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

How do i declare a constant variable? Can't find it in the wiki...
User avatar
sirjuddington
Posts: 1030
Joined: Wed Jul 16, 2003 4:47 am
Location: Australia
Contact:

Post by sirjuddington »

Graf Zahl wrote:No, you can't. They are stored as bytes. That was recently reported as a bug but dismissed by Randy. :(
Isn't that because they are stored as bytes in the map format? (not to say you couldn't use larger variables with ACS though, I guess)
Locked

Return to “Editing (Archive)”