Jump to content

How to make a creature move to a location


Recommended Posts

Heya,

I've started a mini-project to make a script that would analyze a dungeon's Path grid, randomly pick a few that make a "patrol route", and then send the creature running the script on that patrol route.

 

I think I have the systems for creating the route theoretically sound, but I don't quite know how to "order" my creature to move to a location. One option would be to make an AI package, of course... but that would require that AI package to be placed ahead of time on EVERY creature I want to use my patrol script.

 

I'd like to find a way to move my creatures around without using AI packages (that or have OBSE come out with an "attach AI package" command; I didn't see one?).

 

Any ideas would be appreciated! 8)

Link to comment
Share on other sites

I'd like to find a way to move my creatures around without using AI packages (that or have OBSE come out with an "attach AI package" command; I didn't see one?).

 

AddScriptPackage does that (adds an AI package to an Actor).

 

Since you will have a route that is determined dynamically, you will need the new OBSE functions to change the package data on the fly (check the "AI Packages" section of the OBSE docs)

Link to comment
Share on other sites

Sweet. I must've missed that function on my function list runthough.

 

That's the missing piece, I believe. Onwards and upwards! 8)

 

Thanks!

 

PS, apparently I already gave you kudos.. 8o

Edited by Leviathan1753
Link to comment
Share on other sites

This week seems to be my newb questions week:

I can't figure out how to get my AI package to trigger as finished.

 

I have an AI package set up to:

Travel

Location Near Reference, with a radius of 100.

 

The sheep that I attached it to walks to the specified reference correctly, but then walks through it and back, as if it's going between the two closest pathgrid nodes, trying to get to the reference it's passing nearby all along.

 

Along with this, none of the onPackageDone setups I've tried have worked.

 

Is there something I'm missing? I thought the parameters for the AI package to be complete was to be within 100 "units" of my target reference.. Something I know is happening, but the AI isn't triggering as done.

 

Any ideas?

Link to comment
Share on other sites

The creature will keep doing that until it's assigned a new package, and if you want the sheep to stand still at that location, it's just to set the radius to 1 and it will do so, or you can remove the script package by using removescriptpackage. (Unless you're going to assign a new package right after, in which you can just use addscriptpackage <new package>
Link to comment
Share on other sites

Alright, that's useful to know. I guess I was just hoping it would trigger the onPackageDone block, as I want more scripts to be run once it gets to the target.

 

Is there a way to trigger that it's succeeded without doing a gameMode block distance if statement?

Link to comment
Share on other sites

You can have a condition set for a radius close to the marker where you want the sheep to go, using GetDistance.

The first script package can have the condition GetDistance set to > 100, while the next can have the GetDistance set to < 100.

 

But like I said, if you're going to run a new scriptpackage straight after, using GetDistance in the script rather than as a condition might be better. (And have it trigger only once, since you probably want the sheep to move more than a distance of 100 away from the marker again.)

If you're going to use many packages in a row, having a system something like this might help, where Patrol increases by one each time the package changes.

 

Short Patrol

 

If ("Object Ref".GetDistance "SheepRef" > 100) && (Patrol == 0)
SheepRef.AddScriptPackage blablabla1
Set Patrol to 1
ElseIf ("Object Ref".GetDistance "SheepRef" < 100) && (Patrol == 1)
SheepRef.AddScriptPackage blablabla2
Set Patrol to 2

etc...

Link to comment
Share on other sites

But still . . . From the description, OnPackageDone should be triggered.

The package is not completing for some reason.

 

Is the target reachable (not up in the air or something)?

Try moving the target to a couple of different spots and see what happens.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...