Jump to content

Preventing state change in zombies


Morry

Recommended Posts

Hello, I'm working on a mod that modifies zombie behavior. I currently change the state of zombies into the LuaState, a state which enables you to control characters through lua, in the hopes that they would not do anything on their own. However there is a lot of hard coded stuff in the Update function of IsoZombie that still triggers a state change. My idea to prevent this was to use the OnAIStateChange event to revert a state change immediately when it happens. But this does not work because of two problems that I am running into.

 

First of all, the actual state change is done after the event trigger, so the state change will happen regardless.

this.CurrentState = newState;
comes after
LuaEventManager.triggerEvent("OnAIStateChange", this.Owner, newState, this.CurrentState);

 

Secondly, OnAIStateChange is only called for one of the two changeState() functions. Which is the one with two arguments and as far as I can tell that one is not used anywhere.

 

Does anyone have an idea on how to achieve state change prevention? Or could a developer please change this (seemingly) unused event to happen after the state change so reverting the state is possible. And add the trigger to the single parameter changeState() as well.

 

The relevant code, with the missing event call:

Zdp6Y1H.png

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...