Announcement

Collapse
No announcement yet.

Best way to make a MonsterController move to a particular location?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Thanks! I'll try that.

    Leave a comment:


  • replied
    Well since you are already using custom monster controllers, and your weapon "orders" these things, add a function to the monster controller that sends its to a custom state and sets the desired location. Then when the weapon is fired call that function in the controllers. In that state direct the monster to the desired location. The state you should add would be based on roaming probably. The state code itself is not bad, its all the other inter related functions that suck (and just be thankful your not messing with Bot, where the AI code is split across three different classes, bot, squadAI and TeamAI)

    Here is some code I have for sending one of my single player enemy pawns to investigate a sound it heard (basically moves towards the location where the sound came from, yHeardspot), it might work the way you want.
    Code:
    // MPE_Bot this mostly works, but need to be able to snap bots out of it
    state Investigate extends MoveToGoalNoEnemy
    {
    	ignores EnemyNotVisible;
    
    	function MayFall(){
    		Pawn.bCanJump = ( (MoveTarget != None)
    					&& ((MoveTarget.Physics != PHYS_Falling) || !MoveTarget.IsA('Pickup')) );
    	}
    
    Begin:
    	SwitchToBestWeapon();
    	numHuntPaths = 0;
    ContInvest:
    	if( pointReachable(yHeardSpot) ){
                Destination = yHeardSpot;
                MoveTo(Destination);
            }else{
                MoveTarget = FindPathTo(yHeardSpot);
                MoveToward(MoveTarget,,,false,true);
            }
    	WaitForLanding();
            if ( (VSize(pawn.location-yHeardSpot) > 128) && numHuntPaths < 5){
                numHuntPaths ++;
                GoTo('ContInvest');
            }
    DoneInvestigate:
    	WhatToDoNext(99);
    	if ( bSoaking )
    		SoakStop("STUCK IN INVESTIGATING!");
    }

    Leave a comment:


  • replied
    I've already got MonsterController subclassed... I've looked at the state code a bit, but it looks really really complicated. What should I do with it?

    Leave a comment:


  • replied
    MoveTo is a latent function and must be called from state code (IIRC) within the monstercontroller, so I don't think that it can be called externally. Although hackish, you might try spawning a dummy actor at the location you want the monster to move and set the monster's movetarget to that. If that does not work you could always subclass monster controller....

    Leave a comment:


  • Best way to make a MonsterController move to a particular location?

    I'm trying to make a custom monster move to a given spot (not an Actor, just a position vector). I've tried setting its controller's Enemy to None and its Destination to the position, but it seems to totally ignore that most of the time - I think it may be selecting a new enemy once it loses the last one. Also, I think Destination might be totally the wrong way to do it. Anyone have experience with this kind of thing? :heart:

    edit - DUH. Looked in base Controller class and found a MoveTo method. Hurrah.
    edit 2 - And no, never mind on the never mind. "Error: MoveTo not allowed here." I'm calling it from a weapon's AltFire, basically trying to make monsters move to the painted spot like mines do... help!
Working...
X