MantisBT - Zandronum
View Issue Details
0003163Zandronum[All Projects] Bugpublic2017-06-22 02:002017-06-23 15:31
eagle 
 
normalminoralways
closedno change required 
WindowsWindows Server 2012 R2
3.0-beta 
 
0003163: ACS - SetActivatorToTarget - not working
SetActivatorToTarget - not working
In version 2.1.2 - works correctly.
script Hem_StFiendGrndAttack (void)
{
    int old_activator = UniqueTID();
    Thing_ChangeTID(0,old_activator);
    delay(1);
    int fiend_health = GetActorProperty(old_activator,APROP_Health);
    SetActorProperty(old_activator,APROP_Health,0);
    if (SetActivatorToTarget(old_activator))
    {
        int target_tid = ActivatorTID();
        delay(random(105,210));//3-6 seconds
        SetActorState(old_activator,"DontRaise");
        int x = GetActorX(target_tid);
        int y = GetActorY(target_tid);
        int z = GetActorFloorZ(target_tid);
        int new_fiend_tid = UniqueTID();
        SpawnForced("StoneFiend",x,y,z,new_fiend_tid,0);
        SetActorProperty(new_fiend_tid,APROP_Health,fiend_health);
        SetActorState(new_fiend_tid,"RaiseUnderTarget");
        ACS_ExecuteAlways(Hem_MarkVictim,0,new_fiend_tid,target_tid);
    }
    terminate;
}

Instead of target of the monster, which is one of the players - the target is the monster himself, as a result - coordinates are taken from the monster itself, and not from the player аctor.

Вместо цели монстра, которой является однин из игроков - цель сам монстр, в результате - координаты берутся от положения монстра, а не от игрока.
No tags attached.
Issue History
2017-06-22 02:00eagleNew Issue
2017-06-22 03:32Ru5tK1ngNote Added: 0017866
2017-06-22 07:14eagleNote Added: 0017868
2017-06-22 07:15eagleNote Added: 0017869
2017-06-22 07:24eagleNote Edited: 0017868bug_revision_view_page.php?bugnote_id=17868#r10715
2017-06-22 07:25eagleNote Edited: 0017868bug_revision_view_page.php?bugnote_id=17868#r10716
2017-06-22 08:45IvanNote Added: 0017870
2017-06-23 13:41eagleNote Added: 0017885
2017-06-23 15:31Ru5tK1ngNote Added: 0017889
2017-06-23 15:31Ru5tK1ngStatusnew => closed
2017-06-23 15:31Ru5tK1ngResolutionopen => no change required

Notes
(0017866)
Ru5tK1ng   
2017-06-22 03:32   
It would be better with an actual test wad, but from the looks of your code, the reason why the target is the monster and not the player is because of this:

SetActorProperty(old_activator,APROP_Health,0);

Since the monster is dead and wasn't killed by the player, it has no target. The zdoom wiki says: If the actor(monster) has no target, the activator is the actor(monster) itself.

There were some changes to pointers with this commit that is in 3.0:'https://github.com/coelckers/gzdoom/commit/5d65ab6e6c21e1efeffe1ad41783ed3bcb17b557 [^]'

which is probably why that code worked in with 2.1.2
(0017868)
eagle   
2017-06-22 07:14   
(edited on: 2017-06-22 07:25)
The call of a script occurs so:

    Pain:
        TNT1 A 0
        TNT1 A 0 A_ChangeFlag("NOPAIN",1)
        STDE H 3
        TNT1 A 0 A_Jump(160,"FakeDeath")
        STDE H 3 A_Pain
        Goto See
    RaiseUnderTarget:
        TNT1 A 0
        TNT1 A 0 A_UnsetSolid
        TNT1 A 0 A_SetInvulnerable
        STDE OP 3 A_CustomMissile("SmokeFX",Random(10,40),0,random(0,360),2,random(0,360))
        STDE NM 3 A_SpawnItemEx("Debris",0,0,0,Random(4,-4),Random(4,-4),Random(4,8),0,SXF_NOCHECKPOSITION|SXF_CLIENTSIDE)
        TNT1 A 0 A_Explode(random(60,90),120,0)
        TNT1 A 0 A_Blast(0,100,120,10)
        TNT1 A 0 A_PlaySound("StoneArmor/Destroy",0,1.5,0)
        STDE LK 3 A_CustomMissile("SmokeFX",Random(10,40),0,random(0,360),2,random(0,360))
        STDE JI 3 A_SpawnItemEx("Debris",0,0,0,Random(4,-4),Random(4,-4),Random(4,8),0,SXF_NOCHECKPOSITION|SXF_CLIENTSIDE)
        TNT1 A 0 A_UnSetInvulnerable
        TNT1 A 0 A_SetSolid
        GoTo See
    FakeDeath:
        TNT1 A 0
        TNT1 A 0 A_SetUserVar("user_fake_death",1)
        TNT1 A 0 A_UnsetSolid
        TNT1 A 0 A_UnsetShootable
        TNT1 A 0 A_ChangeFlag("COUNTKILL",0)
        TNT1 A 0 A_ChangeFlag("CORPSE",1)
        TNT1 A 0 ACS_ExecuteAlways(Hem_StFiendGrndAttack,0)
        STDE I 5 A_CustomMissile("SmokeFX",Random(10,40),0,random(0,360),CMF_AIMDIRECTION,random(0,360))
        TNT1 AAAA 0 A_SpawnItemEx("Debris",0,0,0,Random(4,-4),Random(4,-4),Random(4,8),0,SXF_CLIENTSIDE,0)
        STDE J 5 A_Scream
        STDE K 5 A_CustomMissile("SmokeFX",Random(10,40),0,random(0,360),CMF_AIMDIRECTION,random(0,360))
        TNT1 AAAA 0 A_SpawnItemEx("Debris",0,0,0,Random(4,-4),Random(4,-4),Random(4,8),0,SXF_CLIENTSIDE,0)
        TNT1 A 0 A_SpawnItemEx("LifeEssence",0,0,0,random(0,4),random(0,4),2,random(0,360),0,32)
        TNT1 A 0 A_SpawnItemEx("ArmorBonusMax",0,0,0,random(0,4),random(0,4),2,random(0,360),0,32)
        STDE L 5
        STDE MNOP 4
        STDE Q 525
        Goto DontRaise

    DontRaise:
        STDE Q 1 A_FadeOut(0.1,1)
        Loop

(0017869)
eagle   
2017-06-22 07:15   
TNT1 A 0 A_ChangeFlag("CORPSE",1) - lost target?
(0017870)
Ivan   
2017-06-22 08:45   
Try giving "+QUICKTORETALIATE" to your player and then try.
(0017885)
eagle   
2017-06-23 13:41   
I have changed the script, it work.

script Hem_StFiendGrndAttack (void)
{
    int old_activator = UniqueTID();
    Thing_ChangeTID(0,old_activator);
    if (SetActivatorToTarget(old_activator))
    {
        int target_tid = ActivatorTID();
        int fiend_health = GetActorProperty(old_activator,APROP_Health);
        SetActorProperty(old_activator,APROP_Health,0);
        delay(random(105,210));//3-6 seconds
        SetActorState(old_activator,"DontRaise");
        int x = GetActorX(target_tid);
        int y = GetActorY(target_tid);
        int z = GetActorFloorZ(target_tid);
        int new_fiend_tid = UniqueTID();
        SpawnForced("StoneFiend",x,y,z,new_fiend_tid,0);
        SetActorProperty(new_fiend_tid,APROP_Health,fiend_health);
        SetActorState(new_fiend_tid,"RaiseUnderTarget");
        ACS_ExecuteAlways(Hem_MarkVictim,0,new_fiend_tid,target_tid);
    }
    terminate;
}
(0017889)
Ru5tK1ng   
2017-06-23 15:31   
If the script works then there is nothing here to do.