[Solved] Give one Thing ID to all players?!

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.
Locked
User avatar
Tormentor667
Posts: 13556
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

[Solved] Give one Thing ID to all players?!

Post by Tormentor667 »

How can I give a certain Thing ID via script to each player? For example I want every player to have the thing id 99, how do I do that?
Last edited by Tormentor667 on Sat Oct 06, 2007 7:44 am, 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 »

Code: Select all

Sript 100 ENTER
{
Thing_ChangeTID(0,99);
}
Untested, but should work.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Post by Kate »

You'll also need to do this if you intend on making it multiplayer-compatible in order for the tids to always refer to the living players, rather than only the ones that spawned when the map started:

Code: Select all

script 300 ENTER 
{ 
    Thing_ChangeTID(0, 99); 
}

script 301 DEATH 
{ 
    Thing_ChangeTID(0, 0); 
}

script 302 RESPAWN 
{ 
    Thing_ChangeTID(0, 99); 
}
This will remove the tid from a player corpse when that player dies, and reassign it to them when they respawn. (It's also a good idea to move the script no.'s above 255 if you don't plan on calling them in the map from a line)
User avatar
Tormentor667
Posts: 13556
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Post by Tormentor667 »

Thx Kate, that does the jop :)
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Do the JOP!(tm) Come on everybody, do the JOP!(tm)


ANYWAY....


Why would you want every player to have the same TID? You won't be able to single them out for any actions that way. :(

If you're just using it to determine whether a player triggered a script or something, this will work just as well:

Code: Select all

if (ActivatorTID() > 98 && ActivatorTID() < 107) // Player
Or just give your players TIDs starting at 9000 or something and make sure nothing has a higher TID. Then you can use an even easier check:

Code: Select all

if (ActivatorTID() >= 9000) // Player
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

Don't forget the wonderful function [wiki]PlayerNumber[/wiki]! You can use it to give each player a unique TID in an obvious range with a single script:

Code: Select all

script 1 ENTER
{
   Thing_ChangeTID(0, 99 + PlayerNumber());
}
And you can use it to determine if a player activated a script:

Code: Select all

script 2 (void)
{
   if( PlayerNumber() != -1 )
   {
       // Stuff
   }
}
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

That too.
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

There are some functions that can't be easily made to check whole ranges of IDs since they'd override each other. Thing_Hate comes to mind... are there others? If so, I can see why this might be desired.
User avatar
Tormentor667
Posts: 13556
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Post by Tormentor667 »

@Risen - Exactly, I need the usage of Thing_Hate for this to make sure that a number of new spawned enemies start intantly to look for players on the map (actually only "Player" as it is a SP only map)
Locked

Return to “Editing (Archive)”