[ACS] (SOLVED)Question about Player TID and summons/projectiles
[ACS] Re: Question about Player TID and summons/projectiles
Sigh....
You use the TID on the projectile to access it, obviously...
You use the TID on the projectile to access it, obviously...
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
- FranckyFox2468
- Forum Regular
- Posts: 180
- Joined: Sat May 07, 2016 8:30 pm
[ACS] Re: Question about Player TID and summons/projectiles
Okay, how do you do that? Cause you keep telling me to do stuff as if i knew it but never explain how.Ivan wrote:Sigh....
You use the TID on the projectile to access it, obviously...
Don't think i'd be asking in the first place if i did.
Thanks for that, ill try it out.Konda wrote:I'm not sure but I think the first state after the Spawn label shouldn't have any action function at all, and even if you put an action function in the first state the engine is just gonna ignore it.
Anyway, if you wanna return control of the script to the projectile, you first need to assign a unique tid to the projectile (you can use UniqueTID(1)) before setting the activator to the player, so later you can use the unique tid in SetActivator to set the projectile as the activator of the script again. Idk about this actor pointer stuff but this is how it's been done for a while now.
[ACS] Re: Question about Player TID and summons/projectiles
@Ivan, you told him to set the projectile's TID in the projectile's spawn state, but you didn't tell him how to do that. I would tell him how, but I don't know, either. I searched the ZDoom wiki, and I can't find it. It tells how to give a thing a Spawn ID and a Conversation ID, but not how to give a thing a TID.
@FranckyFox, once you have given the projectile a TID (like 30000), using the method I hope Ivan will tell us, you then use ThingChangeTID (30000, 1000 + pnum); in your script.
@FranckyFox, once you have given the projectile a TID (like 30000), using the method I hope Ivan will tell us, you then use ThingChangeTID (30000, 1000 + pnum); in your script.
"For the world is hollow, and I have touched the sky."
- FranckyFox2468
- Forum Regular
- Posts: 180
- Joined: Sat May 07, 2016 8:30 pm
[ACS] Re: Question about Player TID and summons/projectiles
Okay so, with some assistance from Konda's advice and a friend i managed to make this work:
the problem now is... that it will only work for 1 sticky bomb at the time. If they are shot one by one its fine, but if for instance i free time or something, when i use the detonator only 1 will explode. I am not sure how to fix this.
EDIT: Fixed that withh ACS_Executealways. Anyway thanks a lot Kondu. I should be good to keep going with this technique! ...for now... I'll have to test monsters now...
EDIT2: Nope, i tried this with a monster and a master relation:
It works perfectly fine on GZdoom but won't work at all on zandro. Zandro seems to ignore any form of master relationships. Not sure if there is a workaround that.
Code: Select all
script 700 (VOID) NET
{
int ProjecID = UniqueTID();
Thing_ChangeTID(0, ProjecID);
SetActivator(0, AAPTR_TARGET);
int pnum = PlayerNumber();
SetActivator(ProjecID);
Thing_ChangeTID(0, 1000 + pnum);
}
script 701 (VOID) NET
{
Thing_Damage2((PlayerNumber() + 1000 ), 999,"detonator");
}
script 702 DEATH
{
SetActorState ((PlayerNumber() + 1000 ), "Canceled", TRUE);
}
EDIT: Fixed that withh ACS_Executealways. Anyway thanks a lot Kondu. I should be good to keep going with this technique! ...for now... I'll have to test monsters now...
EDIT2: Nope, i tried this with a monster and a master relation:
Code: Select all
script 702 DEATH
{
SetActorState ((PlayerNumber() + 1000 ), "Canceled", TRUE);
Thing_Destroy((PlayerNumber() + 2000 ));
}
script 800 (VOID) NET
{
int MonsterID = UniqueTID();
Thing_ChangeTID(0, MonsterID);
SetActivator(0, AAPTR_MASTER);
int pnum = PlayerNumber();
SetActivator(MonsterID);
Thing_ChangeTID(0, 2000 + pnum);
}
Code: Select all
TNT1 A 0 A_SpawnItemEx ("NootTurret", 56, 0, 5, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION|SXF_SETMASTER)
[ACS] Re: Question about Player TID and summons/projectiles
You could replace the last two lines of script 700 with this one line:
Thing_ChangeTID(ProjecID, 1000 + pnum);
And similar for script 800.
Thing_ChangeTID(ProjecID, 1000 + pnum);
And similar for script 800.
"For the world is hollow, and I have touched the sky."
- FranckyFox2468
- Forum Regular
- Posts: 180
- Joined: Sat May 07, 2016 8:30 pm
[ACS] Re: Question about Player TID and summons/projectiles
No script 700 works like a charm. But 800 completely ignores the master relationship. So i went to try Ru5tK1ng's matter because if i understand, the TID section assigns a TID on top of the player number apparently:Empyre wrote:You could replace the last two lines of script 700 with this one line:
Thing_ChangeTID(ProjecID, 1000 + pnum);
And similar for script 800.
Code: Select all
TNT1 A 0 A_SpawnItemEx ("NootTurret", 56, 0, 5, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION|SXF_SETMASTER, 0, 2000)
[ACS] Re: Question about Player TID and summons/projectiles
I think you can take advantage of the fact that any spawned actor's first target is the actor (or player) which spawned it, until it executes A_Look or gets hurt. So if the spawned actor executes a script as soon as it's spawned, you can use SetActivatorToTarget instead of this actor pointer stuff.
Edit: Also please remove that "NET" from script 800 as that allows the players to execute the script from the console with the "puke" command... with them being the initial activator...
Edit: Also please remove that "NET" from script 800 as that allows the players to execute the script from the console with the "puke" command... with them being the initial activator...
- FranckyFox2468
- Forum Regular
- Posts: 180
- Joined: Sat May 07, 2016 8:30 pm
[ACS] Re: Question about Player TID and summons/projectiles
Using your technique it ignores player death in both zandronum and gzdoom. With SetActivator(0, AAPTR_MASTER); it works on gzdoom atleast.Konda wrote:I think you can take advantage of the fact that any spawned actor's first target is the actor (or player) which spawned it, until it executes A_Look or gets hurt. So if the spawned actor executes a script as soon as it's spawned, you can use SetActivatorToTarget instead of this actor pointer stuff.
Code: Select all
script 800 (VOID) NET
{
int MonsterID = UniqueTID();
Thing_ChangeTID(0, MonsterID);
SetActivatorToTarget(0);
int pnum = PlayerNumber();
SetActivator(MonsterID);
Thing_ChangeTID(0, 2000 + pnum);
}
Code: Select all
TNT1 A 0 A_SpawnItemEx ("NootTurret", 56, 0, 5, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION|SXF_SETMASTER)
And done. My bad ^^'Konda wrote: Edit: Also please remove that "NET" from script 800 as that allows the players to execute the script from the console with the "puke" command... with them being the initial activator...
[ACS] Re: Question about Player TID and summons/projectiles
My suggestion wasn't a fix for something broken, but a way to do the same thing with one fewer lines of code.FranckyFox2468 wrote:No script 700 works like a charm. But 800 completely ignores the master relationship. So i went to try Ru5tK1ng's matter because if i understand, the TID section assigns a TID on top of the player number apparently:Empyre wrote:You could replace the last two lines of script 700 with this one line:
Thing_ChangeTID(ProjecID, 1000 + pnum);
And similar for script 800.Doesn't do shit. Turret remains regardless if player dies or not. And i can't use master relation since zandro seems to give no shit about it. Works perfectly on Gzdoom but i want my mod to be multiplayer compatible so i won't really go anyhwere with that. and SXF_SETTARGET crashes the game.Code: Select all
TNT1 A 0 A_SpawnItemEx ("NootTurret", 56, 0, 5, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION|SXF_SETMASTER, 0, 2000)
If you want to kill everything made by the player, turrets and projectiles alike, maybe A_KillChildren or A_RemoveChildren is what you want.
"For the world is hollow, and I have touched the sky."
[ACS] Re: Question about Player TID and summons/projectiles
For multiple projectile support now you need to devise a careful formula to distribute to your projectiles.
One such as this, will work: (assuming a max of 5 can be out there at once and the detonation blows up ANY bomb placed by you)
Thing_ChangeTID(0, PlayerNumber() + 1000 + 64 + (5 - 1) * PlayerNumber() + CheckInventory("BombsOutThere"));
The key thing to know is the "BombsOutThere" item, which you give from the projectile to the player in its spawn state using A_GiveToTarget. This will help keep track of the count of active bombs of the player. So when you put another bomb you'll correctly assign the proper TID. Important thing to note here is that, you must check the inventory of the "target" aka the player, not the projectile! It won't work otherwise.
Rundown of the formula:
- Assume TID 1001 on player. (This is PlayerNumber() + 1000, so pnum is 1)
- Assume you're shooting projectiles.
- TID order: 1 + 1000 + 64 + 4 * 1 + 0 => 1069 (This makes sense, because player 0's bombs will start from 1064 and end at 1068, which is 5), then 1070 and so on, ending at 1073. (Because the "BombsOutThere" item will be incremented as you put out more)
I hope it's clear now.
One such as this, will work: (assuming a max of 5 can be out there at once and the detonation blows up ANY bomb placed by you)
Thing_ChangeTID(0, PlayerNumber() + 1000 + 64 + (5 - 1) * PlayerNumber() + CheckInventory("BombsOutThere"));
The key thing to know is the "BombsOutThere" item, which you give from the projectile to the player in its spawn state using A_GiveToTarget. This will help keep track of the count of active bombs of the player. So when you put another bomb you'll correctly assign the proper TID. Important thing to note here is that, you must check the inventory of the "target" aka the player, not the projectile! It won't work otherwise.
Rundown of the formula:
- Assume TID 1001 on player. (This is PlayerNumber() + 1000, so pnum is 1)
- Assume you're shooting projectiles.
- TID order: 1 + 1000 + 64 + 4 * 1 + 0 => 1069 (This makes sense, because player 0's bombs will start from 1064 and end at 1068, which is 5), then 1070 and so on, ending at 1073. (Because the "BombsOutThere" item will be incremented as you put out more)
I hope it's clear now.
Like this:Empyre wrote:@Ivan, you told him to set the projectile's TID in the projectile's spawn state, but you didn't tell him how to do that. I would tell him how, but I don't know, either. I searched the ZDoom wiki, and I can't find it. It tells how to give a thing a Spawn ID and a Conversation ID, but not how to give a thing a TID.
Code: Select all
Spawn:
TNT1 A 0 NoDelay Thing_ChangeTID(0, 3000)
...
If he knows the TID of things to kill (using a formula like above) he can just use Thing_Damage or Thing_Damage2.Empyre wrote: If you want to kill everything made by the player, turrets and projectiles alike, maybe A_KillChildren or A_RemoveChildren is what you want.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
- FranckyFox2468
- Forum Regular
- Posts: 180
- Joined: Sat May 07, 2016 8:30 pm
[ACS] Re: Question about Player TID and summons/projectiles
I'll check ivan's thing when i'm a little more woke up and in the mood for doom modding, but thanks in advance for the post.
EDIT: My problem is not projectiles anymore but monsters rn. They ignore completely target/master relationships for some reason.
My code works but only on gzdoom. But a problem i run in is that it seems to ignore targetting as well. I use the latest build of zandro 3.0 on top of that so its really weird.
Ima put my wad for people to check directly but just a fair warning some coding is pretty messy and mostly contains leftovers of a scrapped mod i used for prototyping.
https://mega.nz/#!NBVFTbLb!PNHnMhtMyIp9 ... x119KyTD0U
Item in question is NootturretD, (Btw don't scream at the way i code please i won't really see that as constructive critisism). Upon using the item you spawn a turret. What it is supposed to do that any versions of zandro completely ignores is when the player dies, the turret dies as well, and if a turret is already deployed and you spawn another, the last turret dies. While you are at it you can witness the sticky bombs from its launcher (slot 5) works perfectly using the almost exact same code for some reason.
So yeah it works on GZDOOM but right now the issue is that i want it to work for zandro and since it refuses to work i'll need help finding a work-around :/
EDIT: My problem is not projectiles anymore but monsters rn. They ignore completely target/master relationships for some reason.
I literally just said zandronum ignores completely any form of master/child relation ship between the player and a monster regardless of what i do no matter the version last night.Empyre wrote: If you want to kill everything made by the player, turrets and projectiles alike, maybe A_KillChildren or A_RemoveChildren is what you want.
My code works but only on gzdoom. But a problem i run in is that it seems to ignore targetting as well. I use the latest build of zandro 3.0 on top of that so its really weird.
Ima put my wad for people to check directly but just a fair warning some coding is pretty messy and mostly contains leftovers of a scrapped mod i used for prototyping.
https://mega.nz/#!NBVFTbLb!PNHnMhtMyIp9 ... x119KyTD0U
Item in question is NootturretD, (Btw don't scream at the way i code please i won't really see that as constructive critisism). Upon using the item you spawn a turret. What it is supposed to do that any versions of zandro completely ignores is when the player dies, the turret dies as well, and if a turret is already deployed and you spawn another, the last turret dies. While you are at it you can witness the sticky bombs from its launcher (slot 5) works perfectly using the almost exact same code for some reason.
So yeah it works on GZDOOM but right now the issue is that i want it to work for zandro and since it refuses to work i'll need help finding a work-around :/
Last edited by FranckyFox2468 on Sun Aug 27, 2017 3:29 pm, edited 1 time in total.
[ACS] Re: Question about Player TID and summons/projectiles
I thought that you can only use the functions that start with A_ in DECORATE.Ivan wrote:Code: Select all
Spawn: TNT1 A 0 NoDelay Thing_ChangeTID(0, 3000) ...
"For the world is hollow, and I have touched the sky."
- FranckyFox2468
- Forum Regular
- Posts: 180
- Joined: Sat May 07, 2016 8:30 pm
[ACS] Re: Question about Player TID and summons/projectiles
Nope, you can use all variants of ACS_Execute in decorate as well and many other things. Trust me i was surprised too when i found out.Empyre wrote:I thought that you can only use the functions that start with A_ in DECORATE.Ivan wrote:Code: Select all
Spawn: TNT1 A 0 NoDelay Thing_ChangeTID(0, 3000) ...
- FranckyFox2468
- Forum Regular
- Posts: 180
- Joined: Sat May 07, 2016 8:30 pm
[ACS] Re: Question about Player TID and summons/projectiles
So a friend got me into a lead for a mod called Humans vs Ghouls: Nordic Saga that managed to do what i tried to do. I went to get it with doomseeker (cause all links on this forum were dead) and it partially works with some issues (such as if you die and respawn, you spawn dummy neutral sentries for some reason) but figured these could be issues that could be fixed.
But the real problem was, it was encrypted ACS stuff with no text file containing the stuff.
Guess i'll remain stuck in the mean time and if i don't find help or a workaround this issue i'll have to scrap this project .-.
Doesn't help that zandro puts master/child/target or whatever relationship between the summoner player and the monster has up its arse, cause most working solutions using player numbers i was offered involved that so...
edit: HAHA! i think i finally managed to understand what Ivan has been trying to tell me! Cause it works!
So i think i finally have this solved! Thanks for the help everyone!
But the real problem was, it was encrypted ACS stuff with no text file containing the stuff.
Guess i'll remain stuck in the mean time and if i don't find help or a workaround this issue i'll have to scrap this project .-.
Doesn't help that zandro puts master/child/target or whatever relationship between the summoner player and the monster has up its arse, cause most working solutions using player numbers i was offered involved that so...
edit: HAHA! i think i finally managed to understand what Ivan has been trying to tell me! Cause it works!
Code: Select all
TNT1 A 0 A_SpawnItemEx ("NootTurret", 56, 0, 5, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION|SXF_SETMASTER, 0, tid)
Code: Select all
script 702 DEATH
{
SetActorState ((PlayerNumber() + 1000 ), "Canceled", TRUE);
Thing_Destroy((PlayerNumber() + 12000 ));
}
script 800 (VOID)
{
int TurrID = ActivatorTID();
Thing_ChangeTID(0, 2000 + TurrID);
}