ZoneChange Function... + UnrealShare.Bird1....

Discussions about Coding and Scripting
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

ZoneChange Function... + UnrealShare.Bird1....

Post by MrLoathsome »

Here is the ZoneChange function that appears in 2 of the States in the default file UnrealShare\Bird1.uc

Code: Select all

	singular function ZoneChange( ZoneInfo NewZone )
	{
		if (NewZone.bWaterZone || NewZone.bPainZone)
		{
			SetLocation(OldLocation);
			Velocity = vect(0,0,0);
			Acceleration = vect(0,0,0);
			MoveTimer = -1.0;
		}
	}
My question is: What was Epics intent here?

In testing, the only thing this seems to do is cause the birds to pause, very briefly, before they proceed to fly around underwater, or fly into the PainZone and die quickly...
They pause is very brief. 1 or 2 tics I believe. (OldLocation is defined in class Actor, and is the pawns location from 1 tic previous)

Does it accomplish something other than that? Am I missing something? Or is it just a bit broken?

I am currently playing around with coding a new type of bird, that acts more like a bird than the default one, and also attacks players and bots.
Wanted them to not chase players into the water or pain zones (slime pits/lava etc). These birds are not penguins, cormorants, ducks etc. and have no
reason to be flying around under water IMHO. If a bird is attacking you, you should be able to escape in the water I would think....
:loool:

I have written a replacement function I am using that accomplishes this. Just want to make sure I am not breaking something else with it.... :what:

Here is the current version of that:

Code: Select all

	singular function ZoneChange( ZoneInfo NewZone )
	{
		if (NewZone.bWaterZone || NewZone.bPainZone)
		{
			SetLocation(OldLocation);
			Velocity.Z *= -1;
			Destination.Z *= -1;
			Enemy = None; GoalActor = None;   // This line only in State where the bird has an Enemy/GoalActor
			MoveTimer = -1.0;
		}
	}
+ 1 extra Smilie that shows how I felt the day I looked at the VictoryDance State code in ScriptedPawn.uc --> :barf:
Last edited by MrLoathsome on Mon Feb 20, 2012 10:36 am, edited 1 time in total.
blarg
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: ZoneChange Function...

Post by Shadow »

It describes the behaviour when the current zone changes for some actor. As noted by yourself, the zonechange function for the bird doesn't do anything really useful... Epic may expected the Bird to never actually fly into water... they could've made a land/swim animation but well.. yeah.. not necessary.
Image
User avatar
Dr.Flay
Godlike
Posts: 3348
Joined: Thu Aug 04, 2011 9:26 pm
Personal rank: Chaos Evangelist
Location: Kernow, UK
Contact:

Re: ZoneChange Function...

Post by Dr.Flay »

Couldn't you just change the water velocity, to make it very slow under water? or would that go against what you are trying to achieve?
At least you could escape it.
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: ZoneChange Function...

Post by MrLoathsome »

That could probably be done easy enough, but my current solution fits better, and makes their behavior more "bird-like".
As Shadow mentioned, land/swim animations would be needed to make that really look and work right.
blarg
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: ZoneChange Function...

Post by Shadow »

Well you could slow down the animation rate of the fly animation.. would be a mediocre work around + changing velocity
Image
User avatar
Dr.Flay
Godlike
Posts: 3348
Joined: Thu Aug 04, 2011 9:26 pm
Personal rank: Chaos Evangelist
Location: Kernow, UK
Contact:

Re: ZoneChange Function...

Post by Dr.Flay »

You really are "going for it" aren't you :rock:
This will be no ordinary flock of birds.
Will they be.. angry birds?...*Groans* (sorry)
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: ZoneChange Function...

Post by MrLoathsome »

Dr.Flay wrote:You really are "going for it" aren't you :rock:
This will be no ordinary flock of birds.
Will they be.. angry birds?...*Groans* (sorry)
Correct on all points. Although, there will be 2 types of birds. 1 type will be angry,
the other will just be a better bird.

Looked much closer at the UnrealShare.Bird1.uc source code, decided it could use some tweaking....
The NewBIrds will roam around a bit more, but will still attempt to return to their original spawn location randomly.
I have been trying to adjust their flying/roaming behavior to be more "birdlike" while still using the core
flight code from the original Bird1 pawn.

Also here is the current and probably final revision of the ZoneChange function I am using.
Previously posted one worked most, but not all of the time. This one seems to work always:

Code: Select all

	singular function ZoneChange( ZoneInfo NewZone )
	{
		if (NewZone.bWaterZone || NewZone.bPainZone)
		{
			Velocity.Z *= -1;
			Destination.Z = OldLocation.Z + (90 * FRand()) + 30;
			MoveTimer = -1.0;
			GotoState('MoveToGoal');  // MoveTo(Destination); happens here....
		}
	}
Last edited by MrLoathsome on Wed Mar 14, 2012 6:19 am, edited 1 time in total.
blarg
User avatar
papercoffee
Godlike
Posts: 10453
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: ZoneChange Function... + UnrealShare.Bird1....

Post by papercoffee »

What really would be awesome ... Bats ... the whole unreal universe known for caves and old rotten facilities do lack of bats!
User avatar
Dr.Flay
Godlike
Posts: 3348
Joined: Thu Aug 04, 2011 9:26 pm
Personal rank: Chaos Evangelist
Location: Kernow, UK
Contact:

Re: ZoneChange Function... + UnrealShare.Bird1....

Post by Dr.Flay »

papercoffee wrote:What really would be awesome ... Bats ... the whole unreal universe known for caves and old rotten facilities do lack of bats!
F*ck me ! Good idea, I can't believe no one ever thought of bats for Unreal.
We have rats, crows, and even cockroaches, but not the horror classic, the bat! :tu:
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: ZoneChange Function... + UnrealShare.Bird1....

Post by MrLoathsome »

That is a good idea. This AI could be tweaked for bats easily.

Made a lame attempt at a bat-like skin for the bird1 model yesterday, but it was very horrible.
blarg
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: ZoneChange Function... + UnrealShare.Bird1....

Post by MrLoathsome »

Sorry to both bump and continue the hijack of this tread at once... but...

1. Made a slight edit/adjustment to the function posted above. (The SetLocation statement was not needed, and actually caused issues under rare conditions.... It is gone.)

2. I finished (?) or at least released a beta of the NewBirds thing. Available here for TESTING: http://ecoop.ucoz.com/load/newbirds_beta1/1-1-0-45

I like that bat idea a lot, but have zero modeling skills at all it seems.
However, if somebody could make a bat model, and some animations, using the default bird1 as a template, and could supply those files & anim seq. data, I
could probably adapt this NewBIrd AI to work with a bat easily.
blarg
User avatar
papercoffee
Godlike
Posts: 10453
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: ZoneChange Function... + UnrealShare.Bird1....

Post by papercoffee »

Gimmi the UV-map of this Bird and I make you the bat ... the tail can be masked right?
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: ZoneChange Function... + UnrealShare.Bird1....

Post by JackGriffin »

Bird is going to look all wrong with a bat skin. Bats should flutter and flit a lot and not glide and soar like the bird does. You'd be better served maybe massaging the butterfly into a bat.
So long, and thanks for all the fish
User avatar
papercoffee
Godlike
Posts: 10453
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: ZoneChange Function... + UnrealShare.Bird1....

Post by papercoffee »

well ....sounds even better.
User avatar
Dr.Flay
Godlike
Posts: 3348
Joined: Thu Aug 04, 2011 9:26 pm
Personal rank: Chaos Evangelist
Location: Kernow, UK
Contact:

Re: ZoneChange Function... + UnrealShare.Bird1....

Post by Dr.Flay »

Butter-bats anyone :D
Post Reply