Telling something to travel somewhere and then exitmap - stategraphs?

Started by skullywag, July 30, 2015, 12:59:48 PM

Previous topic - Next topic

skullywag

I want to tell an animal ive spawned to travel to a destination and then exit map, if its attacked or interupted in some way it should be have as normal in that situation and then exitmap after a certain number of ticks.

I know how to:


newThing.mindState.exitMapAfterTick = Find.TickManager.TicksGame + Rand.Range(10000, 12000);


so the last point is taken care of.
I tried something along the lines of:


List<Pawn> list = new List<Pawn>();
list.Add(newThing);
StateGraph stateGraph = GraphMaker.TravelAndExitGraph(travelDest);
BrainMaker.MakeNewBrain(newThing.Faction, stateGraph, list);


to no avail.
Anyone have any clues?
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Haplo

I think animals don't have the squadbrain in their thinktree. Therefor they won't listen to their brain :)

<!-- Squad brain directives -->
<li Class="ThinkNode_Subtree">
<treeDef>SquadBrainDuty</treeDef>
</li>

skullywag

ok that actually makes some sense.

so could i use jobs or something here?
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Haplo

I'm not sure, Jobs are onetime. And how will you continue your job, if it is disturbed?
But maybe it will work, if you add an own Jobdriver in the thinktree of your animals, after the defend jobdriver..

Maybe something like this will work, if you rewrite the ThinkNode a bit to do your stuff..
        <!-- Leave if timed out -->
        <li Class="ThinkNode_ConditionalExitTimedOut">
          <subNodes>
            <li Class="JobGiver_ExitMapWalkRandom" />
          </subNodes>
        </li>


But I'm not sure.
I could tell you how it works with normal pawns (SquadBrain), but animals are so much simpler.. :)