Team-based projectile help
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.
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.
Team-based projectile help
For QNA, I'm trying to have team-based projectiles (Blue team fires blue blaster bolts, blue-flared rockets, blue lightning, blue railgun shots, etc.), and I already have an idea as to how to do it. I'll try a LoadACS script to check the player's team in Enter and Respawn scripts and give a cooresponding inventory item, which the weapon checks for.
How exactly would I use GetPlayerProperty to check a player's team, and would it mess up in single player? I'll double-check on the Skulltag forums to see if the ZDoom method would work properly in Skulltag, but I don't see too many reasons it wouldn't.
Edit: Ack, I should've checked the wiki more thoroughly first. I meant GetPlayerInfo, and PlayerInfo_Team was the first on the list XD. Thanks anyway!
Edit2: Yeah... Can someone give me an example of a script that checks the activating player's team?
How exactly would I use GetPlayerProperty to check a player's team, and would it mess up in single player? I'll double-check on the Skulltag forums to see if the ZDoom method would work properly in Skulltag, but I don't see too many reasons it wouldn't.
Edit: Ack, I should've checked the wiki more thoroughly first. I meant GetPlayerInfo, and PlayerInfo_Team was the first on the list XD. Thanks anyway!
Edit2: Yeah... Can someone give me an example of a script that checks the activating player's team?
- NewTiberian
- Posts: 65
- Joined: Fri Apr 04, 2008 5:18 pm
- Location: Australia
Re: Team-based projectile help
Couldn't be more simple 
this is stuck to a linedef at the respective team's spawns, so any non blue/red people trying to enter the opposite team's spawn area are killed
EDIT: i made this to show my example at work: try switching around teams and see what happens
Code: Select all
#include "zcommon.acs"
script 1 (void)
{
if(GetPlayerInfo(0, PLAYERINFO_TEAM) != 0) //if the player's team is not the default 0 (blue) they are killed
{
Thing_Damage(0, 100, 0);
}
else
{
//nothing
}
}
script 2 (void)
{
if(GetPlayerInfo(0, PLAYERINFO_TEAM) != 1) //if the player's team is not the default 1 (red) they are killed
{
Thing_Damage(0, 100, 0);
}
else
{
//nothing
}
}EDIT: i made this to show my example at work: try switching around teams and see what happens
Re: Team-based projectile help
Thanks, but does 0 really check for the activator, with GetPlayerInfo?
Edit: Hm... It's not working in Skulltag. I started up CTF on that map (after adding team starts), and both teams trigger the killing line. Is there any alternative to GetPlayerInfo I can use to check a player's team?
If this is right, how could I use it to get the activator's information, without assigning a PlayerNumber-based TID to everything?The wiki wrote:To get information for the player who activated the script, use the PlayerNumber function.
Edit: Hm... It's not working in Skulltag. I started up CTF on that map (after adding team starts), and both teams trigger the killing line. Is there any alternative to GetPlayerInfo I can use to check a player's team?
- NewTiberian
- Posts: 65
- Joined: Fri Apr 04, 2008 5:18 pm
- Location: Australia
Re: Team-based projectile help
perhaps you could stick a script to a linedef to find out the team number for blue/red/whatever other teams
this would be MUCH easier if the skulltag wiki actually had info about the team numbers 
EDIT:
you may not have a choice but to assign individual TIDs to each player
Code: Select all
script 1 (void)
{
SetFont("BIGFONT"); //so you can read it
print(d:GetPlayerInfo(0, PLAYERINFO_TEAM)); //printing the team number of activator
}EDIT:
interesting... i guess not, and the script is only checking the first player that entered the game (who is 0)Ghastly_dragon wrote:Thanks, but does 0 really check for the activator, with GetPlayerInfo?
you may not have a choice but to assign individual TIDs to each player
Re: Team-based projectile help
I just reported the Skulltag problem in Skulltag's internal testing IRC channel, and it was just fixed and will hopefully be in the next version. I just need some way to test in ZDoom, so I know if I'm successful or not.
I'd, also, like to clear up that whole GetPlayerInfo activator thing before I get started on the script itself. Can it check the activator, in spite of that one thing it says on the wiki?
I'd, also, like to clear up that whole GetPlayerInfo activator thing before I get started on the script itself. Can it check the activator, in spite of that one thing it says on the wiki?
- NewTiberian
- Posts: 65
- Joined: Fri Apr 04, 2008 5:18 pm
- Location: Australia
Re: Team-based projectile help
No, i don't think it can, the only way to test it would to do a 2p game and test the scripts then, but i still believe that you may have to assign each player a unique TID
Re: Team-based projectile help
Okay, I just rigged this thing up:
Would Script 1 fire before Script 2? I'm concerned it won't, because my experience with Starcraft triggers is that the effects from one don't take effect before the next can use them.
I already wrote the decorate-side of this (which works perfectly, even, surprisingly, with the hold state weapons), so I just need some way to test it in ZDoom. Is there any mod I can run with this in ZDoom that uses teams?
Code: Select all
#Include "ZCommon.acs"
Script 1 Enter
{
Thing_ChangeTID(0, 1000 + PlayerNumber());
}
Script 2 Enter
{
If(GetPlayerInfo(1000 + PlayerNumber(), PlayerInfo_Team) == 0)
{
GiveActorInventory(0, "BlueTeamChecker", 1);
}
Else
{
If(GetPlayerInfo(1000 + PlayerNumber(), PlayerInfo_Team) == 1)
{
GiveActorInventory(0, "RedTeamChecker", 1);
}
}
}
Script 3 Respawn
{
If(GetPlayerInfo(1000 + PlayerNumber(), PlayerInfo_Team) == 0)
{
GiveActorInventory(0, "BlueTeamChecker", 1);
}
Else
{
If(GetPlayerInfo(1000 + PlayerNumber(), PlayerInfo_Team) == 1)
{
GiveActorInventory(0, "RedTeamChecker", 1);
}
}
}
I already wrote the decorate-side of this (which works perfectly, even, surprisingly, with the hold state weapons), so I just need some way to test it in ZDoom. Is there any mod I can run with this in ZDoom that uses teams?
- NewTiberian
- Posts: 65
- Joined: Fri Apr 04, 2008 5:18 pm
- Location: Australia
Re: Team-based projectile help
Script 1 is basically changing EVERYthing that has no TID (0) to the TID of a non existant player (who activated it? not a player)
Script 2 is giving actors with TID 0 the blue team checker and getting the player info of a non existant player (see above
Script 3 is also like this.
You may need a TID reliant, but more modifiable system. if you want, i could try to write a system and PM it's source to you
EDIT: well, this reads rather embarrasingly
Script 2 is giving actors with TID 0 the blue team checker and getting the player info of a non existant player (see above
Script 3 is also like this.
You may need a TID reliant, but more modifiable system. if you want, i could try to write a system and PM it's source to you
EDIT: well, this reads rather embarrasingly
Last edited by NewTiberian on Tue Jul 22, 2008 3:21 am, edited 1 time in total.
Re: Team-based projectile help
http://zdoom.org/wiki/Thing_ChangeTID "If oldtid is zero, then whatever activated the script will have its TID changed to newtid."
An Enter script is executed when a player enters the game, so any player that enters the game will get a TID unique to his player number.
An Enter script is executed when a player enters the game, so any player that enters the game will get a TID unique to his player number.
- Macil
- Posts: 2529
- Joined: Mon Mar 22, 2004 7:00 pm
- Preferred Pronouns: He/Him
- Location: California, USA. Previously known as "Agent ME".
- Contact:
Re: Team-based projectile help
Just combine scripts 1 and 2 into one script, there's no reason to have them separate.
Re: Team-based projectile help
Er, how would I put an If in the middle of an execution like that? (I'm not all that great with ACS.)
Nevermind, I got it
.
Nevermind, I got it
- NewTiberian
- Posts: 65
- Joined: Fri Apr 04, 2008 5:18 pm
- Location: Australia
Re: Team-based projectile help
bah, you're right, i forgot the difference between Enter and Open scriptsGhastly_dragon wrote: An Enter script is executed when a player enters the game, so any player that enters the game will get a TID unique to his player number.
in that case, it should work fine, but now i'm wondering if there is a way to grab a player's team info using a TID.
Re: Team-based projectile help
There is. GetPlayerInfo(TID, InfoType).
Re: Team-based projectile help
Okay, I'm still having a massive problem with this:
When it uses ==, it doesn't work at all, but when using != (which I'm guessing means everything except the specified number), it does do something, but gives both teams the one item.
Edit: Okay, odd development: I think the problem lies with Thing_ChangeTID. After a few tests, I discovered that GetPlayerInfo is returning -1 ("If you ask for information about a player who is not in the game, it will return -1.").
I've tried Thing_ChangeTID in a seperate Enter script (lower script number, so it activates first, and even activating the GetPlayerInfo script to make sure of it), but it has the same effect. Any ideas?
Code: Select all
#Include "ZCommon.acs"
Script 622 Enter
{
Thing_ChangeTID(0, 1000 + PlayerNumber());
If(GetPlayerInfo(1000 + PlayerNumber(), PLAYERINFO_TEAM) == 0)
{
GiveActorInventory(0, "BlueTeamChecker", 1);
}
Else
{
If(GetPlayerInfo(1000 + PlayerNumber(), PLAYERINFO_TEAM) == 1)
{
GiveActorInventory(0, "RedTeamChecker", 1);
}
}
}
Script 623 Respawn
{
Thing_ChangeTID(0, 1000 + PlayerNumber());
If(GetPlayerInfo(1000 + PlayerNumber(), PLAYERINFO_TEAM) == 0)
{
GiveActorInventory(0, "BlueTeamChecker", 1);
}
Else
{
If(GetPlayerInfo(0, PLAYERINFO_TEAM) == 1)
{
GiveActorInventory(0, "RedTeamChecker", 1);
}
}
}Edit: Okay, odd development: I think the problem lies with Thing_ChangeTID. After a few tests, I discovered that GetPlayerInfo is returning -1 ("If you ask for information about a player who is not in the game, it will return -1.").
I've tried Thing_ChangeTID in a seperate Enter script (lower script number, so it activates first, and even activating the GetPlayerInfo script to make sure of it), but it has the same effect. Any ideas?
- NewTiberian
- Posts: 65
- Joined: Fri Apr 04, 2008 5:18 pm
- Location: Australia
Re: Team-based projectile help
I presume the cause of most of the problem is that GetPlayerInfo wants a PlayerNumber, and not a TID.
a simple enter script like so should work:
you could also replace the condition statements with Case statements, in case multiple teams are involved (more than 2)
(and by work, i mean full stop, it shouldn't need any more tinkering
)
a simple enter script like so should work:
Code: Select all
script 1 enter
{
if(GetPlayerInfo(PlayerNumber(), PLAYERINFO_TEAM) == 0)
{
//commands here (such as giving the player Blue/RedTeamChecker)
}
else if(GetPlayerInfo(PlayerNumber(), PLAYERINFO_TEAM) == 1)
{
//commands here
}
}(and by work, i mean full stop, it shouldn't need any more tinkering