[SOLVED] [ACS] Problem with Thing_ProjectileIntercept

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

[SOLVED] [ACS] Problem with Thing_ProjectileIntercept

Post by Void Weaver »

For a some reason Thing_ProjectileIntercept doesn't work in my case. Where is mistake here?

Test actors:

Code: Select all

ACTOR IntImp : DoomImp replaces DoomImp
{
States
{
Missile:
TROO EF 8 A_FaceTarget
TROO G 3 A_GiveToTarget("TIDChanger") //Test line to be sure that target's TID different from 0. It changes player TID but Thing_ProjectileIntercept still not work
TROO G 3 ACS_NamedExecute("InterceptionStrike",0)
Goto See
}
}

ACTOR TIDChanger: CustomInventory
{
+INVENTORY.ALWAYSPICKUP
Inventory.MaxAmount 0
States
{
Pickup:
TNT1 A 0 Thing_ChangeTid(0,FindUniqueTid(0,0))
Stop
}
}

ACTOR IntCacoBall : CacodemonBall
{
SpawnID 666
}
ACS itself:

Code: Select all

#include "zcommon.acs"

Script "InterceptionStrike" (void)
{
int TargetTid=GetActorProperty(0,APROP_TargetTID); //Here it should receive shooter's target TID
int InterceptTid=Thing_ChangeTID(TargetTid,UniqueTID(0,0)); //Here it should change its target's TID to an unique one
Thing_ProjectileIntercept(0,666,255,InterceptTid,0); //Now projectile should be fired but it doesn't
PlaySound(0,"brain/pain"); //Test line
Delay(35*5); //Test line, time gap
Thing_ChangeTID(InterceptTid,TargetTid);
}
Last edited by Void Weaver on Sun Nov 17, 2019 8:10 am, edited 1 time in total.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: [ACS] Problem with Thing_ProjectileIntercept

Post by Blue Shadow »

Void Weaver wrote:

Code: Select all

int InterceptTid=Thing_ChangeTID(TargetTid,UniqueTID(0,0));
Thing_ChangeTID always returns true (1), not the newly set TID, as you may think.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: [SOLVED] [ACS] Problem with Thing_ProjectileIntercept

Post by Void Weaver »

Oh, thank you very much! ^_^

Now it works perfect:

Code: Select all

Script "InterceptionStrike" (void)
{
int TargetTid=GetActorProperty(0,APROP_TargetTID);
Thing_ChangeTID(TargetTid,UniqueTID(0,0));
int InterceptTid=GetActorProperty(0,APROP_TargetTID);
Thing_ProjectileIntercept(0,666,255,InterceptTid,0);
Thing_ChangeTID(InterceptTid,TargetTid);
}
I guess that Thing_ChangeTID return meaning should be pointed into its wiki article.
---
Btw, there is a some ACS way to change spawn height of missile fired by Thing_ProjectileIntercept? I've managed to did Thing_ProjectileIntercept shot with taking spawn height into account fully on deco but solution is quite spaghettysh.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: [SOLVED] [ACS] Problem with Thing_ProjectileIntercept

Post by Blue Shadow »

Void Weaver wrote:I guess that Thing_ChangeTID return meaning should be pointed into its wiki article.
I don't see a valid reason to do so.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: [SOLVED] [ACS] Problem with Thing_ProjectileIntercept

Post by Void Weaver »

But why? o_0
Post Reply

Return to “Scripting”