Jump to content

Photo

What are all the variables you can use with npc pointer?


  • Please log in to reply
4 replies to this topic

#1 idontknow8

idontknow8

    Senior

  • Members

Posted 05 June 2017 - 12:31 AM

I want to know what properties, "variables", you can use with npc pointer when scripting.

Thanks!



#2 cavthena

cavthena

    Apprentice

  • Members
  • Real Name:Clayton
  • Location:I wish I knew

Posted 05 June 2017 - 12:54 AM

everything your after is located in std.zh. If you open zscript.txt (comes with ZC) it'll tell you every function and variable for each namespace and class. You can also look in std_constants.zh for all constants you can use while coding.



#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 05 June 2017 - 05:39 AM

NPC Variables and Functions for 2.50.x

 
    bool isValid();            ZASM Instruction:
                               ISVALIDNPC
    /**
    * Returns whether or not this NPC pointer is still valid. A pointer
    * becomes invalid if the enemy dies or Link leaves the screen.
    * Trying to access any variable of an invalid NPC pointer prints
    * an error to allegro.log and does nothing.
    */

/************************************************************************************************************/

    void GetName(int buffer[]);    ZASM Instruction:
                                   NPCNAME
    /**
    * Loads the npc's name into 'buffer'. To load an NPC from an ID rather than a pointer,
    * use 'GetNPCName' from std.zh
    */

/************************************************************************************************************/

    int ID;                ZASM Instruction:
                           NPCID
    /**
    * The NPC's enemy ID number.
    * npc->ID is read-only; while setting it is not syntactically incorrect, it does nothing.
    */

/************************************************************************************************************/

    int Type;            ZASM Instruction:
                         NPCTYPE
    /**
    * The NPC's Type. Use the NPCT_ constants in std.zh to compare this value.
    * npc->Type is read-only; while setting it is not syntactically incorrect, it does nothing.
    */

/************************************************************************************************************/

    int X;                ZASM Instruction:
                          NPCX
    /**
    * The NPC's current X coordinate, in pixels. Float values passed to this will be cast to int.
    */

/************************************************************************************************************/

    int Y;                ZASM Instruction:
                          NPCY
    /**
    * The NPC's current Y coordinate, in pixels. Float values passed to this will be cast to int.
    */

/************************************************************************************************************/

    int Z;                ZASM Instruction:
                          NPCZ
    /**
    * The NPC's current Z coordinate, in pixels. Float values passed to this will be cast to int.
    */
    
/************************************************************************************************************/

    int Jump;            ZASM Instruction:
                         NPCJUMP
    /**
    * The NPC's upward velocity, in pixels. If negative, the NPC will fall.
    * The downward acceleration of Gravity (in Init Data) modifies this value every frame.
    */

/************************************************************************************************************/

    int Dir;            ZASM Instruction:
                        NPCDIR
    /**
    * The direction the NPC is facing. Use the DIR_ constants in std.zh to
    * set and compare this value.
    */

/************************************************************************************************************/

    int Rate;            ZASM Instruction:
                         NPCRATE
    /**
    * The rate at which the NPC changes direction. For a point of reference,
    * the "Octorok (Magic)" enemy has a rate of 16. The effect of writing to
    * this field is currently undefined.
    */

/************************************************************************************************************/

    int Haltrate;            ZASM Instruction:
                             NPCHALTRATE
    /**
    * The extent to which the NPC stands still while moving around the
    * screen. As a point of reference, the Zols and Gels have haltrate of
    * 16. The effect of writing to this field is currently undefined.
    */

/************************************************************************************************************/

    int Homing;            ZASM Instruction:
                           NPCHOMING
    /**
    * How likely the NPC is to move towards Link.
    * The effect of writing to this field is currently undefined.
    */

/************************************************************************************************************/

    int Hunger;            ZASM Instruction:
                           NPCHUNGER
    /**
    * How likely the NPC is to move towards bait.
    * The effect of writing to this field is currently undefined.
    */

/************************************************************************************************************/

    int Step;            ZASM Instruction:
                         NPCSTEP
    /**
    * The NPC's movement speed. A Step of 100 usually means that
    * the enemy moves at approximately one pixel per animation frame.
    * As a point of reference, the "Octorok (Magic)" enemy has
    * a step of 200. The effect of writing to this field is
    * currently undefined.
    */

/************************************************************************************************************/

    bool CollDetection;        ZASM Instruction:
                               NPCCOLLDET
    /**
    * Whether the NPC will use the system's code to work out collisions with Link
    * Initialised as 'true'.
    */

/************************************************************************************************************/

    int ASpeed;            ZASM Instruction:
                           NPCFRAMERATE
    /**
    * The the NPC's animation frame rate, in screen frames. The effect of
    * writing to this field is currently undefined.
    */

/************************************************************************************************************/

    int DrawStyle;            ZASM Instruction:
                              NPCDRAWTYPE
    /**
    * The way the NPC is animated. Use the DS_ constants in std.zh to set or
    * compare this value. The effect of writing to this field is currently undefined.
    */

/************************************************************************************************************/

    int HP;                ZASM Instruction:
                           NPCHP
    /**
    * The NPC's current hitpoints. A weapon with a Power of 1 removes 2
    * hitpoints.
    */

/************************************************************************************************************/

    int Damage;            ZASM Instruction:
                           NPCDP
    /**
    * The amount of damage dealt to an unprotected Link when he touches this NPC, in
    * quarter-hearts.
    */

/************************************************************************************************************/

    int WeaponDamage;        ZASM Instruction:
                             NPCWDP
    /**
    * The amount of damage dealt to an unprotected Link by this NPC's weapon, in
    * quarter-hearts.
    */

/************************************************************************************************************/

    int Stun;            ZASM Instruction:
                         NPCSTUN
    /**
    * The time, in frames, that the NPC will be stunned. Some types of enemies cannot be stunned.
    */

/************************************************************************************************************/

    int OriginalTile;        ZASM Instruction:
                             NPCOTILE
    /**
    * The number of the starting tile used by this NPC.
    */

/************************************************************************************************************/

    int Tile;            ZASM Instruction:
                         NPCTILE
    /**
    * The current tile associated with this NPC. The effect of writing to this variable is undefined.
    */

/************************************************************************************************************/

    int Weapon;            ZASM Instruction:
                           NPCWEAPON
    /**
    * The weapon used by this enemy. Use the WPN_ constants (NOT the EW_ constants)
    * in std.zh to set or compare this value.
    */

/************************************************************************************************************/

    int ItemSet;            ZASM Instruction:
                            NPCITEMSET
    /**
    * The items that the NPC might drop when killed. Use the IS_ constants
    * in std.zh to set or compare this value.
    */

/************************************************************************************************************/

    int CSet;            ZASM Instruction:
                         NPCCSET
    /**
    * The CSet used by this NPC.
    */

/************************************************************************************************************/

    int BossPal;            ZASM Instruction:
                            NPCBOSSPAL
    /**
    * The boss pallete used by this NPC; this pallete is only used if CSet
    * is 14 (the reserved boss cset). Use the BPAL_ constants in std.zh to
    * set or compare this value.
    */

/************************************************************************************************************/

    int SFX;            ZASM Instruction:
                        NPCBGSFX
    /**
    * The sound effects emitted by the enemy. Use the SFX_ constants in
    * std.zh to set or compare this value.
    */

/************************************************************************************************************/

    int Extend;            ZASM Instruction:
                           NPCEXTEND
    /**
    * Whether to extend the sprite of the enemy.
    */

/************************************************************************************************************/

    int TileWidth;            ZASM Instruction:
                              NPCTXSZ
    /**
    * The number of tile columns composing the sprite.
    * Writing to this is ignored unless Extend is set to values >=3.
    */

/************************************************************************************************************/

    int TileHeight;            ZASM Instruction:
                               NPCTYSZ
    /**
    * The number of tile rows composing the sprite.
    * Writing to this is ignored unless Extend is set to values >=3.
    */
    
/************************************************************************************************************/

    int HitWidth;            ZASM Instruction:
                             NPCHXSZ
    /**
    * The width of the sprite's hitbox, or collision rectangle.
    */

/************************************************************************************************************/

    int HitHeight;            ZASM Instruction:
                              NPCHYSZ
    /**
    * The height of the sprite's hitbox, or collision rectangle.
    */
    
/************************************************************************************************************/

    int HitZHeight;            ZASM Instruction:
                               NPCHZSZ
    /**
    * The Z-axis height of the sprite's hitbox, or collision rectangle.
    * The greater it is, the higher Link must jump or fly over the sprite to avoid taking damage.
    * To jump over a sprite, you must be higher than its Z + HitZHeight.
    * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
    */

/************************************************************************************************************/

    int HitXOffset;            ZASM Instruction:
                               NPCHXOFS
    /**
    * The X offset of the sprite's hitbox, or collision rectangle.
    * Setting it to positive or negative values will move the sprite's hitbox left or right.
    */

/************************************************************************************************************/

    int HitYOffset;            ZASM Instruction:
                               NPCHYOFS
    /**
    * The Y offset of the sprite's hitbox, or collision rectangle.
    * Setting it to positive or negative values will move the sprite's hitbox up or down.
    */

/************************************************************************************************************/

    int DrawXOffset;        ZASM Instruction:
                            NPCXOFS
    /**
    * The X offset of the sprite.
    * Setting it to positive or negative values will move the sprite's tiles left or right relative to its position.
    */

/************************************************************************************************************/

    int DrawYOffset;        ZASM Instruction:
                            NPCYOFS
    /**
    * The Y offset of the sprite. In non-sideview screens, this is usually -2.
    * Setting it to positive or negative values will move the sprite's tiles up or down relative to its position.
    */

/************************************************************************************************************/

    int DrawZOffset;        ZASM Instruction:
                            NPCZOFS
    /**
    * The Z offset of the sprite. This is ignored unless Extend is set to values >=3.
    * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.  
    */

/************************************************************************************************************/

    int Defense[];            ZASM Instruction:
                              NPCDEFENSED
    /**
    * The npc's Defense values, as an array of 18 integers. Use the NPCD_ and NPCDT_ constants
    * in std.zh to set or compare these values.
    */

/************************************************************************************************************

    int Attributes[];        ZASM Instruction:
                             NPCDD
    /**
    * The npc's Miscellaneous Attributes, as an array of ten integers.
    * They are read-only; while setting them is not syntactically incorrect, it does nothing.
    */

/************************************************************************************************************/

    int MiscFlags;            ZASM Instruction:
                              NPCMFLAGS
    /**
    * The npc's Misc. Flags as 14 bits ORed together, starting with 'Damaged by Power 0 Weapons',
    * and working down the flags in the order they are shown in the Enemy Editor.
    * npc->MiscFlags is read-only; while setting it is not syntactically incorrect, it does nothing.
    * If you are not comfortable with binary operations, you can use 'GetNPCMiscFlag' from std.zh
    */

/************************************************************************************************************/

    float Misc[16];            ZASM Instruction:
                               NPCMISCD
    /**
    * An array of 16 miscellaneous variables for you to use as you please.
    */
    
/************************************************************************************************************/

    void BreakShield();        ZASM Instruction:
                               BREAKSHIELD
    /**
    * Breaks the enemy's shield if it has one. This works even if the flag
    * "Hammer Can Break Shield" is not checked.
    */


/************************************************************************************************************/

Edited by ZoriaRPG, 05 June 2017 - 05:45 AM.


#4 idontknow8

idontknow8

    Senior

  • Members

Posted 05 June 2017 - 05:03 PM

Thank you so much for the info!  That's really helpful...now it's just really too bad that many of these variables can't actually be written to.



#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 06 June 2017 - 03:40 AM

Writing to Rate, HaltRate, Hunger, and Step all work, but writing to Rate may have problems, as while an npc is moving next to a solid object, changing n->Rate may cause the internal CanWalk to misjudge solidity.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users