Article View: alt.games.unreal.tournament
Article #179078Re: Catch the Chicken 0.0.8
From: Robert Mischke
Date: Thu, 10 Jul 2003 12:20
Date: Thu, 10 Jul 2003 12:20
58 lines
3464 bytes
3464 bytes
{AGUT2}MeltDown <meltdownUSE@YOURunrealtower.imagination.org> wrote:
>Robert Mischke enlightened us with:
>> After what I've read, I'm a bit surprised this compiles at all,
>> because "Inventory" is a class, and not a property?
>
>It's both. In UnrealScript, you can have a class and an instance with
>the same name. You see things like that in Epic's code all the time:
>
>simulated function DrawOverlays(Canvas Canvas);
Hmm...ok, looks a little weird to me, but I guess Epic has put some
thought into this. Or it's just some bad coding guidelines :)
>> I guess "someone" is of the "Pawn" class, as the bots will want to
>> look for the chicken in both players and other bots. So maybe what
>> you're looking for is the Pawn::FindInventoryType function (see
>> http://wiki.beyondunreal.com/wiki/Pawn_(UT)/Inventory for a list). I
>> guess this code should do what you want:
>
>I've tried that too, but that would cause some nasty loops with other
>things calling hasChicken() from their FindInventoryType() function.
Why would that happen? There are no function calls in
Pawn::FindInventoryType(), least of all hasChicken() ?
>If you take a look at the FindInventoryType() function of a pawn, you'll
>see that it's just the loop with I=I.Inventory as the iterator. It's the
>Unreal way of handling an Inventory chain.
Ok, I see your loop construct is officially valid :) I still think
it's a strange way of doing an iterator, but Epic will have their
reasons.
OTOH, if a pawn gets into it's own inventory list (as you suspected),
this is just the fact which makes it a problem...
>The problem with the chicken is probably that the inventory chain is
>looping somewhere. Perhaps I should keep a list of 'already passed'
>actors, and detect a loop myself. Perhaps I can find out what's going
>wrong that way. On the other hand, simply logging every object in the
>loop will give me that insight as well.
Yeah... that will give you a BIG log file, but that way you should be
able to figure it out.
BTW: If you suspect that some bot has a pointer to himself in his
inventory, you could still try my other suggestion:
for(item = someone.Inventory; item != None; item=item.Inventory) {
if(item.IsA('CTC_Chicken')) return item;
if(item.IsA('Bot')) return NULL; // or IsA('Pawn')
}
Sorry that the rest wasn't too helpful.
Robert aka The_Monk
Technical Details
Message-ID:
<3f10543b.18035209@News.CIS.DFN.DE>Path:
mbox-mo1.pugleaf.net!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!port-212-202-6-186.reverse.qsc.DE!not-for-mailReferences:
<slrnbggrv0.qk.meltdownUSE@sybren.thirdtower.com> <1ijjgv004ffn6knpg14s1vp0h2narrpv98@4ax.com> <slrnbgjsrs.r4.meltdownUSE@sybren.thirdtower.com> <3f0e1970.2982200@News.CIS.DFN.DE> <3f0f204e.4740657@News.CIS.DFN.DE> <slrnbgqhp8.4jd.meltdownUSE@sybren.thirdtower.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!port-212-202-6-186.reverse.qsc.DE!not-for-mail From: rm888@yahoo.com (Robert Mischke) Newsgroups: alt.games.unreal.tournament Subject: Re: Catch the Chicken 0.0.8 Date: Thu, 10 Jul 2003 12:20:35 GMT Lines: 59 Message-ID: <3f10543b.18035209@News.CIS.DFN.DE> References: <slrnbggrv0.qk.meltdownUSE@sybren.thirdtower.com> <1ijjgv004ffn6knpg14s1vp0h2narrpv98@4ax.com> <slrnbgjsrs.r4.meltdownUSE@sybren.thirdtower.com> <3f0e1970.2982200@News.CIS.DFN.DE> <3f0f204e.4740657@News.CIS.DFN.DE> <slrnbgqhp8.4jd.meltdownUSE@sybren.thirdtower.com> NNTP-Posting-Host: port-212-202-6-186.reverse.qsc.de (212.202.6.186) Mime-Version: 1.0 X-Trace: fu-berlin.de 1057839585 6427984 212.202.6.186 (16 [117649]) X-Newsreader: Forte Agent 1.5/32.452 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit