Page 1 of 2

changing your starting weapon with DECORATE

Posted: Sun Oct 02, 2005 12:29
by Captain Red
Is it possable to change the weapons you start with to something other then fists and pistol?

Posted: Sun Oct 02, 2005 12:38
by Graf Zahl
DECORATE just defines the items. Currently the only means to change your start inventory is with scripts.

Posted: Sun Oct 02, 2005 12:52
by Captain Red
Awww peas.

I'd like to request that as a feature.

Posted: Sun Oct 02, 2005 13:39
by Graf Zahl
That is something that will eventually be done once DECORATE is properly integrated into ZDoom. But what's the point?

Since I support FraggleScript and added support for one global script lump you can use that instead. Here's an example:

Code: Select all

[scripts] 



script 1
{
	if (!checkinventory(0, "QuestItem1",1))
	{
		takeinventory(0, "Pistol");
		takeinventory(0, "Clip", 999);
		giveinventory(0, "DHPulse");
		setweapon(0, "DHPulse");
		giveinventory(0, "QuestItem1");
	}
}
startscript(1);
Just use it as FSGLOBAL lump. Quick explanation:

It takes away the default weapons from player 0 and gives new ones. The QuestItem is there so that this isn't executed repeatedly for the same player. It doesn't work for multiplayer though.

Posted: Sun Oct 23, 2005 16:24
by Captain Red
Thanks man! FraggleScript is awsome!

Is there some sort of FraggleScript refrance I could take a look at?

Posted: Sun Oct 23, 2005 16:53
by Graf Zahl
Somewhere on the Legacy homepage there might be a reference. But the code above is GZDoom exclusive. I added some functions to FraggleScript to handle ZDoom's inventory system better. The original implementation only knew about the original weapons, ammo types and keys and the handling was rather limited.

Posted: Sun Oct 23, 2005 16:53
by Soultaker
Also Graf failed to mention probably cause he does not know BUT most wads like Sci2 and Rebirth will screwup the fragglescript and give you the old starter weapons. When that happens just use the give command in the console if you want your new starter weapons in your hands. I think something in the Dehack and DeuTex files that some of the wads have screws up Fragglescript. It is a one time screwup thankfuly. What that mneans is that on the next map you will have the new starter weapons THAT is if you did use the give command. Oddly enough it is just those two wads I have mentioned that muck up Fragglescript. O_o I think more testing is needed though to try and fix this little annoyance.

Posted: Sun Oct 23, 2005 16:56
by Graf Zahl
That's probably interference by Dehacked. If that is the case I'm sorry but there isn't much I can do. Stuff like this is simply not designed to force new weapons into WADs that redefine the standard weapons.

Posted: Sun Oct 23, 2005 17:00
by Soultaker
Yea well what is odd that most other wads that have Dehack or the DeuTex file\lmp like TV:Revolution don't even screw up the scripting. I think it is just a random odd bug that will be a part of the Weird Bugs Canon that are in the ZDooM Series. :shock:

Posted: Sun Oct 23, 2005 18:17
by Enjay
:shock:

I wish I'd know about that Fraggle Script way of doing things a few days ago. I just went through a bunch of levels laboriously scripting the startup weapons. That FSGlobal idea works brilliantly.

Is "QuestItem" some sort of internal known about name, or could I use anything? (Hmm, thinks... it's a Strife thing isn't it?)

An additional question (sort of related). Is there any way to set "PROP_INSTANTWEAPONSWITCH" without an ACS script? A cant see a CVAR or option for it.

Posted: Sun Oct 23, 2005 18:34
by Graf Zahl
Enjay wrote: Is "QuestItem" some sort of internal known about name, or could I use anything? (Hmm, thinks... it's a Strife thing isn't it?)
Yes, it's from Strife. But since it isn't used in Doom and already defined I just used it.
An additional question (sort of related). Is there any way to set "PROP_INSTANTWEAPONSWITCH" without an ACS script? A cant see a CVAR or option for it.
Either ACS or a line special. There are no other means to set it. You can use it from FraggleScript as well but the PROP_ constants are not defined.

For FS you use

Code: Select all

ls(setplayerproperty, arg1, arg2, arg3);
but you have to include 'lspec.h'

Posted: Sun Oct 23, 2005 23:17
by Enjay
Graf Zahl wrote:For FS you use

Code: Select all

ls(setplayerproperty, arg1, arg2, arg3);
but you have to include 'lspec.h'
OK, I'm afraid you've lost me there. lspec.h - is that a file? I've looked in the GZDoom and Legacy source and cannot find a file of that name. Never the less, I added an include line to my script.

I looked at the FS reference that I could find via the Legacy site and couldn't find anything to do with setting player properties.

I tried this:

Code: Select all

[scripts] 

include("lspec.h");

script 1 
{ 
   ls(setplayerproperty, 1, 1, 2); 
   blah
   blah
   blah
and got "unknown variable setplayerproperty"

So I tried using the Zdoom special number.

Code: Select all

[scripts] 

include("lspec.h");

script 1 
{ 
   ls(191, 1, 1, 2); 
   blah
   blah
   blah
This didn't produce an error, but it also didn't obviously produce any results either. I tried with other player properties (frozen, fly, lightamp) and they all worked. I also tried using instantweapons in a more traditional way (line activated) and it was still working, so perhaps there is something wrong with GZDoom's handling of this particular player property when done via FS?

Anyway, having now seen again what instant weapon switching is like, I don't really like it that much anyway. Quickweaponswitch would be a more aesthically pleasing option to me. :shrug: However, it does surprise me that this has never become an SV option. I would have thought some deathmatchers would like it.

Posted: Sun Oct 23, 2005 23:26
by Graf Zahl
I forgot that FS is case sensitive so it's SetPlayerProperty, not setplayerproperty.

To make a guess why it didn't work I'd have to see the entire code. You might need some delays to get the desired effect.

Posted: Mon Oct 24, 2005 0:26
by Enjay
OK, thanks, it's working now. The correct case allowed it to understand "SetPlayerProperty". On its own, as the only line in the script it worked. However, combining it with my other stuff, it didn't work. Using a "wait" statement (which seems to be correct, rather than delay), and putting the line after the "if" stuff did work, however. For info, here's the whole thing.

Code: Select all

[scripts] 

include("lspec.h");

script 1 
{ 
   
   if (!checkinventory(0, "QuestItem1",1)) 
   { 
      giveinventory(0, "NJFist");
      takeinventory(0, "Pistol"); 
      takeinventory(0, "Fist");
      takeinventory(0, "Clip", 999); 
      giveinventory(0, "FlashLight"); 
      giveinventory(0, "NJDaystick");
      giveinventory(0, "NJBoot");
      giveinventory(0, "MWeapWand");
      giveinventory(0, "NJStracherPistol2");
      giveinventory(0, "NJStracherPistol");
      setweapon(0, "NJStracherPistol"); 
      giveinventory(0, "QuestItem1"); 
   }
   
   wait(35);
   ls(SetPlayerProperty, 1, 1, 2);
} 

startscript(1); 

Posted: Mon Oct 24, 2005 0:39
by Soultaker
The following is how I have it set for my mod. Note though the game reverts to the starter weapon every time a new map is loaded. I find it to be highly annoying.

Code: Select all

[scripts]

script 1
{
   if (!checkinventory(0, "st-dlss",1))
   {
      takeinventory(0, "Pistol");
      takeinventory(0, "Fist");
      giveinventory(0, "Glock");
      giveinventory(0, "PunchKickCombo");
      takeinventory(0, "Clip", 50);
      setweapon(0, "Glock");
   }
}
startscript(1);