PDA

View Full Version : FraggleScript questions


jnsg
May 19th, 2004, 09:24 PM
Hello, I have recently started up map editing with Doom Legacy again (I have yet to finish a map), and I have decided to utilize some FraggleScript in my latest endeavor. There are some things I'd like to do, but I'm not sure if any of them are possible.
Firstly, is there a way to mess with a player's color? My goal is to have a map with two teams (teamplay by color), but not let players switch teams whenever they want to. Also, is there a way to detect a player's color/team? The basis for this is to have all players on a team spawn in the same place, by perhaps detecting their color and teleporting them accordingly...?
In case anyone's curious, my map is (hopefully) going to be a capture-the-flag map. The whole project will be a challenge, especially with the scripting, so I will probably be asking questions for a while.
Anyways, if anyone can offer some input on this, I would be very grateful!

ToXiCFLUFF
May 20th, 2004, 07:02 AM
There is already teamstarts implemented in Legacy. I can't quite remember how though, although I used them only recently in my football/soccer mod. It's in the Legacy editing docs on your hard disk anyway. They should have come with Legacy.

As for CTF, it's impossible to make it so that players can join a game in progress. If you want to make this mod then know that all players will have to join at the same time to get it to work. FS isn't so stable in multiplayer, so this is the only solution.

The function you want for the player colour is skincolour([player number]);

Exl
May 20th, 2004, 07:43 AM
There is already teamstarts implemented in Legacy. I can't quite remember how though, although I used them only recently in my football/soccer mod. It's in the Legacy editing docs on your hard disk anyway. They should have come with Legacy.


They're not documented at all. All I can remember though is that it was something with a linedef type being tagged to a sector, making the deathmatch start in that sector a teamstart. Or something.

ToXiCFLUFF
May 20th, 2004, 08:14 AM
There is already teamstarts implemented in Legacy. I can't quite remember how though, although I used them only recently in my football/soccer mod. It's in the Legacy editing docs on your hard disk anyway. They should have come with Legacy.


They're not documented at all. All I can remember though is that it was something with a linedef type being tagged to a sector, making the deathmatch start in that sector a teamstart. Or something. There's instructions under the multiplayer section of whatsnew.html. Just search for "team".

Exl
May 20th, 2004, 09:21 AM
Ah, but who looks in whatsnew.html anyway? :p

ToXiCFLUFF
May 20th, 2004, 09:42 AM
Ah, but who looks in whatsnew.html anyway? :p I did. And now he will too.

Exl
May 20th, 2004, 09:43 AM
Yes, but who are you? Just one person amongst the billions.

iori
May 20th, 2004, 10:06 AM
I think I opened whatsnew.html once by accident, and quickly closed it again.

Exl
May 20th, 2004, 10:11 AM
Good boy. *casper*

ToXiCFLUFF
May 20th, 2004, 10:23 AM
Good boy. *casper* I must, however, avoid being diverted and draw attention back to your initial point:They're not documented at all.

iori
May 20th, 2004, 10:57 AM
Originally posted by Exl
They're not documented at all.

Originally posted by Exl
They're not documented at all.

Originally posted by Exl
They're not documented at all.

*dark*

Exl
May 20th, 2004, 11:06 AM
Which is still a valid point, but since I find discussions boring as hell, and always lose them for some reason, I wont go into that any further.

Which is still a valid point, but since I find discussions boring as hell, and always lose them for some reason, I wont go into that any further.

Which is still a valid point, but since I find discussions boring as hell, and always lose them for some reason, I wont go into that any further.

Which is still a valid point, but since I find discussions boring as hell, and always lose them for some reason, I wont go into that any further.

PumpkinSmasher
May 20th, 2004, 12:26 PM
whats with all the repitition?

whats with all the repitition?

whats with all the repitition?

whats with all the repitition?

whats with all the repitition?

jnsg
May 20th, 2004, 01:17 PM
OK, so team starts are possible... (I was planning on not having players able to join in-game, to be sure teams are even at the start) but I'm not sure exactly how to use them. The little bit in whatsnew.html wasn't very descriptive (or rather, a little confusing), so could anyone give me some pointers on that?
Also, I have noticed in all the FS documentation I've come across that only 4 players are supported... As in, playertip() only accepts 0-3. Why is this? If legacy supports up to 32 players, this leaves the FS you can use in multiplayer pretty limited.
By the way, thanks for the help on this.

Exl
May 20th, 2004, 01:19 PM
The FraggleScript documentation isnt entirely accurate. You can use players 0 through 31.

jnsg
May 20th, 2004, 03:46 PM
OK, well I'm glad it's wrong, but shouldn't someone correct/update the documentation? I assume the errors are leftover from when it was specific to the Eternity port? Oh well, that's why we have forums...
So, in re-reading the bit on team starts, I think I may understand it: you put some deathmatch starts in a sector, and tag that sector to a linedef with a type of 1000-1031. Is that correct?

Exl
May 20th, 2004, 03:57 PM
AFAIK, yes.

jnsg
May 20th, 2004, 04:53 PM
OK, thanks... I will let you know whether it works as soon as I have a chance to test a map in multiplayer.

ToXiCFLUFF
May 20th, 2004, 05:12 PM
It should work. It did in Doomball.

jnsg
May 21st, 2004, 09:33 AM
OK, another question. What is THINGS.H? From the documentation, I gather it provides an integer value for each thing you can place, but is it something that needs to be included in the wad? Or is it merely a reference?

ToXiCFLUFF
May 21st, 2004, 11:52 AM
Thing.h is contained in legacy.dat (which can be opened in any wad editor). It basically contains exactly what you said. Easy to remember pointers for all the objects, flags and corona settings.

So, say you have include("things.h"); in your script, you can have spawn(IMP, 0, 0); instead of spawn(11, 0, 0);

jnsg
May 22nd, 2004, 02:36 PM
OK, so it isn't necessary in order to spawn things, but just makes the code a little easier to read and write. Is all I have to do put "include('things.h');" in the script, or do I need to actually put that file into the wad as a lump? (I'm not sure.. since you say it is already in legacy.dat).

Exl
May 22nd, 2004, 02:40 PM
Yes, put

include("things.h");

in your script.

jnsg
June 7th, 2004, 07:29 PM
I have another question. Is there any good way to move a mapthing around (i.e. change its coordinates)? I have developed a method involving constantly removing and respawning it, but with dynamicaly lit or animated objects this looks really crappy, since the lighting flickers and/or the animation gets frozen at the first frame. I was hoping the SetObjPosition mentioned in the 1.42 announcement might offer a better solution, but I have yet to see any documentation on it...

Exl
June 7th, 2004, 10:53 PM
setobjposition(mobj, int x, int y, int z);

That's all you need to know about it.

jnsg
June 8th, 2004, 12:10 PM
Cool, thanks, hope it works for what I need it for.

jnsg
June 8th, 2004, 09:21 PM
Well, setobjposition() seems to work like a dream...
Another question: is there any way to make a mapthing which isn't "solid"? For instance, the humble candle is merely a sprite - it doesn't impede travel or weapon fire, whereas a torch does. Is it possible to make a torch that you can walk through? I'm thinking objflag() would be the answer? But, in the FS docs it says it's unofficially deprecated, so is there a better way?

ToXiCFLUFF
June 9th, 2004, 02:38 AM
This is also in the newer docs.

objflag(object, flag, 0-1);

In this case, the number for the MF_SOLID flag is 1.

Exl
June 9th, 2004, 04:43 AM
You can also use the flag definitions from things.h (so you can type just MF_SOLID or MF_SPECIAL, etc.)

ToXiCFLUFF
June 9th, 2004, 08:36 AM
These aren't in the things.h included with Legacy.

They're new to the updated version....

Exl
June 9th, 2004, 08:40 AM
The MF_ flags certainly are in there.

ToXiCFLUFF
June 9th, 2004, 08:46 AM
Yeah, you're right. Maybe I was getting confused with the MF2_ Heretic flags.

iori
June 9th, 2004, 08:59 AM
In effect, couldnt you just put the updated things.h in your wad and change its name, then 'include("bob.h");' in your wad or whatever? Because the legacy.dat seems to take precidence over anything in the pwad.

jnsg
June 9th, 2004, 11:31 AM
OK, that worked, but I have yet another question: how can I avoid dead players triggering scripts meant for living ones? I have a few scripts that do a for() loop to cycle through all the player numbers, then examine the player objects. Unfortunately, when one dies it still counts them as being a player and includes them in the loop. This is causing some very undesireable effects. I tried adding if(i.playerobj().objhealth() > 0) to rule out dead players, but for some reason it says a dead player's object health is 50! What can I do to avoid this? Is there some sort of isdead() function or something?

ToXiCFLUFF
June 9th, 2004, 12:04 PM
Iori: I usually still just put it as things.h in my wads and it seems to work ok.

jsng: objdead(object) is the function you are looking for. So just add an && !objdead(playerobj(i)) ) to your if statement.

jnsg
June 13th, 2004, 07:53 PM
I have managed to come up with three more questions, in rapid succession:

As far as anyone knows, is the only unstable multiplayer part of FraggleScript the fact that global variables (and I would assume top-level script calls) don't get initialized for players who join later?

Is there any way to gain a mobj reference to an object that wasn't preplaced, and doesn't have a reference already in place?

I had an interesting insight when the chasecam camera was splashing through swimmable water: it is actually a map object, isn't it? And is it the same map object used for camera controls in FS? (This is more of a curiosity, really.)

ToXiCFLUFF
June 14th, 2004, 12:01 AM
1.) I know that previous variable initialisations will not be in place on a new client's computer. However, this could be to do with the savegame code, since I have seen variables lost between saving and loading a game (or at least the value of a variable). It may be that the savegame stuff (used to give a new client the current status of the game world) has specific problems in this area, and successfully sends running scripts..... but I'm not sure.

Someone does need to do some more thorough testing of this, to determine exactly what works and what doesn't.


2). No, not currently. Best way to handle this problem, is by using arrays. Even though legacy FS doesn't have a function to add things to the end of arrays at run-time, you could quite easily write a script which would simulate this. Arrays aren't in a released version of Legacy yet, and Exl et moi have to fix a bug with them being left out of savegames before they are added.

3). You're absolutely right. Heh, before I updated things.h I had a problem where chasecam was completely screwed in my level and I just couldn't figure out why. Well, this was the reason... I used it to make a new object in dehacked.

The chasecamera object is 137, and the FS camera which I'd generally recommend is 146 although 147 (MT_NODE) would suffice.

jnsg
June 14th, 2004, 12:58 PM
OK, so say I have a room with all the starts in it, and a switch. Whenever someone joins the game, they hit the switch and are teleported into the game. That switch also does all of the variable initialization (instead of that happening as soon as the game starts). Would that help in any way?

ToXiCFLUFF
June 14th, 2004, 02:07 PM
OK, so say I have a room with all the starts in it, and a switch. Whenever someone joins the game, they hit the switch and are teleported into the game. That switch also does all of the variable initialization (instead of that happening as soon as the game starts). Would that help in any way? So you mean the variables initialised only have scope within the script the switch starts? If that's the case, then yeah, it should work fine.

jnsg
June 14th, 2004, 03:55 PM
Well, if the script that the swith triggers has every other script call in it, wouldn't the scope carry over to the other scripts (since they were started from the one with the variables)?

jnsg
July 7th, 2004, 02:42 PM
EDIT: I removed what I originally had here, and made a new new thread since it really didn't have to do with FraggleScript. However, I do have a FS related question.
So, the problem with multiplayer FS is that when the players don't all start at the same time, global variables don't get initialized for everyone. The fix is to have all players start the game at the same time. (Removes the convenience of being able to join mid-game.) My question is, in Doom Connector, do all players start at the same time? As in, everyone's in a room and the host launches the game and everyone joins. Does this mean they get all global variables and such?

jnsg
July 14th, 2004, 01:24 PM
EDIT: Sorry for the double post.
For some reason setobjposition() isn't setting the z-coordinate every time. I can't say there are any specific conditions that dictate when it works and when it doesn't. It gets really annoying when something gets stuck in a ceiling because its original height was higher than where I moved it to, even if I explicitly state a height...
Any ideas?

jnsg
July 17th, 2004, 09:13 AM
I guess no one has any ideas... I'd really like to get this solved, it's one of the last bugs in my map right now.