Jump to content

Need Help: Understanding AI packages and more scripting questions?


Guest Messenjah

Recommended Posts

Guest Messenjah

So, I'm feeling a little more comfortable with modding at this point in time and things are going very well. Thanks to a lot folks here on the board, I managed to get a timed light sequence and a number of other things going for my mod. So, here is my latest and greatest pickle: AI packages.

 

Now, one of the issues I've had with a previous build of my mod, is that I couldn't get the AI packages do what they are supposed to do.

 

What my goal is with my current AI packages is that I have a bunch of pole dancers that are supposed to rotate on and off from the stage. When they are off the stage, they will be taking smoke breaks, walking around and mingling with customers and giving private dances to customers ecs. You get the idea, just to set up some variety and make the place feel a little more lively.

 

 

What I have tried is this, I set up a travel package to go the pole and use it. I have set up a stripper pole as a piece of furniture and assigned custom animations to it. I assigned each dancer a set of specific hours and then assigned them to use a sandbox package and I marked ignore sandbox on the pole so NPC's wouldn't just use it at random. First pole dancer worked, then nothing. She kept using the pole for infinite time, even though the event is set to start at Gamehour 14 with a duration of 4 game hours so it should end at hour 18. It doesn't.

 

So, I tried to remedy this by telling her to take a smoke break at a wall lean marker at Gamehour 18 and marked it as must complete. Nothing, she walks around, sits in random chairs, gambles, and smokes while doing it. :P

 

So, I tried writing the following quest script and attached it to a new quest:

 

scn WEDancersSCRIPT

short TreasureDance
short VelvetDance
short LolaDance
short SantiagoDance

begin gamemode

if (Gamehour > 10) || (Gamehour < 13)
set VelvetDance to 1

elseif (Gamehour > 13) || (Gamehour < 14)
set VelvetDance to 0

elseif (Gamehour > 14) || (Gamehour < 18)
set TreasureDance to 1

elseif (Gamehour > 18) || (Gamehour < 22)
set LolaDance to 1
set TreasureDance to 0


elseif (Gamehour > 22) || (Gamehour < 24)
set SantiagoDance to 1
set LolaDance to 0

else
set VelvetDance to 0
set TreasureDance to 0
set LolaDance to 0
set SantiagoDance to 0

endif
end

 

 

I assigned a condition to each package such as:

 

 GetQuestVariable   Quest 'WEDancers", TreasureDance == 1

 

 

Now they just appear to sit there and do nothing. I've tried removing the schedule times and durations and then re-adding them. Still doesn't work.

 

 

Any ideas on how I can get the Dancer NPC's to rotate on and off the stage?

 

Is it possible that the pole, being a furniture object causes an issue? I've heard that the game doesn't seem to know how to stop at times when it is playing an animation unless you force a new animation to play. Is it possible that there is a bug and they can't get out of the furniture object even if told to do so? Is it possible that you can't have more than a specific amount of NPC's linked to a single furniture object via AI package?

 

Could it be a time conflict? Sometimes if you use sleep/rest, sometimes events won't start until later, which can cause certain issues.

 

Is there a more accurate and effective way to do this?

 

Only thing I can think of, is to set up 4 different poles and have them enable/disable at specific times of the day?

 

I noticed that all of the tops performances seem to be scripted rather than quest events. I noticed that they have some kind of override function if a certain time has passed. Is there a way to set this up so that if a certain time has passed, the game will ignore that AI package?

Link to comment
Share on other sites

Think of a number, any number, then check if the following is True.

 

if (Gamehour > 10) || (Gamehour < 13)

 

Every number is either greater than 10 OR less than 13, so it never gets beyond the first condition.

You meant to use && in the script.

 

Easy mistake to make. The first time I read through the script I was reading the || as && too.

Link to comment
Share on other sites

Tried it, nothing still. :(

 

Okay,I'm going to do one girl. Don't think of the package in a vacuum. What is she doing before this package? Is she in another package? If so how are you telling her to stop doing that one and start doing this one (this doesn't always need to be done, but I'm going to do it here)? How are you telling her to get a move on and change packages? After those are all in place the package still may not work because of the order of them in the NPCs list, but you can move the one that's not working up and down in that list until it works, but then you have to verify that the others still work.

 

So, I'm gonna do Velvet.

 

If she is doing something else you can do something like:

 

Set VelvetWhateversheisdoingnow to 0
Set VelvettDance to 1
VelvetREF.evp   Use her Ref here; this causes her to evaluate her packages and get a move on

 

When it's time for her to stop dancing and go to the next package it would be something like this:

 

Set VelvetDance to 0
Set VelvetGotoNextPackage to 1
VelvetREF.evp 

 

If she has a bunch of packages and they are set up correctly and she isn't executing one of them you may need to move them up and down in the NPC list of packages. If you have a furniture package that isn't working you may need to increase the radius you have listed on the Package itself for her to be able to perform the animation. Especially if she is just standing there and you've tried moving the package up and down in her list and verified your script and she is still just standing there.

 

The zeroing out of the variable on the existing package can be overkill before the setting of the variable on the new package (she might switch packages fine without doing it now that you have the evp), but if you are having no luck getting your NPC to do what you want, that will work to get them cooperating, especially in a very structured environment like this where you will be setting the next variable you need for the next package. The thing you need to be careful about, if you need to get her back onto the package she was on in the very beginning, is you'll need to make sure to script that in somewhere as that variable has been set to zero.

 

Oh, and you'd fit this in around the timing stuff you've already done, obviously.

Link to comment
Share on other sites

I've had issues with the mod I'm working on, where the NPC is sandboxing and sitting. The time rolls by for another package to kick in - sleep. But she won't get up from the floor-sit marker or chair. So in the sleep package, in the 'On Begin' result script, I put:

 

if (RHKWendyREF.GetSitting == 3)
 RHKWendyREF.ResetAI
endif

 

Which works - snaps her of the chair. So it's buggy packages, I guess. The sleep package had been starting all along but she seems to be stuck on the furniture. Maybe you are having a similar issue.

Link to comment
Share on other sites

Guest Messenjah

Oooh, great suggestions guys!

 

I do have a couple of questions before I get a chance to experiment:

 

1. What does evp do? I've seen this on other scripts.

 

2. Is there a way to reset the entire cell by console command without restarting my game/computer? When I tried working with Fallout 3's AI a couple years back, I had issues with it and at times to see it actually start to work, I would close the game, restart my machine, load from a previous save and use the coc console command to get into my custom cell in order to see the AI actually work correctly. Just need a quick way to reset the cell.

Link to comment
Share on other sites

For evp, it is short for "evaluate package". Normally, an NPC evaluates its packages every few minutes, as scheduled somehow by the game engine. If you are trying to get some specific sequence of actions to happen in a short time, you don't want to wait for that. So you force the game engine to evaluate the packages for that NPC with "npcref.evp". If you change some script variables which you expect to cause the NPC to choose a different package, call evp in the same code segment so that the proper package will be selected.

 

Personally, I have found packages to be the single thing which is hardest to predict. I am not an expert but I spent literally hours trying different combinations of script variables and packages, practically at random, until I found one that seemed to work. Then for the next set of events which seemed similar to me, the same setup would not work. Perhaps if I worked at it just a bit harder, it all would have become clear to me. My suggestion if you get frustrated is, keep scaling back the complexity of the actions you want. Very simple sequences can easily satisfy the *player's* need. It is better to have some simple, working sequence, rather than a complex plan which you cannot implement reliably.

 

I don't know the answer to your second question.

Edited by davidlallen
Link to comment
Share on other sites

Personally, I have found packages to be the single thing which is hardest to predict. I am not an expert but I spent literally hours trying different combinations of script variables and packages, practically at random, until I found one that seemed to work. Then for the next set of events which seemed similar to me, the same setup would not work. Perhaps if I worked at it just a bit harder, it all would have become clear to me. My suggestion if you get frustrated is, keep scaling back the complexity of the actions you want. Very simple sequences can easily satisfy the *player's* need. It is better to have some simple, working sequence, rather than a complex plan which you cannot implement reliably.

 

I've found the packages in NV to be especially buggy (see rickerhk's issue above and there have been other issues with the sandbox package), touchy and difficult to work with. I didn't have nearly the number of headaches in FO3 that I've had here. And I agree with you that starting with a simple sequence to get whatever effect it is that you are trying to accomplish is a good idea. You can build up to something more complex after that, if you are willing to work with them and the debugging to get it working, but I've used fewer packages in NV than I would have liked because of their general touchiness and the resulting headaches.

Link to comment
Share on other sites

Guest Messenjah

Well, this is odd.

 

So, here is the script that I have written and I set the correct conditions to my AI packages. The idle is just a random name I gave it to tell them to go to another marker and do something else in the second AI package. The dance AI package is set up for every character as the first package so it should take priority.

 

I even set the pole to disable at Gamehour 18 and treasure will still continue to dance!

 

Anyway, here is my current script:

 

scn WEDancersSCRIPT

short TreasureDance
short TreasureIdle
short VelvetDance
short VelvetIdle
short LolaDance
short LolaIdle

begin gamemode

if (Gamehour > 10) && (Gamehour < 13)
VelvetREF.resetAI
set VelvetIdle to 0
set VelvetDance to 1
VelvetREF.evp

elseif (Gamehour > 13) && (Gamehour < 14)
VelvetREF.resetAI
set VelvetDance to 0
set VelvetIdle to 1
VelvetREF.evp

elseif (Gamehour > 14) && (Gamehour < 18)
TreasureREF.resetAI
set TreasureIdle to 0
set TreasureDance to 1
TreasureREF.evp

elseif (Gamehour > 18) && (Gamehour < 22)
LolaREF.resetAI
set LolaDance to 1
set LolaIdle to 0
LolaREF.evp
TreasureREF.resetAI
set TreasureDance to 0
set TreasureIdle to 1
TreasureREF.evp



else
set VelvetDance to 0
set TreasureDance to 0
set LolaDance to 0

endif
end

Link to comment
Share on other sites

  • Recently Browsing   0 members

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