Gridpath help

Post » Sat May 28, 2011 2:08 am

The tutorials I've read, like http://www.designamatic.com/MW-Home.html#CreatingPaths and http://planetelderscrolls.gamespy.com/View.php?view=Tutorials.Detail&id=55#PathGridEditing don't really say much about getting a certain NPC to follow the points you've made or anything.

I'm wanting to connect the upper most point (follow green arrows) in cell Pelagiad 0, -7 http://img233.imageshack.us/img233/9572/pelagiad07.jpg with the next nearest point in cell Pelagiad 0, -8 http://img31.imageshack.us/img31/8608/pelagiad08.jpg. When I'm in an exterior cell, I'm unable to connect points to adjacent exterior cells for some reason. So how do I get the NPC highlighted in the green circle outside the front door of the building to follow these paths?
User avatar
Suzy Santana
 
Posts: 3572
Joined: Fri Aug 10, 2007 12:02 am

Post » Fri May 27, 2011 11:15 pm

It is impossible to connect the pathgrid of one cell with that of an adjacent cell. To move an NPC from one to the next you will require AITravel. In my experience it is tricky. You will require the NPC to be at a point on the first pathgrid very near the cell border. You could use AITravel to accomplish that or depend to chance and check the NPC's position before the next step. Once the NPC is at this edge node, use AITravel to 'hop' across the border to a node on the adjacent cell's pathgrid. Then AIWander and be used to have the NPC continue from there. Good luck.
User avatar
Poetic Vice
 
Posts: 3440
Joined: Wed Oct 31, 2007 8:19 pm

Post » Sat May 28, 2011 4:56 am

Boy that svcks that it requires so much work just to get a single NPC to walk in a straight line.

So let's see if I got this:

Step 1) Set the grid path points. http://img638.imageshack.us/img638/5930/92882738.jpg

Step 2) Add NPC's AI Travel package. http://img407.imageshack.us/img407/8696/48370109.jpg I used a point that was right at about where the last upmost marker was. Now do I set the travel package to that point? Or do I set it to be at the coordinates a few feet more up into the next cell? Because about 1 or 2 feet above the last point in the picture is cell (0, -8). The first cell is (0, -7).

Step 3) How do I get him to start walking and following those points? Because he still just stands there in game, never even walking an inch.
User avatar
Eileen Collinson
 
Posts: 3208
Joined: Thu Dec 28, 2006 2:42 am

Post » Fri May 27, 2011 9:49 pm

I don't have much time for this thread tonight, but I can tell you that it cannot be achieved by adding an AI Package to the NPC - it must be handled by a script (ideally attached to the NPC in question).

You might try having the script check for a specific value for the x or y coordinate (as appropriate) of the NPC's position. If it exceeds a threshold value, the script changes the NPC's AI Package to AITravel with the coordinates of a node in the adjacent cell's pathgrid. Once the script returns GetAIPackageDone as true the script sets the AI Package to AIWander and hopefully life goes on. To get the NPC to return to the original cell, just have the script perform the whole thing in reverse. It may take several attempts of tweaking to get the thing to work as you would wish. I spend at least an hour working on the cell hop part of Shotherra's travel script for LGNPC Khuul and it was less complicated than what you propose. You might even decide that you can live without this feature.
User avatar
Jack
 
Posts: 3483
Joined: Sat Oct 20, 2007 8:08 am

Post » Fri May 27, 2011 10:13 pm

Good lord, who would have thought just to get an NPC to walk would be so difficult.

Well let's stick with trying to figure out how to get him to keep walking forward into the next cell. That seems to be the most difficult part of this thus far. Only thing is I don't have a clue how to write the script to get him to follow the grid path and cross over into the adjacent exterior cell.

Anybody else perhaps knows?
User avatar
Joe Bonney
 
Posts: 3466
Joined: Tue Jul 17, 2007 12:00 pm

Post » Sat May 28, 2011 1:27 am

Something like this is wanted:

Begin PE_NPC_Walkaboutshort stateif ( state == 0 )    if ( GetPos x > 5000 ) ; the limit of the first pathgrid        set state to 10        AITravel 5500 4000 1000 ; coordinates of a node in adjacent cell    endifelseif ( state == 10 )    if ( GetAIPackageDone == 1 )        set state to 20        AIWander 512 5 0 60 20 10 10 0 0 0 0     endifendifEnd PE_NPC_Walkabout

Obviously you will have to supply the actual coordinates that will trigger travel as well as to the destination. It may not work. The NPC may be unwilling to leave the original pathgrid. It requires finesse and insight to adjust the coordinates to make it work - something that cannot be done efficiently in a post. If you want the NPC to be able to return to the first cell that will require more code.
User avatar
Julie Ann
 
Posts: 3383
Joined: Thu Aug 23, 2007 5:17 am

Post » Fri May 27, 2011 6:30 pm

Firstly, is there a way to get the coordinates of a grid node? Because I'm having to drag objects to where I think the spot was and use that as reference. I don't see a way to double click on the blue dots. And there aren't any red dots anywhere when I turn on the gridpath. Shouldn't there be red ones that represent Bethesda stock grid nodes?


He still didn't walk anywhere. This is the script I'm using.

Begin PE_Mils_Neddonii_NIGHTShort NoLoreShort State; this part just has him appear between 8pm and 8am at night.If GameHour > 8    if GameHour < 20        if GetDisabled == 0            disable        endif    endifendifIf GameHour <= 8        if GetDisabled == 1            enable        endifelseif GameHour >= 20        if GetDisabled == 1            enable        endifendif; this next part is to get him to walk to the adjacent exterior cell.if ( state == 0 )    if ( GetPos y > -57345) ; the limit of the first pathgrid        set state to 10        AITravel 2824 -57413 1366 ; coordinates of a node in adjacent cell    endifelseif ( state == 10 )    if ( GetAIPackageDone == 1 )        set state to 20        AIWander 512 5 0 60 20 10 10 0 0 0 0     endifendifEnd PE_Mils_Neddonii_NIGHT



He's inside the shop working during the day. And so enabling him at night to walk home is easier than teleporting him outside. I have 2 of the same NPC, one for day time and one for night time.

How else should this script be written to get him to start walking? His Wander Distance is set to 0. Should that be changed? He's not really wandering, he's following a set course.

http://img443.imageshack.us/img443/7633/30708064.jpg



And here is his Travel Package: http://img695.imageshack.us/img695/5194/91441205.jpg


I don't know why he has a million different animation groups. Does he need that many? How do I get rid of most of them since I'm assuming he won't be using all of those.
User avatar
JaNnatul Naimah
 
Posts: 3455
Joined: Fri Jun 23, 2006 8:33 am

Post » Sat May 28, 2011 6:00 am

So we are clear on this point - the NPC is a clone of the one in the shop. The original might require a wander distance of 0 to prevent him from leaving his station in the shop, but the outside clone will not move with your current AI package. Unless he starts at a y position greater than -57345 there is no chance of triggering the travel package. Make the wander distance of the clone something like 512 and removed the travel package - the latter needs to be managed entirely through his script.

You can find the coordinates of the pathgrid nodes by entering the game, toggling the pathgrid (console command: tpg) stand on the node of interest and type in the console: player->GetPos x and repeat for y and z.

It is beginning to seem to me that this is not a random movement that you are trying to create, but a deliberate march from one point to another point in a different cell. If that is the case, you would do better to script the entire journey using AITravel. I can provide a template script into which you can add the coordinates of the travel waypoints (it may not be possible to do it in one stage). This would be independent of the pathgrid. The grid can help guide the NPC around obstacles, but it might prevent the NPC from crossing the cell boundary (my frustrations with Shotherra in Khuul). I would also want to know if this NPC would return along the same route in the morning.

I am not certain why he would have a million animation groups - that does sound like a lot. I do not work with animation, but I expect NPCs have walking, running, jumping, sneaking, swimming, casting, multiple attacks, hits, and death animation so say nothing of the 'idles'. I do not know how to remove animation groups from an NPC (or anything else for that matter). It sounds like you should start a new thread for that query since few modders with that particular skill set will discover your question here.
User avatar
Eve(G)
 
Posts: 3546
Joined: Tue Oct 23, 2007 11:45 am

Post » Sat May 28, 2011 6:17 am

The NPC in the shop is called "IS_C_Mils_Neddonii" and the only thing he does is hammer all day. He cannot walk, move or wander. Because of his hammering animation, he is isolated to the standing position and cannot walk. He is disabled from 2000 to 0800.

The NPC outside the front door of the blacksmith shop is called "IS_C_Mils_NeddoniiNIGHT" and he will be walking directly from the shop at 2000 to his house. Once he reaches his house, say around 2020, he will be disabled. He will be enabled at 0740 at the spot outside the front door of his house where he was disabled at, and walk back along the exact same path to the blacksmith shop. He will stop at the exact same spot where he originally left the shop at, and be disabled there at 0800.

From there, IS_C_Mils_Neddonii will be enabled at 0800 inside the shop, hammering away, until 2000.
I'll need to make a third one that is enabled inside his home where his wife & kids are, from 2020 to 0740. But I can do that on my own.
This schedule routine will continue every single day, forever.


I deleted his Travel package. All of those animations he has are just default animations, like what Fargoth and such have. They won't be of any bother or conern to me.
http://img412.imageshack.us/img412/8046/62667826.jpg


How would I go about scripting his trip using AI Travel?
Thanks Cyran0.
User avatar
no_excuse
 
Posts: 3380
Joined: Sun Jul 16, 2006 3:56 am

Post » Sat May 28, 2011 7:18 am

I am fading for one second to cover up the sudden appearance and disappearance of the NPC in case the player is near (otherwise what is the point).

I know that you have allowed 20 minutes for his walk home, but I bracketed the time that the NPC will travel home (between 8 and 8:20 pm) and travel to work (between 7:40 and 8 am) since there is not guarantee that the player will be present at exactly 8 o'clock and I do not think his wife will be too keen on having him walk in the door at 3 in the morning. It does not mean that the NPC will complete the journey before his corresponding version is enabled. However this does decrease the likelihood of the player finding him at two different places at the same time (but it does not eliminate it). It may be possible to communicate to the original NPC in the shop and the second clone at home that 'he' is en route, and delay their appearance until the traveler has reached his destination. However you can tweak my code to run closer to the times you specified and hope that the player is there to witness it.

I wrote some rescue code to reset the NPC at the appropriate point (based on time of day) in the event the player waits, fast travels or does something else that interrupt the orderly progress through the travel code.

You have to supply the x y z-coordinates for the starting (point 0) and ending (point 3) positions (outside of shop and home respectively) as well as for intermediate waypoint (points 1 and 2). These intermediate points ideally are on either side of the cell boundary that is causing much grief at or near pathgrid nodes. I imagine the NPC will use the pathgrid within a cell to avoid obstacles, however additional waypoints can be introduced by expanding the travel code (duplicating and editing blocks of code, e.g. state == 30/state == 40). It may take some trial and error to complete the route. Good luck

Begin PE_TravelScript; Attached to the NPC: IS_C_Mils_NeddoniiNIGHTshort noLore short doOnceshort stateif ( menumode == 1) ; if menu is open do not process	returnendifif ( doOnce == 0 ) ; clone starts disabled	set doOnce to 1	AIWander 0 0 0 0 ; do not go anywhere	SetHello 0 ; no idle greetings to interrupt  travel	Disableendifif ( GetCurrentAIPackage == -1 ) ; no AI package active	AIWander 0 0 0 0 ; do not go anywhere	Disable	if ( Gamehour >= 20 ) ; nighttime		Position x y z 0 ; coordinates of home		set state to 100	elseif ( Gamehour < 8 ) ; nighttime		Position x y z 0 ; coordinates of home		set state to 100	else ; daytime		Position x y z 0 ; coordinates of shop		set state to 0	endifendifif ( state == 0 ) ; at shop	if ( GameHour >= 20 ) ; evening...		if ( GameHour < 20.333 ) ; but not too late			FadeOut 1 ; hide sudden appearance			FadeIn 1			set state to 10		endif	endifelseif ( state == 20 )	Enable	set state to 30elseif ( state == 30 )	AITravel x y z ; coordinates of point 1	set state to 40elseif ( state == 40 )	if ( GetAIPackageDone == 1 ) ; he is at point 1		set state to 50   endifelseif ( state == 50 )	AITravel x y z ; coordinates of point 2	set state to 60elseif ( state == 60 )	if ( GetAIPackageDone == 1 ) ; he is at point 2		set state to 70	endifelseif ( state == 70 )	AITravel x y z ; coordinates of point 3 (home)	set state to 80elseif ( state == 80 )	if ( GetAIPackageDone == 1 ) ; he is at point 3 (home)		AIWander 0 0 0 0 ; do not go anywhere		set state to 90	endifelseif ( state == 90 )	FadeOut 1 ; hide sudden disappearance	FadeIn 1	set state to 100elseif ( state == 100 ) 	Disable	set state to 110elseif ( state == 110 ) ; at home	if ( GameHour >= 7.667 ) ; morning...		if ( GameHour < 8 ) ; but not too late			FadeOut 1 ; hide sudden appearance			FadeIn 1			set state to 120		endif	endifelseif ( state == 120 )	Enable	set state to 130elseif ( state == 130 )	AITravel x y z ; coordinates of point 2	set state to 140elseif ( state == 140 )	if ( GetAIPackageDone == 1 ) ; he is at point 2		set state to 150   endifelseif ( state == 150 )	AITravel x y z ; coordinates of point 1	set state to 160elseif ( state == 160 )	if ( GetAIPackageDone == 1 ) ; he is at point 1		set state to 170	endifelseif ( state == 170 )	AITravel x y z ; coordinates of point 0 (shop)	set state to 180elseif ( state == 180 )	if ( GetAIPackageDone == 1 ) ; he is at point 0 (shop)		AIWander 0 0 0 0 ; do not go anywhere		set state to 190	endifelseif ( state == 190 )	FadeOut 1 ; hide sudden disappearance	FadeIn 1	set state to 200elseif ( state == 200 )	Disable	set state to 0 ; start overendif ; end of travel codeEnd PE_TravelScript

This code has not been tested.
User avatar
scorpion972
 
Posts: 3515
Joined: Fri Mar 16, 2007 11:20 am

Post » Fri May 27, 2011 8:03 pm

When I used the coordinates for the home, I got this error: http://img585.imageshack.us/img585/3127/51560640.jpg
Where it says "Position -260 -60000 770 ; coordinates of home" what is a z rotation and how do I enter it in the script?


You can see http://img220.imageshack.us/img220/8608/pelagiad08.jpg that I have the points plotted out for the cell for his travel. He's actually going to have to walk from 0,-7, 0,-8 and about 6 feet into -1,-8 since that's where his house is. So three exterior cells total.

His Hello is already defaulted to 0, so can we disregard that command on line 16? just to make the script shorter. His Flee and Alarm are at 30 and Fight is 0.

I was thinking that if you clicked on him to enter dialogue while he was walking home or to work, that it would delay his arrival. But you have the If menumode = 1 Return, which means if you click on him, i.e. enter menu mode, it won't process the calculations or time since time is actually stopped while in menu mode. So even if I have a 10 page conversation with him during his travel, it still won't delay him from arriving home at 2000. Actually, now that I think about it, he leaves work at 2000, so he'd probably get home around 2020 or so. I'll tweak the times when we get more into it.

If you fight him, that will delay him. But then you'll go to jail for a day any ways so the scripts will return to normal. Either that or you can kill him or just run out of the city. And by then, he'd be home any ways.
Well let me know on that error for the z rotation.
Thanks! I really hope this thing will work out.
User avatar
Dj Matty P
 
Posts: 3398
Joined: Sat Jun 09, 2007 12:31 am

Post » Sat May 28, 2011 1:11 am

I included a z-rotation value of zero in the original script, but it is easily overlooked (or dismissed as a typo when you entered the x, y and z-coordinates). Although you can enter a non-zero value the direction he faces will be irrelevant in the next frame since he will either be disabled or walking (and facing the direction he travels). Certainly you can remove the SetHello line, but it will not affect script performance. I included it here be certain that it was done. You might set fight to 30 (normal for non-combatants).

Position x y z 0 ; coordinates of home

Wow. That is an epic journey through the streets of Pelagiad. (Is there any wilderness left in Vvardenfell?) You may require more waypoints, particularly at the third cell boundary.
User avatar
Maddy Paul
 
Posts: 3430
Joined: Wed Feb 14, 2007 4:20 pm

Post » Sat May 28, 2011 9:39 am

Well now he's not showing up at 2000 in front of the shop like he should.

I probably don't have the exact matching coordinate as the grid points on the ground, but they're within a couple numbers, which I don't think should make a difference. But why is he not appearing at 2000?

You have Point 0,1,2,3. Mils travels from (0,-7) to (0,-8) to (-1,-8) and then in reverse order in the morning.
Point 0 is the spot right in front of the front door of the shop. Does it have to be right on the blue grid path marker?
Point 1.... is that the first grid point in 0,-8? Or is that the last grid point in 0,-7 just before entering 0,-8? I set it to the last grid point in 0,-7.
Point 2, I set as the last grid point in 0,-8 before stepping into -1,-8.
Point 3 is the spot right in front of his front door to his house, which is about 10 feet into -1,-8. Does it have to be right on the dot of the blue grid point?


Begin PE_Mils_Neddonii_NIGHT; script by Cyran0short noLore short doOnceshort stateif ( menumode == 1) ; if menu is open do not process        returnendifif ( doOnce == 0 ) ; clone starts disabled        set doOnce to 1        AIWander 0 0 0 0 ; do not go anywhere        Disableendifif ( GetCurrentAIPackage == -1 ) ; no AI package active        AIWander 0 0 0 0 ; do not go anywhere        Disable        if ( Gamehour >= 20 ) ; nighttime                Position -260 -60000 770 0 ; coordinates of home                set state to 100        elseif ( Gamehour < 8 ) ; nighttime                Position -260 -60000 770 0 ; coordinates of home                set state to 100        else ; daytime                Position 2140 -56970 1327 0 ; coordinates of shop                set state to 0        endifendifif ( state == 0 ) ; at shop        if ( GameHour >= 20 ) ; evening...                if ( GameHour < 20.333 ) ; but not too late                        FadeOut 1 ; hide sudden appearance                        FadeIn 1                        set state to 10                endif        endifelseif ( state == 20 )        Enable        set state to 30elseif ( state == 30 )        AITravel 2820 -57365 1393 ; coordinates of point 1        set state to 40elseif ( state == 40 )        if ( GetAIPackageDone == 1 ) ; he is at point 1                set state to 50   endifelseif ( state == 50 )        AITravel 78 -59959 846 ; coordinates of point 2        set state to 60elseif ( state == 60 )        if ( GetAIPackageDone == 1 ) ; he is at point 2                set state to 70        endifelseif ( state == 70 )        AITravel -260 -60000 770 ; coordinates of point 3 (home)        set state to 80elseif ( state == 80 )        if ( GetAIPackageDone == 1 ) ; he is at point 3 (home)                AIWander 0 0 0 0 ; do not go anywhere                set state to 90        endifelseif ( state == 90 )        FadeOut 1 ; hide sudden disappearance        FadeIn 1        set state to 100elseif ( state == 100 )         Disable        set state to 110elseif ( state == 110 ) ; at home        if ( GameHour >= 7.667 ) ; morning...                if ( GameHour < 8 ) ; but not too late                        FadeOut 1 ; hide sudden appearance                        FadeIn 1                        set state to 120                endif        endifelseif ( state == 120 )        Enable        set state to 130elseif ( state == 130 )        AITravel 78 -59959 846 ; coordinates of point 2        set state to 140elseif ( state == 140 )        if ( GetAIPackageDone == 1 ) ; he is at point 2                set state to 150   endifelseif ( state == 150 )        AITravel 2820 -57365 1393 ; coordinates of point 1        set state to 160elseif ( state == 160 )        if ( GetAIPackageDone == 1 ) ; he is at point 1                set state to 170        endifelseif ( state == 170 )        AITravel 2140 -56970 1327 ; coordinates of point 0 (shop)        set state to 180elseif ( state == 180 )        if ( GetAIPackageDone == 1 ) ; he is at point 0 (shop)                AIWander 0 0 0 0 ; do not go anywhere                set state to 190        endifelseif ( state == 190 )        FadeOut 1 ; hide sudden disappearance        FadeIn 1        set state to 200elseif ( state == 200 )        Disable        set state to 0 ; start overendif ; end of travel codeEnd PE_Mils_Neddonii_NIGHT

User avatar
Kyra
 
Posts: 3365
Joined: Mon Jan 29, 2007 8:24 am

Post » Sat May 28, 2011 12:08 am

Sorry. I made a dumb mistake in this block:

if ( state == 0 ) ; at shop	if ( GameHour >= 20 ) ; evening...		if ( GameHour < 20.333 ) ; but not too late			FadeOut 1 ; hide sudden appearance			FadeIn 1			set state to 10		endif	endif

There is no state = 10. Rather than re-number all the elseif-blocks, just change the line to read: set state to 20 . With that the script can progress to the point where the NPC is enabled.

No, the coordinates do not have to be exactly that of a pathgrid node. It may be irrelevant altogether, but I do not know what you are going to face when you test this script. You are going to have to develop some intuition about its performance, and when that is not enough open the console, select the traveler and type sv . Pay particular attention to the value of 'state'. If the script hangs up for too long I could add some debugging code to make it easier to monitor its progress.
User avatar
Gwen
 
Posts: 3367
Joined: Sun Apr 01, 2007 3:34 am

Post » Sat May 28, 2011 9:35 am

Still not appearing at 2000. You use the command "disable" frequently throughout the script. Do you think that is the problem?

Begin PE_Mils_Neddonii_NIGHT; script by Cyran0short noLore short doOnceshort stateif ( menumode == 1) ; if menu is open do not process        returnendifif ( doOnce == 0 ) ; clone starts disabled        set doOnce to 1        AIWander 0 0 0 0 ; do not go anywhere        Disableendifif ( GetCurrentAIPackage == -1 ) ; no AI package active        AIWander 0 0 0 0 ; do not go anywhere        Disable        if ( Gamehour >= 20 ) ; nighttime                Position -260 -60000 770 0 ; coordinates of home                set state to 100        elseif ( Gamehour < 8 ) ; nighttime                Position -260 -60000 770 0 ; coordinates of home                set state to 100        else ; daytime                Position 2140 -56970 1327 0 ; coordinates of shop                set state to 0        endifendifif ( state == 0 ) ; at shop        if ( GameHour >= 20 ) ; evening...                if ( GameHour < 20.333 ) ; but not too late                        FadeOut 1 ; hide sudden appearance                        FadeIn 1                        set state to 20                endif        endifelseif ( state == 20 )        Enable        set state to 30elseif ( state == 30 )        AITravel 2820 -57365 1393 ; coordinates of point 1        set state to 40elseif ( state == 40 )        if ( GetAIPackageDone == 1 ) ; he is at point 1                set state to 50   endifelseif ( state == 50 )        AITravel 78 -59959 846 ; coordinates of point 2        set state to 60elseif ( state == 60 )        if ( GetAIPackageDone == 1 ) ; he is at point 2                set state to 70        endifelseif ( state == 70 )        AITravel -260 -60000 770 ; coordinates of point 3 (home)        set state to 80elseif ( state == 80 )        if ( GetAIPackageDone == 1 ) ; he is at point 3 (home)                AIWander 0 0 0 0 ; do not go anywhere                set state to 90        endifelseif ( state == 90 )        FadeOut 1 ; hide sudden disappearance        FadeIn 1        set state to 100elseif ( state == 100 )         Disable        set state to 110elseif ( state == 110 ) ; at home        if ( GameHour >= 7.667 ) ; morning...                if ( GameHour < 8 ) ; but not too late                        FadeOut 1 ; hide sudden appearance                        FadeIn 1                        set state to 120                endif        endifelseif ( state == 120 )        Enable        set state to 130elseif ( state == 130 )        AITravel 78 -59959 846 ; coordinates of point 2        set state to 140elseif ( state == 140 )        if ( GetAIPackageDone == 1 ) ; he is at point 2                set state to 150   endifelseif ( state == 150 )        AITravel 2820 -57365 1393 ; coordinates of point 1        set state to 160elseif ( state == 160 )        if ( GetAIPackageDone == 1 ) ; he is at point 1                set state to 170        endifelseif ( state == 170 )        AITravel 2140 -56970 1327 ; coordinates of point 0 (shop)        set state to 180elseif ( state == 180 )        if ( GetAIPackageDone == 1 ) ; he is at point 0 (shop)                AIWander 0 0 0 0 ; do not go anywhere                set state to 190        endifelseif ( state == 190 )        FadeOut 1 ; hide sudden disappearance        FadeIn 1        set state to 200elseif ( state == 200 )        Disable        set state to 0 ; start overendif ; end of travel codeEnd PE_Mils_Neddonii_NIGHT

User avatar
Ashley Campos
 
Posts: 3415
Joined: Fri Sep 22, 2006 9:03 pm

Post » Sat May 28, 2011 12:00 am

I have done a little testing with my code and there is at least one problem that I can confirm.

The rescue code is being triggered by AIWander. It should not be, but it is. You may have to delete the if ( GetCurrrentAIPackage == -1 ) block of code.

I tested in un-expanded Pelagiad and did not have the benefit of an extensive pathgrid so perhaps it will work for you, but I encountered an AITravel glitch. Sometimes when there is not a reachable destination the code will advance to the next AITravel instruction, that most certainly fails. In short order the script accelerates to the end (in this case 'home' before disabling the NPC). I confirmed this with messageboxes inserted in the code to give me progress updates. If you encounter the same problem you will require many intermediate waypoints to guide your traveler around turns. Short intervals with clear lines of sight between waypoints will contribute you your success.

Even if you can get that to work I have to wonder about the z-coordinate of the shop location. When I place my test NPC at your coordinates he was (just barely) underground. Usually an NPC with wander AI will extricate himself from that situation, but unless Pelagiad Expanded changes the height map for Pelagiad I would suggest raising the NPC about 200 units.

You should being to consider if this happenstance (the player need to be very near the shop at 8 pm to witness this event with a window of 20 minutes - game time) is worth the trouble of creating.
User avatar
gandalf
 
Posts: 3400
Joined: Wed Feb 21, 2007 6:57 pm

Post » Sat May 28, 2011 8:21 am

He now appears for a split second at 2000 and then disappears. Then the screen fades in & out twice. And that's that.

If it gets too ridiculous then I'll just have him teleport from the shop to his house.

What do you think could be causing him to appear for only a split second and then the screen fading in and out?

This is the revised script:

Begin PE_Mils_Neddonii_NIGHT; script by Cyran0short noLore short doOnceshort stateif ( menumode == 1) ; if menu is open do not process        returnendifif ( doOnce == 0 ) ; clone starts disabled        set doOnce to 1        AIWander 0 0 0 0 ; do not go anywhere        Disableendifif ( state == 0 ) ; at shop        if ( GameHour >= 20 ) ; evening...                if ( GameHour < 20.333 ) ; but not too late                        FadeOut 1 ; hide sudden appearance                        FadeIn 1                        set state to 20                endif        endifelseif ( state == 20 )        Enable        set state to 30elseif ( state == 30 )        AITravel 2820 -57365 1393 ; coordinates of point 1        set state to 40elseif ( state == 40 )        if ( GetAIPackageDone == 1 ) ; he is at point 1                set state to 50   endifelseif ( state == 50 )        AITravel 78 -59959 846 ; coordinates of point 2        set state to 60elseif ( state == 60 )        if ( GetAIPackageDone == 1 ) ; he is at point 2                set state to 70        endifelseif ( state == 70 )        AITravel -260 -60000 770 ; coordinates of point 3 (home)        set state to 80elseif ( state == 80 )        if ( GetAIPackageDone == 1 ) ; he is at point 3 (home)                AIWander 0 0 0 0 ; do not go anywhere                set state to 90        endifelseif ( state == 90 )        FadeOut 1 ; hide sudden disappearance        FadeIn 1        set state to 100elseif ( state == 100 )         Disable        set state to 110elseif ( state == 110 ) ; at home        if ( GameHour >= 7.667 ) ; morning...                if ( GameHour < 8 ) ; but not too late                        FadeOut 1 ; hide sudden appearance                        FadeIn 1                        set state to 120                endif        endifelseif ( state == 120 )        Enable        set state to 130elseif ( state == 130 )        AITravel 78 -59959 846 ; coordinates of point 2        set state to 140elseif ( state == 140 )        if ( GetAIPackageDone == 1 ) ; he is at point 2                set state to 150   endifelseif ( state == 150 )        AITravel 2820 -57365 1393 ; coordinates of point 1        set state to 160elseif ( state == 160 )        if ( GetAIPackageDone == 1 ) ; he is at point 1                set state to 170        endifelseif ( state == 170 )        AITravel 2140 -56970 1327 ; coordinates of point 0 (shop)        set state to 180elseif ( state == 180 )        if ( GetAIPackageDone == 1 ) ; he is at point 0 (shop)                AIWander 0 0 0 0 ; do not go anywhere                set state to 190        endifelseif ( state == 190 )        FadeOut 1 ; hide sudden disappearance        FadeIn 1        set state to 200elseif ( state == 200 )        Disable        set state to 0 ; start overendif ; end of travel codeEnd PE_Mils_Neddonii_NIGHT

User avatar
Zach Hunter
 
Posts: 3444
Joined: Wed Aug 08, 2007 3:26 pm

Post » Fri May 27, 2011 8:37 pm

You are experiencing the same problem that I did in my tests. Since the destination coordinates of AITravel are not in a direct line of sight of the NPC's current position (and since the benefits of the pathgrid are being ignored), the script is cycling through all the states until it finds some code it can process. It is advancing to state == 90, fading, and then disabling in state == 100. There is no solution but to create a few dozen intermediate waypoints to guide the NPC through the town without the help of the pathgrid. Again, you should consider the value of this feature before you the few hours it will take to design such a script.
User avatar
JaNnatul Naimah
 
Posts: 3455
Joined: Fri Jun 23, 2006 8:33 am

Post » Sat May 28, 2011 1:46 am

Hmm, tell me, would it be much easier if his travel was just in one cell? Because I'm going to want to have a lot of NPCs walking around town during their "schedules", much like how Oblivion had it. Is it similar to how Fargoth goes to that tree stump in the evening? And plus, there are some quests I'm going to have where you have to follow some NPCs home to see what they do. So I'd at least like to figure out how to get him to walk to a certain point within the same cell. Once I got his done, I could just copy the script and revise it for other NPCs.
User avatar
A Lo RIkIton'ton
 
Posts: 3404
Joined: Tue Aug 21, 2007 7:22 pm

Post » Sat May 28, 2011 2:28 am

Yes it would be easier, but only because it is shorter. As long as the pathgrid is not guiding the NPC you would still require intermediate waypoints within the same cell - just fewer of then than in a multi-cell journey. The proof of this is that the NPC does not travel to the first waypoint even though it is located (I assume) in the same cell. Yes, you require a script like that used by Fargoth, one that moves your NPC incrementally toward his destination.
User avatar
Kayla Bee
 
Posts: 3349
Joined: Fri Aug 24, 2007 5:34 pm

Post » Sat May 28, 2011 2:21 am

Thanks so much for helping with it this far. I'm still going to use this type of implementation, but not for NPCs who have to travel more than one cell. Or actually, can we try and get him to walk down the street that's in the same cell? If we can get that to work, then I can use the same script and just vary it up for other NPCs. What information do you need again? It's the same times and everything. The cell is still 0,-7, and he'll be walking westwards. Do you need the end coordinate?
User avatar
Chavala
 
Posts: 3355
Joined: Sun Jun 25, 2006 5:28 am

Post » Fri May 27, 2011 8:44 pm

You will need to collect the x, y, z-coordinates for as many waypoints as it takes to link the starting and ending points of the journey with clear, unobstructed lines of sight from one to the next. Distances of around 1000 units are a good target, but they could be as much as twice that distance if there are not turns or obstacles. And yes, the terminal point coordinates are also needed.
User avatar
Dalley hussain
 
Posts: 3480
Joined: Sun Jun 18, 2006 2:45 am

Post » Sat May 28, 2011 5:56 am

I think this is what you need. I used a shrubbery to try and figure out the coordinates of the grid points. There are five points total for him to travel, including the beginning and end points. You can see that it's not really a straight line but it should be fine, I'm hoping. So again, this is triggered at 2000 every night to travel from beginning to end and stay there until.... lets say 0800. Then at 0800, he'll walk back to the beginning point and "disable". Back at 2000, he'll enable and immediately begin walk this path to the end point. This is all in 0,-7 cell. I hope this one works this time. hehe Let me know if you need any more information, Cyran0. Thanks!

http://img716.imageshack.us/img716/6231/68168545.jpg

Start
x 2222
y -56905
z 1330


x 2003
y -56716
z 1330


x 1761
y -56703
z 1330


x 1328
y -56800
z 1330


x 432
y -56772
z 1330
End
User avatar
Leah
 
Posts: 3358
Joined: Wed Nov 01, 2006 3:11 pm

Post » Sat May 28, 2011 8:35 am

I can guess how you used a shrubbery to get the coordinates. I usually collect such data in-game by dropping a torch at the player's feet and using the console with GetPos to get the coordinates of the torch. In that way I can easily see how my individual waypoints relate to each other. Since the pathgrid does not appear to be affecting the NPC's movement it may not matter (except for the length of the script) that he travels entirely within one cell. In fact, for such a short distance you may have too many waypoints (there will me a momentary pause at each one).

I am beginning to reconsider the fade to hide the NPC's enabling and disabling. It is very unlikely that the player is going to be near enough to witness this brief journey. The fading may just cause the player concern. It is easy to remove from the code - of course it is your decision. It you choose to keep it I should add a timer to delay the NPC's travel until the effect is completed.

Anyway here is your script. I have renumber the states properly and commented out the rescue code. With reachable waypoints I think the code should work, but you should test without if for now. Your z-coordinates are still 200 units lower than I would expect for that part of Pelagiad. However z is not too important for travel so it may work anyway, but it the rescue code resets the NPC's position he may spend some uncomfortable time underground.

Begin PE_TravelScript; Attached to the NPC: IS_C_Mils_NeddoniiNIGHTshort noLore short doOnceshort stateif ( menumode == 1) ; if menu is open do not process	returnendifif ( doOnce == 0 ) ; clone starts disabled	set doOnce to 1	AIWander 0 0 0 0 ; do not go anywhere	SetHello 0 ; no idle greetings to interrupt  travel	Disableendif;if ( GetCurrentAIPackage == -1 ) ; no AI package active;	if ( Gamehour >= 20 ) ; nighttime;		Position 432 -56772 1330 0 ; coordinates of home;		set state to 110;	elseif ( Gamehour < 8 ) ; nighttime;		Position 432 -56772 1330 0 ; coordinates of home;		set state to 110;	else ; daytime;		Position 222 -56950 1330 ; coordinates of shop;		set state to 0;	endif;	AIWander 0 0 0 0 ; do not go anywhere;	Disable;endifif ( state == 0 ) ; at shop	if ( GameHour >= 20 ) ; evening...		if ( GameHour < 20.333 ) ; but not too late			FadeOut 1 ; hide sudden appearance			FadeIn 1			set state to 10		endif	endifelseif ( state == 10 )	Enable	set state to 20elseif ( state == 20 )	AITravel 2003 -56716 1330 ; coordinates of point 1	set state to 30elseif ( state == 30 )	if ( GetAIPackageDone == 1 ) ; he is at point 1		set state to 40   endifelseif ( state == 40 )	AITravel 1761 -56703 1330 ; coordinates of point 2	set state to 50elseif ( state == 50 )	if ( GetAIPackageDone == 1 ) ; he is at point 2		set state to 60	endifelseif ( state == 60 )	AITravel 1328 -56800 1330 ; coordinates of point 3	set state to 70elseif ( state == 70 )	if ( GetAIPackageDone == 1 ) ; he is at point 3		set state to 80	endifelseif ( state == 80 )	AITravel 432 -56772 1330 ; coordinates of point 4 (home)	set state to 90elseif ( state == 90 )	if ( GetAIPackageDone == 1 ) ; he is at point 4 (home)		AIWander 0 0 0 0 ; do not go anywhere		set state to 100	endifelseif ( state == 100 )	FadeOut 1 ; hide sudden disappearance	FadeIn 1	set state to 110elseif ( state == 110 ) 	Disable	set state to 120elseif ( state == 120 ) ; at home	if ( GameHour >= 7.667 ) ; morning...		if ( GameHour < 8 ) ; but not too late			FadeOut 1 ; hide sudden appearance			FadeIn 1			set state to 130		endif	endifelseif ( state == 130 )	Enable	set state to 140elseif ( state == 140 )	AITravel 1328 -56800 1330 ; coordinates of point 3	set state to 150elseif ( state == 150 )	if ( GetAIPackageDone == 1 ) ; he is at point 3		set state to 160   endifelseif ( state == 160 )	AITravel 1761 -56703 1330 ; coordinates of point 2	set state to 170elseif ( state == 170 )	if ( GetAIPackageDone == 1 ) ; he is at point 2		set state to 180   endifelseif ( state == 180 )	AITravel 2003 -56716 1330 ; coordinates of point 1	set state to 190elseif ( state == 190 )	if ( GetAIPackageDone == 1 ) ; he is at point 1		set state to 200	endifelseif ( state == 200 )	AITravel 222 -56950 1330 ; coordinates of point 0 (shop)	set state to 210elseif ( state == 210 )	if ( GetAIPackageDone == 1 ) ; he is at point 0 (shop)		AIWander 0 0 0 0 ; do not go anywhere		set state to 220	endifelseif ( state == 220 )	FadeOut 1 ; hide sudden disappearance	FadeIn 1	set state to 230elseif ( state == 230 )	Disable	set state to 0 ; start overendif ; end of travel codeEnd PE_TravelScript

This code has not been tested.
User avatar
JERMAINE VIDAURRI
 
Posts: 3382
Joined: Tue Dec 04, 2007 9:06 am

Post » Sat May 28, 2011 8:20 am

It works.... almost. I don't like the fading of the screen though but I'm not certain which blocks of code to remove. It says if state == 220. So do I remove that command from the previous block at the end? Maybe I'll just let you remove it since I don't want to screw up the script.

He appears at 2000 and walks to his destination and disappears. Then he reappears at 0800 and walks back to the shop. BUT, when he gets there, instead of disabling, he does a 180 and walks right back to the other point but just keeps wandering in different directions. Weird, huh?

So how did Bethesda get Fargoth to walk to his hiding spot so smoothly in the very beginning of the game without him stopping at points? He doesn't have gridpoints to his spot.


You know what, we don't even the need the gridpoints in the game. I went and deleted them all and he still walks the same path as normal. I think gridpoints are placed in game so as to give NPCs who "wander" points of travel so they don't bump into stuff or walk into water. But if it's a scripted journey for a quest, like with Fargoth, you don't need gridpoints. But I can't find Fargoth's script anywhere in game, and it's not attached to him either. All he has is a localstate script which only says short state.... and that's it. So I don't know how they're getting him to walk and place his stuff in the treestump.

The treestump itself has this script:

Begin treestumpScriptshort setonceif ( OnActivate == 0 )	returnendifif ( GetJournalIndex "MS_Lookout" >= 20 )	if ( GetJournalIndex "MS_Lookout" < 40 )		if ( fargothwalk >= 2 )			if ( setonce == 0 )				Journal "MS_Lookout" 40				set setonce to -1			endif		endif	endifendifActivateEnd treestumpScript


So maybe he's walking that path via the journal updates or something. But I don't want to mess with journals for Pelagiad Expanded.
User avatar
sexy zara
 
Posts: 3268
Joined: Wed Nov 01, 2006 7:53 am

Next

Return to III - Morrowind