A Liilte Scripting Help Please

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
Biff
Posts: 1061
Joined: Wed Jul 16, 2003 5:29 pm
Location: Monrovia, CA, USA

Post by Biff »

Zippy wrote:Alright, here it is. There are 3 examples of how to do it in the map....

The third way is immediately behind you when you start. In game, it appears identical to method #2, but it is set up differently. What happens is the room just has a normal revenant. The revenant is given a thing special of 137 (which is Thing_SpawnNoFog) with the two arguments 3 (the mapspot to spawn at) and 89 (red skull key spawn number.) When a monster is given a thing special, that special is executed on the monster's death. So, when the revenant dies, a red skull key is spawned at the mapspot with tag 3. If you want the red skull key not to be dropped physically by the monster, this kind of method is a very good choice....
Actually, in the past I would use this way to have the monster drop whatever I wanted..but I would not spawn whatever thing at a mapspot, I would spawn it directly on the monster's corpse. You just have to give the monster a tag number and use it as the first argument of that special 137.
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

Biff wrote:Actually, in the past I would use this way to have the monster drop whatever I wanted..but I would not spawn whatever thing at a mapspot, I would spawn it directly on the monster's corpse. You just have to give the monster a tag number and use it as the first argument of that special 137.
Yet another way to do it.
mac53 wrote:A player walks into this particular area [1 sector] , a wall sector, [like a door] closes behind him and now he has $h!t load of monsters to deal with. Can I write a script that will not allow the door to be opened until after the death of the last monster?
You bet. Like a lot of things, there's more than one way to do this, particularly depending on what you want to do exactly (e.g. have it be a normal door that can only be opened after the last monster dies vs. the door opening automatically once the last monster dies.) The basic idea would involve this: Give all your monsters relative to the ambush the same TID. Give each monster the thing special [wiki]ACS_ExecuteAlways[/wiki] and make the first argument for all of them the same script. In the script make use of [wiki]ThingCount[/wiki] to determine how many monsters in the ambush are left (ThingCount does not count dead monsters). When the last monster dies, it will execute the script and ThingCount will return 0, so you can take the appropriate action from there.
User avatar
mac53
Posts: 251
Joined: Sun Dec 17, 2006 11:15 am
Location: Delmarva Peninsula, MD USA
Contact:

Post by mac53 »

Ok...

I'll try to draw up the commands. ! When I think I've got it, I'll post it up for you to have a look at it.

Actually, it won't be a regular door. It'll be a wall that closes behind you once you cross the trigger-line and I'd want it to open automatically :plasma:
Last edited by mac53 on Wed Jan 24, 2007 7:38 pm, edited 1 time in total.
User avatar
mac53
Posts: 251
Joined: Sun Dec 17, 2006 11:15 am
Location: Delmarva Peninsula, MD USA
Contact:

Post by mac53 »

Biff wrote:
Zippy wrote:Alright, here it is. There are 3 examples of how to do it in the map....

The third way is immediately behind you when you start. In game, it appears identical to method #2, but it is set up differently. What happens is the room just has a normal revenant. The revenant is given a thing special of 137 (which is Thing_SpawnNoFog) with the two arguments 3 (the mapspot to spawn at) and 89 (red skull key spawn number.) When a monster is given a thing special, that special is executed on the monster's death. So, when the revenant dies, a red skull key is spawned at the mapspot with tag 3. If you want the red skull key not to be dropped physically by the monster, this kind of method is a very good choice....
Actually, in the past I would use this way to have the monster drop whatever I wanted..but I would not spawn whatever thing at a mapspot, I would spawn it directly on the monster's corpse. You just have to give the monster a tag number and use it as the first argument of that special 137.
The three example maps Zip did me were done well... I happened to choose the "Decorate", because like you said, the key appears right at the dead monster and not at some mapspot that could wind up being a "half-a-mile" away. ;-)
User avatar
DoomerMrT
Posts: 370
Joined: Tue Nov 21, 2006 10:58 am
Location: Budapest,Hungary

Post by DoomerMrT »

I was a bit too lazy,and I didn't want to do same topic like this,so here's my question:I have downloaded the radar example(sorry, I can't remember the author's name,but thanks to him),and I wanted to extend it with TID 3 but I got an error,and I don't know why.Here's the code:



Spoiler:

Please help me!
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

DoomerMrT wrote:but I got an error
What's the error exactly? Knowing that makes it easier to try and figure out what it wrong.
User avatar
DoomerMrT
Posts: 370
Joined: Tue Nov 21, 2006 10:58 am
Location: Budapest,Hungary

Post by DoomerMrT »

"the complier did not complie your script"
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

Yeah, I could have guessed that much. But there's more to it than that. ACC gives a slightly more meaningful description of what the problem is and generally points to where the problem starts. Please post the whole error message.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Well, first off the definition of DrawRadar takes three arguments, but you're only passing it two in script 1.

It looks like you're trying to "extend it with TID 3" by adding a third argument to the function that doesn't get used.

If you just want it to track TID 3, change the 1 in this line to a 3 and leave the other function alone:

Code: Select all

DrawRadar (ActivatorTID (), 1);
User avatar
DoomerMrT
Posts: 370
Joined: Tue Nov 21, 2006 10:58 am
Location: Budapest,Hungary

Post by DoomerMrT »

Zippy wrote:Please post the whole error message.




Line 94 in file "script.acs" ...
script.acs:94: Invalid statement.
> script
> ^

The ACS compiler did not compile your script.



@HotWax:It's still not working,and I need all the 3 TIDs,I don't want to replace.But thank you for your help.
Last edited by DoomerMrT on Thu Jan 25, 2007 1:40 pm, edited 1 time in total.
User avatar
The NUtcracker
Posts: 843
Joined: Sun Jan 14, 2007 9:12 pm
Location: South Dakota
Contact:

Post by The NUtcracker »

Check to see if you have parentheses or semi-colons missing in the last part of the script above that.
User avatar
DoomerMrT
Posts: 370
Joined: Tue Nov 21, 2006 10:58 am
Location: Budapest,Hungary

Post by DoomerMrT »

I checked them,but nothing is wrong. :?
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

The error message says the problematic line is line 94.

Line 94 is

Code: Select all

script 1 enter
Looks like it's encountering a keyword where it doesn't expect it, and sure enough, if you look just above it you'll see the closing of an IF block. The function that it is defined in is not closed. You need an extra closing brace ("}") above line 94.

This would have been a lot easier to spot if you get into the habit of formatting your code better. E.g. instead of

Code: Select all

function someFunc( int arg1 )
{
int thing = 2;
int x = thing * 7;
if ( x == 2 )
{
Print(s:"LOL!");
}
try

Code: Select all

function someFunc( int arg1 )
{
   int thing = 2;
   int x = thing * 7;
   if ( x == 2 )
   {
      Print(s:"LOL!");
   }
   // <--- !!! Missing brace is more obvious now
User avatar
mac53
Posts: 251
Joined: Sun Dec 17, 2006 11:15 am
Location: Delmarva Peninsula, MD USA
Contact:

Post by mac53 »

Zippy wrote:You bet. Like a lot of things, there's more than one way to do this, particularly depending on what you want to do exactly (e.g. have it be a normal door that can only be opened after the last monster dies vs. the door opening automatically once the last monster dies.) The basic idea would involve this: Give all your monsters relative to the ambush the same TID. Give each monster the thing special [wiki]ACS_ExecuteAlways[/wiki] and make the first argument for all of them the same script. In the script make use of [wiki]ThingCount[/wiki] to determine how many monsters in the ambush are left (ThingCount does not count dead monsters). When the last monster dies, it will execute the script and ThingCount will return 0, so you can take the appropriate action from there.
I looked into your instructions... I also have a copy of Zdoom's Reference Files on my hard drive and found this info:
int thingcount(int type, int tid);
Returns a count of things in the world. Use the thing type definitions in defs.acs for <type>. Both <type> and <tid> can be 0 to force the counting to ignore that information. Examples:
// Count all ettins that are marked with TID 28:

c = thingcount(T_ETTIN, 28);

// Count all ettins, no matter what their TID is:

c = thingcount(T_ETTIN, 0);

// Count all things with TID 28, no matter what their type is:

c = thingcount(0, 28);

Now, I feel like I'm hanging out in the wrong crowd, because this is beyond me Zip! I'm going to check out the links you had post to the wiki in your original response to me to see if I missed anything. I just don't know where to start with this... :?

Edit-----------------------------------------------------------------------

Code: Select all

Examples
For example let's say you have a map with 10 enemies: 

Imp - tid 5
Imp - tid 5
Imp - tid 0
Baron - tid 5
Baron - tid 5
Baron - tid 4
Baron - tid 0
Demon - tid 5
Demon - tid 4
Demon - tid 0


Here are some example values:


ThingCount(T_IMP, 0) = 3
ThingCount(T_BARON, 0) = 4
ThingCount(T_DEMON, 0) = 4
ThingCount(T_NONE, 5) = 5
ThingCount(T_NONE, 4) = 2
ThingCount(T_IMP, 5) = 2
ThingCount(T_DEMON, 4) = 1
ThingCount(T_NONE, 0) = 10
ThingCount(T_IMP, 4) = 0
I'm a little :? as to what (T_NONE) means! I understand about defining the monster's name and count, but when I saw T_NONE, set be back a little.
User avatar
mac53
Posts: 251
Joined: Sun Dec 17, 2006 11:15 am
Location: Delmarva Peninsula, MD USA
Contact:

Post by mac53 »

Ok... It obvious that this code is wrong, but up to this point, it's the best I can do.

Code: Select all

#include "zcommon.acs"

Script 1 OPEN
{
	While(ThingCount(3) > 0
     {	
	(T_IMP, 3) = 10
	(T_CHAINGUY, 3) = 3
	(T_REVENANT, 3) = 1
	(T_SHOTGUY, 3) = 3
	(T_DEMON, 3) = 3
	(T_BARON, 3) = 1
     }
	Ceiling_RaiseToNearest(4, 30);

}
Error Report----duh

Code: Select all

Line 5 in file "C:\DeePsea\A1.acs" ...
C:\DeePsea\A1.acs:5: Incorrect number of arguments.
>  While(ThingCount(3) 
>                    ^
C:\DeePsea\A1.acs:6: Missing ')'.
>      { 
>      ^
I'm going to try to figure out what this error report is saying... so if you have anything to add that may help... by-all-means!!
Locked

Return to “Editing (Archive)”