mohabhassan / NightFall

MOHAA/MOHSH/MOHBT dgamex86 wrapper.
https://www.x-null.net/forums/forum.php
12 stars 5 forks source link

[Feature Request] change state files per player #52

Open eduzappa18 opened 9 months ago

eduzappa18 commented 9 months ago

So in FAKK2 there is an Actor command called statemap that allows you to set specific state files to different AI's e.g. statemap ai/default.st

I wonder if it would be possible to add a similar command to set a state file to only one player via script.

For example

// set custom state file
local.player statemap "vehiclemod/state"
// this will change the player state files to vehiclemod/state_legs.st and vehiclemod/state_torso.st
// and just ignoring the _legs file if it doesn't exist since most if not all mods only use the torso states

// reset to default state file
local.player statemap ""
// or maybe it could be set to a single file like
local.player statemap "vehiclemod/vehicle_states.st"

No idea if it's even possible to add something like this to NightFall (or maybe OPM), but it would be really convenient to have it

mohabhassan commented 9 months ago

I don't think actors have state files in AA. It's just a big state diagram that is hard coded. BTW, fakk2 AI is defo different in implementation than AA. Can you give examples of the function/contents of fakk2 state files for actors?

eduzappa18 commented 9 months ago

for example, this is models/claw.tik

TIKI
setup
   {
   scale 1.0
   path models/monster/claw
   surface material1 shader claw.tga
   radius 100
   }

$define clawdir sound/monsters/claw

init
   {
   server
      {
    classname Actor
    setsize "-32 -32 0" "32 32 116"
        stationary
        statemap ai/klaw.st
        fov 20
        nodamage
        name "Klaw"
        deaf
        targetable 0
        attackablebyactors 0
      }
   client
      {
      cache $clawdir$/impact1.wav
      cache $clawdir$/move4.wav
      cache $clawdir$/strike1.wav
      cache $clawdir$/idle.wav
      cache dirtcloud.spr
      cache dirtpiece.spr
      }
   }

and this is ai/klaw.st


state IDLE
   {
   legs
      {
      idle : default
      }

   behavior idle

   states
      {
      STUNNED       : STUNNED

//      STRIKE_SHORT    : RANGE "300" "50" CAN_SEE_ENEMY NAME "Klaw (short)"

//      STRIKE_SHORT    : RANGE "300" "50" CAN_SEE_ENEMY NAME "Klaw (medium)"
//      STRIKE_MEDIUM   : RANGE "400" "50" CAN_SEE_ENEMY NAME "Klaw (medium)"

//      STRIKE_SHORT    : RANGE "300" "50" CAN_SEE_ENEMY NAME "Klaw"
//      STRIKE_MEDIUM   : RANGE "400" "50" CAN_SEE_ENEMY NAME "Klaw"
//      STRIKE_LONG : RANGE "550" "50" CAN_SEE_ENEMY NAME "Klaw"

      STRIKE_LONG   : NAME "Klaw" MOVING_ACTOR_RANGE "550" "50"
      STRIKE_MEDIUM : NAME "Klaw" MOVING_ACTOR_RANGE "400" "50"
      STRIKE_SHORT  : NAME "Klaw" MOVING_ACTOR_RANGE "300" "50"

      STRIKE_MEDIUM : NAME "Klaw (medium)" MOVING_ACTOR_RANGE "400" "50"
      STRIKE_SHORT  : NAME "Klaw (medium)" MOVING_ACTOR_RANGE "300" "50"

      STRIKE_SHORT  : NAME "Klaw (short)" MOVING_ACTOR_RANGE "300" "50"
      }
   }

state STRIKE_SHORT
   {
   legs
      {
      strikeshort : default
      }

   behavior idle

   states
      {
      WAIT  : ANIM_DONE
      }
   }

state STRIKE_MEDIUM
   {
   legs
      {
      strikemid : default
      }

   behavior idle

   states
      {
      WAIT  : ANIM_DONE
      }
   }

state STRIKE_LONG
   {
   legs
      {
      strikelong : default
      }

   behavior idle

   states
      {
      WAIT  : ANIM_DONE
      }
   }

state WAIT
   {
   legs
      {
      idle : default
      }

   behavior idle
   time ".2" ".5"

   states
      {
      STUNNED   : STUNNED
      IDLE  : DONE
      }
   }

state STUNNED
   {
   entrycommands
      {
      attachmodel fx_stars.tik tag_clawend 1 "" 0 -1 -1 -1 -1 "0 0 80"
      }

   legs
      {
      stunned : default
      }

   states
      {
      IDLE      : ANIM_DONE !STUNNED
      }

   exitcommands
      {
      removeattachedmodel tag_clawend
      }
   }

//
// Script stuff
//

state SCRIPT_STRIKE_SHORT
   {
   entrycommands
      {
//      removeattachedmodel tag_clawend
      }

   states
      {
      SCRIPT_STUNNED        : STUNNED
      SCRIPT_STRIKE_SHORT2  : default
      }
   }

state SCRIPT_STRIKE_MEDIUM
   {
   states
      {
      SCRIPT_STUNNED        : STUNNED
      SCRIPT_STRIKE_MEDIUM2 : default
      }
   }

state SCRIPT_STRIKE_LONG
   {
   states
      {
      SCRIPT_STUNNED        : STUNNED
      SCRIPT_STRIKE_LONG2   : default
      }
   }

state SCRIPT_STRIKE_SHORT2
   {
   legs
      {
      strikeshort : default
      }

   behavior idle

   states
      {
      SCRIPT_IDLE   : ANIM_DONE
      }
   }

state SCRIPT_STRIKE_MEDIUM2
   {
   legs
      {
      strikemid : default
      }

   behavior idle

   states
      {
      SCRIPT_IDLE   : ANIM_DONE
      }
   }

state SCRIPT_STRIKE_LONG2
   {
   legs
      {
      strikelong : default
      }

   behavior idle

   states
      {
      SCRIPT_IDLE   : ANIM_DONE
      }
   }

state SCRIPT_IDLE
   {
   legs
      {
      idle : default
      }

   behavior idle

   states
      {
      SCRIPT_STUNNED    : STUNNED
      IDLE      : HAVE_ENEMY
      }
   }

state SCRIPT_STUNNED
   {
   entrycommands
      {
      attachmodel fx_stars.tik tag_clawend 1 "" 0 -1 -1 -1 -1 "0 0 80"
      }

   legs
      {
      stunned : default
      }

   states
      {
      SCRIPT_IDLE   : ANIM_DONE !STUNNED
      }

   exitcommands
      {
      removeattachedmodel tag_clawend
      }
   }
eduzappa18 commented 8 months ago

Here is a related thread on xNULL from 2012 It looks like RR was looking into adding that feature to reborn https://www.x-null.net/forums/threads/1464-State-Files-State-Files-State-Files-and-suggestions

UnbanElgan