Jump to content

GECK/AIPackage Help


srayesmanll

Recommended Posts

Posted

I'm having an issue with some ai package that I created and wondered if anyone could help. I've got a Travel ai package setup to travel to vault 11. I use this to simulate running away from the PC (I tried to use the FleeNonCombat ai package type, but that just makes the NPC squat in place and not run from the PC, regardless of the settings). I then use a spell to add the package, track the distance run, then remove the package. This works rather well (thanks Borisni for the original scripts). When I remove the package, I call the EVP (Evaluate Package). Everything seems to work right, but the NPC continues to move towards vault 11. If I intercept the NPC, and either talk or they respond to the PCs presence, then it resets and they begin pathing back to their original ai package. For example, the Goodsprings settler you rescue from the geckos early on. I have her initiate the package, so she begins running. Once she reaches the desired distance, the package is removed, EVP called, and she stops running and returns to the walking ai she was doing before. But instead of wwalking back to goodsprings, she continues walking in the direction of vault 11.

 

To note: the options Must Complete and Must Reach Location are not checked. Repeat, NOT checked. I've tried some of the other options, bu no dice. Has anyone else run into something similar? I'd like to release the new version of my mod today (OK, tonight) with this "flee" feature if I can get this resolved. I'm trying other options, but if anyone can help on this, thanks...

Posted

Gosh darn Thanks button...

 

Try it on a NPC that is initially using a sandbox package. The AI package to tell that settler to return to Goodsprings is probably added by script, and it's possible that adding/removing a second one by script is messing with it.

Guest user29
Posted

can you add the package you want to the npc with the actor.addscriptpackage yourpackage ?

Posted

Here is the spell script for the Actor Effect I call to do the Run Away package:

 

 

 

scn SexoutRapistRunAwaySPELL

 

ref soRapistRunner

ref soRapistRaper

float soRapistCurrDist

float soRapistRunDist

float soRapistRunTimer

int soRapistRunDistMet

int soRapistRARemoved

int soRapistSameCell

 

BEGIN ScriptEffectStart

set soRapistRARemoved to 0

set soRapistRunTimer to 0

Set soRapistRunner To GetSelf

Set soRapistRaper To SexoutRapistKeyQuest.soRapistCurrentRapist

Set soRapistRunDist To 2000

Set soRapistRunDistMet To 0

soRapistRunner.AddScriptPackage sexoutRapistRunAwayPACK

PrintToConsole "soRapist: Run Away Add package"

END

 

BEGIN ScriptEffectUpdate

if (soRapistRunTimer > 0)

Set soRapistRunTimer To soRapistRunTimer - GetSecondsPassed

return

endif

Set soRapistRunTimer To 0.5

if (soRapistRARemoved == 0)

if (soRapistRunner.GetIsCurrentPackage sexoutRapistRunAwayPACK == 0)

soRapistRunner.AddScriptPackage sexoutRapistRunAwayPACK

endif

set soRapistCurrDist to soRapistRunner.GetDistance soRapistRaper

set soRapistSameCell to soRapistRunner.GetInSameCell soRapistRaper

if ((soRapistSameCell == 0) || (soRapistCurrDist > soRapistRunDist))

PrintToConsole "soRapist: Run Away Distance - %.0f / %.0f" soRapistCurrDist soRapistRunDist

if (soRapistRunDistMet == 0)

PrintToConsole "soRapist: Run Away Distance not met"

Set soRapistRunDistMet To 1

Set soRapistRunTimer To 2

else

PrintToConsole "soRapist: Run Away Distance met"

Set soRapistRARemoved To 1

if (soRapistRunner.GetIsCurrentPackage sexoutRapistRunAwayPACK != 0)

PrintToConsole "soRapist: Run Away Remove Package"

soRapistRunner.RemoveScriptPackage

endif

soRapistRunner.Dispel sexoutRapistRunAwayAE

soRapistRunner.EVP

endif

else

Set soRapistRunDistMet To 0

endif

endif

END

 

BEGIN ScriptEffectFinish

PrintToConsole "soRapist: Run Away Finish"

Set soRapistRARemoved To 1

if (soRapistRunner.GetIsCurrentPackage sexoutRapistRunAwayPACK != 0)

soRapistRunner.RemoveScriptPackage

soRapistRunner.EVP

endif

END

 

 

 

Ass you can see, I call the AddScriptPackage in the ScriptEffectStart. The update checks every .5 seconds to see if the runner has reached minimum safe distance. If the distance is met, it then removes the package and calls the EVP. so it should reset the normal package.

 

It looks like it is reset - the actor stops running when the added package is removed, and begins walking just like the original package. However, the actor is walking in the same direction that she was running (toward Vault 11). If I go to her, she states her normal greeting when the PC gets close, and without any other action on my part, she turns around and walks to where she is supposed to (Goodsprings). I tried this with Sunny as well, she ran like that package directed, but when the package was removed, she continued walking towards the vault. Since she had no proximity greeting, I had to talk to her. After the dialog closed, she turned around and headed back to where she was supposed to go. It seems as if they have a destination marker that is not getting cleared when the Travel Package is removed, so they continue to that marker. By interrupting them, the marker gets cleared. Frankly I though that was what the EVP was supposed to do. I also tried ReseAI, but that didn't work either.

Posted

I had a problem with adding and removing packages myself. When working on SexoutStore, I wanted the doctor to go back to come talk to the player, then go back to where he was supposed to be. The problem was, 1) he was too far away for StartConversation to work, 2) if you try to tell him to moveto you the package seems to take precedence and he just stays there, and 3) the only way to get him to go back to his normal package was to remove BOTH packages, his default one AND the special one, and then re-add the default one before running .evp.

Posted

I changed the package to tell it to use current location rather than specifying a cell. Seemed to work on the settler (although it seemed to start slow), but didn't work on Sunny. I think the issue (in my case) is the package itself. I'm trying different variations and see what I get. I'll take at that option as well (remove the added and default packages as well).

Posted

OK, a bit more info: Calling the actor.EVP within the script where the package was removed doesn't seem to reset the ai (as mentioned above). However, if I use the console, click on the NPC and call EVP, the package does reset. It is almost as if calling the remove package and then EVP within the same script does not truly reset it. So I am now experimenting with calling another actor effect from the effectfinish phase, and the new effect only calls the EVP on the NPC. However, now the effectupdate phase of the run away effect now no longer functions. GGGGAAAAAHHHHHHHHHHHH!!!!!!. Now I understand how people go crazy. Not the "oh, he's a little eccentric" crazy, I mean the full-bore "smearing feces on the wall" crazy.

 

zippy57: You mentioned removing both the adding package and the default package, then re-adding the default package. My problem is I have no idea what the default package is on NPCs, and looking through the (frelling) GECK (and NVSE) I could not find any command to get the current package ID (GetCurrentPackage only returns the type, not the actual package). Is there a command I am missing that gets this info?

Posted

Not to my knowledge. I was doing that on a SexoutStore NPC, which means I knew what their default AI package was. But now I'm not so sure that worked because RemoveScriptPackage shouldn't have been able to remove the default AI package because it wasn't added via script.

Posted

OK' date=' a bit more info: Calling the actor.EVP within the script where the package was removed doesn't seem to reset the ai (as mentioned above). However, if I use the console, click on the NPC and call EVP, the package does reset.

[/quote']

 

This is almost certainly a timing issue. EVP needs *time* to run. If you're calling it and then expecting it to instantly be available, you'll be disappointed. If you call EVP and need the result of that call to take effect before you continue, you need a delay between calling it and then continuing. It appears to 'work' in the console because no matter how fast you type, you aren't going to be able to close and reopen the console in a single frame.

 

It is almost as if calling the remove package and then EVP within the same script does not truly reset it. So I am now experimenting with calling another actor effect from the effectfinish phase, and the new effect only calls the EVP on the NPC. However, now the effectupdate phase of the run away effect now no longer functions. GGGGAAAAAHHHHHHHHHHHH!!!!!!. Now I understand how people go crazy. Not the "oh, he's a little eccentric" crazy, I mean the full-bore "smearing feces on the wall" crazy.

 

It's not as bad as it sounds. I haven't kept abreast of what you're trying to accomplish, but if it's just a matter of temporarily disabling the active package, you can use the sexout do nothing package:

actor.AddScriptPackage SexoutDoNothing

then wait at least a frame. If you want to be clever, in the next stage do this:

if actor.GetIsCurrentPackage SexoutDoNothing
 ; continue
else
 ; wait for next loop
endif

 

When you're finally done...

if actor.GetIsCurrentPackage SexoutDoNothing
 actor.RemoveScriptPackage
endif

 

No need for any EVP or ResetAI.

 

zippy57: You mentioned removing both the adding package and the default package, then re-adding the default package. My problem is I have no idea what the default package is on NPCs, and looking through the (frelling) GECK (and NVSE) I could not find any command to get the current package ID (GetCurrentPackage only returns the type, not the actual package). Is there a command I am missing that gets this info?

 

There is no default package. Most NPCs have a list of different packages that run depending on the time of day and/or their location. What EVP does is go through this list of available packages assigned to the NPC, and pick the most appropriate one.

Posted

zippy57: You mentioned removing both the adding package and the default package' date=' then re-adding the default package. My problem is I have no idea what the default package is on NPCs, and looking through the (frelling) GECK (and NVSE) I could not find any command to get the current package ID (GetCurrentPackage only returns the type, not the actual package). Is there a command I am missing that gets this info?

[/quote']

There is no default package. Most NPCs have a list of different packages that run depending on the time of day and/or their location. What EVP does is go through this list of available packages assigned to the NPC, and pick the most appropriate one.

That's referring to a statement I made about a SexoutStore NPC. That NPC only had a single AI package set on them via the GECK, so I referred to it as the "default".

Posted

Guys thanks for all the assistance. I think if I was able to get the last package from an NPC (thanks you GECK for not including such a simple function), then reapplying the previous package I think would have solved the issue. I noticed that the AddScriptPackage worked almost immediately for my run package. Possibly applying the "SexoutDoNothing" package would work as well, but I tried a different tactic. Prideslayer mentioned that it could be a timing issue. So after removing the package, I delayed calling the evp for 5 seconds (they still wandered in the wrong direction during that time, but that's OK). That seemed to work. I need to test some more (for some reason, when I start the game fresh, the actor effect I use to control the package seems to crap out immediately, however if I reload the save, it works fine). I need to test some more on this new issue, but so far it looks like I've got this one resolved. Thanks again guys.

Posted

You don't need to delay fo a full 5 seconds.. there is a 'smarter' way. I don't know how you do your delay, but this is how I do the same sort of thing in sexout..

 

Begin GameMode
 set gsp to GetSecondsPassed

 ; Run out the delay clock
 if (0 < fDelay)
   set fDelay to (fDelay - gsp)
   Return
 endif

 ; ... somewhere in stage land ...
 elseif (30 == stage)
   ; continue on
   ; ...

 elseif (20 == stage)
   ; advance if running package else delay a moment
   if (someRef.GetIsCurrentPackage sexoutRapistRunAwayPACK)
     set stage to 30
   else
     set fDelay to 0.1
   endif

 elseif (10 == stage)
   ; Time to do the evp
   set stage to 20
   someRef.evp
 endif
End ; gamemode

Posted

I may give that a try. I think the actual problem is calling the "remove package" and the "evp" in the same execution of the ScriptEffectUpdate. I may also try just doing a "return" right after the "remove" and then the have the evp run in the next frame call to the ScriptEffectUpdate. But frankly, I kind of like the look of the 5 second delay. Visually, the NPC runs away, at the end of the run they "walk it off" for 5 seconds, then turn around and return to what they were doing. It actually looks kind of logical to me.

Posted

I may give that I try. I think the actual problem is calling the "remove package" and the "evp" in the same execution of the ScriptEffectUpdate.

 

Doing them both in the same frame wont work' date=' that is correct. You need to delay. I am just trying to show you a way to delay only as long as you need to, rather than a 'blind' 5 seconds.

 

I may also try just doing a "return" right after the "remove" and then the have the evp run in the next frame call to the ScriptEffectUpdate. But frankly, I kind of like the look of the 5 second delay. Visually, the NPC runs away, at the end of the run they "walk it off" for 5 seconds, then turn around and return to what they were doing. It actually looks kind of logical to me.

 

Ah if you do like it then just leave it. :)

Posted

I do appreciate the info. You (and well, everybody else here as well) are always very helpful. I am going to play with it like this a bit more, just to see if I really do like it, or if I'm just being hard-headed (I tend to get like that sometimes). I was thinking about even adding a cowering idle during that 5 seconds, but I think I'll leave that off the list for now :D

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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