From ZDoom Wiki
Jump to: navigation, search

A_TakeFromTarget (string type, int count[, int flags[, pointer takefrom]])


Removes count items of type type from the inventory of the actor's current target. The minimum amount of item of a type in an inventory is zero, removing a greater amount than what the target actually possesses will not result in a negative amount.

There is at the moment only one flag:

  • TIF_NOTAKEINFINITE: If this flag is set, nothing is taken if the type is an Ammo and the target is a player who benefits from infinite ammo (either from a powerup or a cheat).

If takefrom is specified, then instead of the calling actor's target, the item will be taken from a different actor depending on the calling actor's target's own pointers.


This demon tries to run up to you and steal your ammo!

ACTOR BanditDemon : Demon
        SARG E 8 A_FaceTarget
        SARG E 0 A_TakeFromTarget("Clip", 1)
        SARG E 0 A_TakeFromTarget("Shell", 1)
        SARG E 0 A_TakeFromTarget("RocketAmmo", 1)
        SARG E 0 A_TakeFromTarget("CellPack", 1)
        SARG E 18 A_ChangeFlag("FRIGHTENED", 1) // Demon makes a run for it
        Goto See