Jump to content

Can't change zombie speeds.


ATPHHe

Recommended Posts

Hello, I am currently fixing a mod for Build 41.60+ Multiplayer.
The function zombie:changeSpeed(3) does not work anymore as it throws exceptions now.

I saw that changedSpeed() does not exist in 41.60+ looking in the Java Decompiler.
Will it be added back?

 

function setSpeedCZ(zombie)
	local zModData = zombie:getModData();
	
	if zModData.done ~= "done" then
		zombie:changeSpeed(3);
		zombie:DoZombieStats();
		zModData.done = "done";
	end
	
end
Events.OnZombieUpdate.Add(setSpeed)

 

Edited by ATPHHe
fixed description
Link to comment
Share on other sites

Ran into the same issue updating night sprinters. Found that changeSpeed() was removed and went down several dead ends before I found this janky fix:

getSandboxOptions():set("ZombieLore.Speed",1);
zombie:makeInactive(true);
zombie:makeInactive(false);
zombie:DoZombieStats();

As you know, speed is on a zombie to zombie biases. Changing the zombielore does not affect current zombies. However, it does set the default value. The next two lines obviously turn the zombie inactive then back to active(being inactive relates to another zombie lore setting that by default isn't really used). This sets the zombies speedType to -1 which is a flag value saying it needs to be updated. Then when DoZombieStats is executed the zombies the zombies speed will change to the current zombielore setting. Janky as all hell and might not work as well if you want to change individual zombie's speed, but it works I think.

Edited by Bondzberg
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...