Cows and baby cows

Discussions about Coding and Scripting
Post Reply
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Cows and baby cows

Post by JackGriffin »

I'm working through some of the scriptwarning errors and fixing what I can on the coop server. This is one that floods a lot:

Code: Select all

ScriptWarning: BabyCow st-nrgatothbase.BabyCow0 (Function UnrealShare.BabyCow.Grazing.PickDestination:0065) Accessed None
and the reason why is that mappers add a lot of baby cows directly to the maps. This is a no-no, the baby cows must be spawned by the mom so that the setting of 'mom' is done. The baby cow needs to know it's mommy so it can run towards her if threatened or it wanders too far away.

So I'm looking at a fix for this and I'm a bit stumped. I could fix it easily with a recode of the cows and replacement but I'd like to avoid that if it's possible. There are already hundreds of replacements happening and I'd like to stop using them so much. I don't see an easy fix for them though because the assignment of mom is really important to them. I'd hate to destroy all the baby cows because it's not what the mappers intended but I'd sure like to clear the hundreds of log errors. Anyone see an easy answer because I sure don't?
So long, and thanks for all the fish
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Cows and baby cows

Post by Feralidragon »

I know this will sound extremely wrong, but it should work coding-wise:
- make a babycow the actual mom of another babycow, and make that babycow mom the former babycow.

Idk if this will work or create cycling crashes (if it does, it will crash almost instantly), so the alternative:
- Spawn a cow in some random location, and assign all orphan babycows to this cow.

I may add though that that function is a bit stupid. The guy who coded it made a first validation of "if (mom==none)" then 2 lines down it uses "mom" anyway, originating that error.
Which means, it's not the mappers fault, babycows were actually supposed to also be added by mappers manually if wished (otherwise the coder who made it wouldn't make a "mom==none" check), specially since consider the following: what happens if you kill the mom cow? It won't be none though (the actor will still hold the reference), but fact is that it may eventually be a none reference later anyway.
Post Reply