(SOLVED)Question about Player TID and summons/projectiles

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.

(SOLVED)Question about Player TID and summons/projectiles

Postby FranckyFox2468 » Thu Aug 24, 2017 12:32 pm

I already posted this on Zandronum and got a couple of answers but things aren't exactly clear for some of the answers i have received and i wasn't provided much script exemples yet. A friend suggested i try here as well so here i go, ill just put the original post here:
So by now i figured that assigning players TIDs is quite useful in doom. But there is one thing i wonder if its even possible to do in the first place.

So i'll start with my question, is it possible to assign a projectile or a player summon a TID with the player number so it can be used to destroy them for a DISCONNECT, RESPAWN or DEATH script?

Like i am really not sure how i would proceed in the first place because when i do so i usually use the default TARGET assignement from projectiles to verify stuff. But for instance, let's say the player shoots a sticky bomb from a gun (with a_firecustommissile or something). The sticky bomb is perhaps assigned a TID followed by a player number. Or perhaps summons a turret/monster. So if a monster/projectile with already said TID has been summoned by said player, the player dies or disconnects from the game, said monster/projectile is destroyed. (So it avoids a clusterfuck and spams if a player leaves or switch player class).

Now question is, is this possible in the first place? Cause i haven't managed to find a lead that could help me get a start at doing a such thing even by checking the wiki. It just says how to assign players TIDs but not if i can make use of them in such circumstances.

In case its not clear enough ill give some context: I want to try doing a mod where player can deploy stuff either via a_spawnitemex or a_firecustommissile. Like sticky bombs, turrets, summons. All assign themselves a TID related to the summoner player number upon a script call in their spawning state. The problem with most mods with summons and such is that if a player dies or disconnects from a multiplayer game or changes class, the stuff is still here. I want to make a script that, similar to TF2 for exemple, if upon a RESPAWN or DISCONNECT, the player is not found anymore or changed class that does not used the currently deployed summons, a script call like thing_destroy or SetActorState triggers on the TID of the summons + the player number on the script. Problem is i am not sure to proceed and if i can even use TID+player number on a TID section of a script to begin with and when i am explained i am not provided much exemples. This is mostly for an experimental prototype i intend to do so check if a certain project will be possible in the first place so if you can help it would be appreciated.

EDIT: I forgot to mention, i intend to go for zandronum compatiblity if i end up doing anything.
Last edited by FranckyFox2468 on Tue Aug 29, 2017 8:44 am, edited 1 time in total.
User avatar
FranckyFox2468
 
Joined: 28 Nov 2015

Re: Question about Player TID and summons/projectiles

Postby FranckyFox2468 » Fri Aug 25, 2017 2:15 pm

I tried a code but i am sort of stuck here for now:
Code: Select allExpand view
script 700 ///assignement
{
    SetActivator(0, AAPTR_TARGET);
    ///Set some array like "n" equal to player number somehow i dunno how to do that
    SetActivator(0, AAPTR_DEFAULT); //supposed to return to the origin, thus the projectile? So it doesn't assign the TID to the player and create a suicide button
    Thing_ChangeTID(0, 1000+n);
   
}

script 701 (int PlayerNumber) DISCONNECT

{
    Thing_Damage( PlayerNumber + 1000 ), 999, MOD_EXTREME);
   
}

script 702 RESPAWN
{
          if (Checkinventory("EngineerKit") >= 1)
      {
                terminate;
      }
      else
         {
         Thing_Damage( (PlayerNumber() + 1000 ), 999, MOD_EXTREME);
         }

script 703 ///manual detonation

{
   Thing_Damage( (PlayerNumber() + 1000 ), 999, MOD_EXTREME);
   
}
User avatar
FranckyFox2468
 
Joined: 28 Nov 2015

Re: Question about Player TID and summons/projectiles

Postby RaveYard » Mon Aug 28, 2017 2:42 pm

Something like this?

Code: Select allExpand view
#define TEMP_TID 32000 //Some unique unused TID

script 700 ///assignment
{
    //First let's hold on to the projectile
    Thing_ChangeTID(0, TEMP_TID);

    //Not sure if Zandronum supports actor pointers, so let's use this function instead.
    SetActivatorToTarget(0);
   
    //Now that a player is supposedly the activator of the script, we can get his player number and change the projectile's TID
    Thing_ChangeTID(TEMP_TID, 1000 + PlayerNumber());
}
RaveYard
 
Joined: 12 Apr 2013

Re: (SOLVED)Question about Player TID and summons/projectile

Postby FranckyFox2468 » Tue Aug 29, 2017 8:45 am

Oh crap, i forgot to mention this got solved.
Here if you are curious: https://zandronum.com/forum/viewtopic.php?f=11&t=8474
User avatar
FranckyFox2468
 
Joined: 28 Nov 2015


Return to Editing (Archive)

Who is online

Users browsing this forum: No registered users and 2 guests