Model

Model post thumbnail image

Under Construction

Models are the templates that all in game entities spawn from. The model sheet contains the animation definitions, starting properties, name, sub models, and all the other other basics needed to build an entity.

Script

Model properties are attributes possessed by models, which are in turn used as templates for entities. Animations, starting hit-points, and other properties that are mostly immutable throughout a game are kept as model properties. Model properties are accessible through the get_model_property() and set_model_property() functions.

mixed x = get_model_property(void <model pointer>, int <identifier>); 
mixed x = <value>;

set_model_property(void <model pointer>, int <identifier>, x);

It’s important to understand the difference between an entity, a model, and modeldata to avoid conflicts and causing unwanted behavior with scripts.

  • Entity: Entities are interactive objects in the game world, usually controlled directly by players or the computer. Most entity properties are mutable by nature, such as location in the game world or remaining hit points.
  • Model: Models are global templates used to create an entity. Model properties act as default values. They also house values that normally remain constant, such compiled scripts. Model pointers are available by index. Each entity also has a pointer available to the model it was created from as an entity property.
  • Modeldata: Modeldata is a partial copy of the model that is created by the entity spawn routine. It contains values for the entity that are semi-constant and set when the entity is first spawned. Examples include an alias name or maximum points. Modeldata is unique to each entity. Its pointer is available as an entity property.

This example modifies an entity’s maximum health (actually a model property) by getting the entity’s modeldata pointer, then getting and setting the model hp property.

void acting_entity = <entity>

void model_data = get_entity_property(acting_entity, openborconstant("ENTITY_PROPERTY_MODELDATA"));

int hp_current = get_model_property(model_data, openborconstant("MODEL_PROPERTY_HP"));

hp_current += 5;

set_model_property(model_data, openborconstant("MODEL_PROPERTY_HP"), hp_current);

Property List

  • Name: The openborconstant() used to access property. For example openborconstant("MODEL_PROPERTY_ANTI_GRAVITY").
  • Type: The property value’s variable type.
  • Description: A short description of what the property is and does.
NameTypeDescription
MODEL_PROPERTY_ACTION_FREEZEIntegerIf true, any entities that are not Text type freeze in place while this entity performs its Special animation. Used by legacy Smartbomb.
MODEL_PROPERTY_AIR_CONTROLIntegerFlags to configure control options during jump. See air_control.
MODEL_PROPERTY_ANTI_GRAVITYFloatModel’s resistance to gravity. Higher values impart greater resistance.

0.0 = No gravity resistance.
1.0 = Immune to gravity.
MODEL_PROPERTY_BLEND_MODEIntegerModel blend mode (“alpha”).

* openborconstant("BLEND_MODE_ALPHA")

* openborconstant("BLEND_MODE_ALPHA_NEGATIVE")

* openborconstant("BLEND_MODE_AVERAGE")

* openborconstant("BLEND_MODE_DODGE")

* openborconstant("BLEND_MODE_HARDLIGHT")

* openborconstant("BLEND_MODE_MODEL")

* openborconstant("BLEND_MODE_NONE")

* openborconstant("BLEND_MODE_OVERLAY")
MODEL_PROPERTY_BOUNCEIntegerIf true, entity has bounce effect when landing from fall.
MODEL_PROPERTY_BLOCK_CONFIG_FLAGSIntegerGeneral blocking setup. See Blocking configuration.
MODEL_PROPERTY_BLOCK_ODDSIntegerChance that AI blocks attack. See Blocking odds.
MODEL_PROPERTY_BLOCK_PAINIntegerWhen blocking an attack, the attack damage must meet or exceed this value for entity to assume a block pain animation.
MODEL_PROPERTY_BLOCK_THRESHOLDIntegerMaximum incoming attack damage entity can block. See Threshold.
MODEL_PROPERTY_CHILD_FOLLOWPointerPointer to the model’s child follow properties.
MODEL_PROPERTY_COLORSETPointerPointer to colorset indexes and configuration. See Palette.
MODEL_PROPERTY_DEATH_CONFIG_FLAGSIntegerBehavior on death. See Death.
MODEL_PROPERTY_ENHANCED_DELAY_CAP_MAXIntegerMaximum calculated delay. See Enhanced Delay.
MODEL_PROPERTY_ENHANCED_DELAY_CAP_MINIntegerMinimum calculated delay. See Enhanced Delay.
MODEL_PROPERTY_ENHANCED_DELAY_MODIFIERIntegerAdded to existing frame delay. See Enhanced Delay.
MODEL_PROPERTY_ENHANCED_DELAY_MULTIPLIERDecimalMultiplied by frame delay to get new delay. See Enhanced Delay.
MODEL_PROPERTY_ENHANCED_DELAY_RANGE_MAXIntegerMaximum existing delay edelay will affect. See Enhanced Delay.
MODEL_PROPERTY_ENHANCED_DELAY_RANGE_MINIntegerMinimum existing delay edelay will affect. See Enhanced Delay.
MODEL_PROPERTY_FACTIONPointerPointer to faction data. See Faction.
MODEL_PROPERTY_FALL_DISABLEIntegerIf true, model is immune to knockdown while on the ground.
MODEL_PROPERTY_FLIPIntegerIf true, entity flips when spawned as an attack flash and the hit location is at a higher X Axis position than target.
MODEL_PROPERTY_GROUNDIntegerIf true, entity cannot hit others with attacks if it is in the air.
MODEL_PROPERTY_GUARD_POINTSIntegerStarting and maximum guard points.
MODEL_PROPERTY_GUARD_RATEIntegerNumber (half when blocking) of guard points recovered every 200 centiseonds.
MODEL_PROPERTY_HPIntegerStarting and maximum hit points.
MODEL_PROPERTY_HUD_DISABLEIntegerWhen true, this entity does not display in player’s HUD.
MODEL_PROPERTY_HUD_POPUPPointerPointer to model’s Pop Up HUD Properties (ex. Boss HUD).
MODEL_PROPERTY_ICONPointerPointer to model’s Icon Properties.
MODEL_PROPERTY_INDEXIntegerModel’s unique numeric index assigned on read in.
MODEL_PROPERTY_LAYERIntegerText setlayer property. If any non-zero value, the model’s layer position is this value + HOLE_Z.
MODEL_PROPERTY_MAKE_INVINCIBLEIntegerIf this is an item, it will set invincibility time to the collecting entity. If positive, the collecting entity also has blink flag set. If negative, the value is inverted to positive first, and the entity’s blink flag is not set.
MODEL_PROPERTY_MOVE_CONFIG_FLAGSIntegerFlags to control how the model behaves in relation to movement and its environment. See Move Configuration.
MODEL_PROPERTY_MPIntegerStarting and maximum magic/energy points.
MODEL_PROPERTY_MULTIPLEIntegerWhen this entity is struck, attacker gains attack damage * multiple to its score. Default = 5 for enemy types, -1 for NPC, 0 for all else.
MODEL_PROPERTY_NAMEStringName of model. Used as entity name if no alias provided.
MODEL_PROPERTY_OFF_SCREEN_KILLIntegerDistance an entity can pass out of the screen borders before it is killed.
MODEL_PROPERTY_OFF_SCREEN_NO_ATTACKFloatReplaces the global off screen kill for model. Off screen kill subtracts from calculated chance of attack when entity is 10 or more pixels of screen.

0.0 = No change.
1.0 = No chance to attack when off screen.
MODEL_PROPERTY_PAIN_CONFIG_FLAGSIntegerBasic hit reaction behavior. See Pain Configuration.
MODEL_PROPERTY_PATHStringRelative file path to model sheet. Ex: data/chars/kula/kula.txt
MODEL_PROPERTY_PRIORITYIntegerApplies when attempting to spawn an entity if the maximum allowed entities are in play already. The first existing entity with a priority value less than the incoming spawn is killed to make room. If no existing entity has lower priority, the spawn aborts.
MODEL_PROPERTY_QUAKE_CONFIGIntegerControls interaction between entity and native quake behavior. Bitmasked with following constants:

openborconstant("QUAKE_CONFIG_NONE") – Quake functions normally (screen shakes when landing from knockdown).

openborconstant("QUAKE_CONFIG_DISABLE_SCREEN") – Entity does not trigger screen shake.

openborconstant("QUAKE_CONFIG_DISABLE_SELF") – Entity is not affected by screen shake.
MODEL_PROPERTY_RISE_INVINCIBILITYIntegerSet invincibility flag and add value as time when rising from knockdown. May be positive or negative, using same logic as MODEL_PROPERTY_MAKE_INVINCIBLE.
MODEL_PROPERTY_SHADOW_CONFIG_FLAGSIntegerShadow behavior. See Shadow Configuration.
MODEL_PROPERTY_SHADOW_INDEXIntegerStatic Shadow Index.
MODEL_PROPERTY_SCOREIntegerScore allotted to when defeated or collected as an item.
MODEL_PROPERTY_SCROLLFloatRate (if any) entity scrolls with background.
MODEL_PROPERTY_SPAWN_HUDPointerPointer to model’s Spawn HUD Properties.
MODEL_PROPERTY_SUBTYPEIntegerSee Type for list of constants.
MODEL_PROPERTY_TYPEIntegerSee Type for list of constants.
MODEL_PROPERTY_WEAPONPointerPointer to model’s weapon properties. See Weapons.
NameTypeDescription
Model Properties

3 thoughts on “Model”

Comments are closed.

Related Post