sitting, sleeping and jumping

Moderator: Event DM

Post Reply
User avatar
frogmella
Apprentice Scholar
Posts: 816
Joined: Wed Sep 18, 2002 12:35 pm
Location: London, UK -- GMT

sitting, sleeping and jumping

Post by frogmella » Sat Jul 24, 2004 7:37 pm

can any of you experts give me some guidance about the following..

1) SITTING: I've created some placeable seats (cushion, stool etc). I have attached to them the Avlis script 'sitting'. The problem is that the chr always seems to sit doen and face the same direction - no mater how I orient the seat (the green arrow). I want to make sure the chr faces a certain direction.

2) SLEEPING: I'm creating a series of waypoints for an animal. When it gets to one, I want it to sleep - is this possible? (Is there an animation?) And if so, what script?

3) JUMPING: My animal appears to go into a hollow log and out the other end. I think I have to create a waypoint at each end of the log and jump it from one to the other. Is this possible? What would the script look like? And is it possible to build in a dely?

I know I'm asking a lot, but I'm trying to learn and you guys are further down the road.

many thanks

frogs
User avatar
_Wake_
Scholar of Fools
Posts: 435
Joined: Thu Sep 11, 2003 2:21 am
Location: Seattle, Wa.(GMT-7)

Post by _Wake_ » Sat Jul 24, 2004 9:13 pm

I suck but if the NPC animal was to interact with the PC then this delay jump could be used by putting the waypoint at the other end of the log.


Change the NPC_TAG_HERE in code below to the tag of your NPC and place this script in the Action_Taken Event of your NPC's dialog:

NWScript:
// wrapper function for delay jumping
void CustomDelayFunction (object oObject1, location lLocation)
{
// Make Object1 jump to the location
AssignCommand(oObject1,ActionJumpToLocation(lLocation));
// end wrapper function
}
// Begin main function
void main()
{
// Get the tag of the NPC
object oNPC = GetObjectByTag("NPC_TAG_HERE");
// Get the location of the destination waypoint
location lWP_D = GetLocation(GetObjectByTag("WP_TAG_HERE"));
// Delay jump the NPC to the waypoint destination
DelayCommand(1.5,CustomDelayFunction(oNPC, lWP_D));
}



I didnt test this shortend script but I used a much larger version with a NPC that teleports himself and the PC to a waypoint and it worked well.
Hope that helps some but as I said I suck :P I'll put the full version of what I used incase it helps out somewhere eles :)

NWScript:
// wrapper function for delay jumping
void CustomDelayFunction (object oObject1, object oObject2, location lLocation)
{
// Make some effects around PC, NPC, and location
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3),oObject1);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3),oObject2);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3),lLocation);
// Make Object1 jump to the location
AssignCommand(oObject1,ActionJumpToLocation(lLocation));
// Make Object2 jump to the location
AssignCommand(oObject2,ActionJumpToLocation(lLocation));
// Set Object1 as enemy
SetIsTemporaryEnemy(oObject2,oObject1);
// end wrapper function
}
// Begin main function
void main()
{
// Get the PC that is in conversation
object oPC = GetPCSpeaker();
// Get the tag of the NPC
object oNPC = GetObjectByTag("NPC_TAG_HERE");
// Get the location of the destination waypoint
location lWP_D = GetLocation(GetObjectByTag("WP_TAG_HERE"));
// Have the NPC cast a fake spell - for effect only
AssignCommand(oNPC,ActionCastFakeSpellAtObject(SPELL_DESTRUCTION,oNPC,PROJECTILE_PATH_TYPE_DEFAULT));
// Delay jump the PC and NPC to the waypoint destination
DelayCommand(1.5,CustomDelayFunction(oNPC,oPC,lWP_D));
}


_Wake_
User avatar
Gimlor
Prince of Bloated Discourse
Posts: 246
Joined: Fri Oct 31, 2003 6:33 pm

Re: sitting, sleeping and jumping

Post by Gimlor » Sat Jul 24, 2004 9:21 pm

frogmella wrote:can any of you experts give me some guidance about the following..

1) SITTING: I've created some placeable seats (cushion, stool etc). I have attached to them the Avlis script 'sitting'. The problem is that the chr always seems to sit doen and face the same direction - no mater how I orient the seat (the green arrow). I want to make sure the chr faces a certain direction.
This problem is due to the use nodes.. Make sure the USE Node 1 is present.. if it isnt, the PC/NPC will always face north
and the PC/NPC, will always face USENODE1 when sitting
User avatar
Jordicus
Team Member; Retired with Honors
Posts: 8042
Joined: Tue Jan 21, 2003 3:46 pm
Location: Whitehall, PA (GMT -4)
Contact:

Post by Jordicus » Sat Jul 24, 2004 9:21 pm

sitting: if you are using an invisible object to represent a cushion, then the invisible object MUST be on the ground. flat on the floor. if it raises up at all from the ground level, then the NPC/PC will sit facing north

sleeping:

Code: Select all

AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0f, 1000.0f))
change the 1000 to whatever duration you want them to lie down for. and change oPC to the appropriate tag/object for the NPC you need. However, I'm not positive what would happen if you assign that animation to an animal. I think it should work, but you'd have to try and find out for sure.
You see things and you say, "Why?" But I dream things that never were and say, "Why not?" George Bernard Shaw
dougnoel
Team Member; Retired with Honors
Posts: 6261
Joined: Fri May 14, 2004 4:59 pm
Location: VA (GMT -4)
Contact:

Post by dougnoel » Sat Jul 24, 2004 9:30 pm

Jordicus wrote:However, I'm not positive what would happen if you assign that animation to an animal.
They'll use the knockdown animation and the normal sleep Z's will appear. :)
User avatar
frogmella
Apprentice Scholar
Posts: 816
Joined: Wed Sep 18, 2002 12:35 pm
Location: London, UK -- GMT

Post by frogmella » Sun Jul 25, 2004 9:41 am

Thanks guys ... that gives me something to play/experiment with.

f
User avatar
frogmella
Apprentice Scholar
Posts: 816
Joined: Wed Sep 18, 2002 12:35 pm
Location: London, UK -- GMT

Post by frogmella » Sun Jul 25, 2004 10:28 pm

@ Gimlor

... where can I find/check on the status of USENODE1? It's not in the properties for my usable seat. Thanks in advance for the help.

f
User avatar
Sindol
Team Member; Retired with Honors
Posts: 6479
Joined: Mon Jan 06, 2003 4:23 pm
Location: Nijmegen - Netherlands (GMT+1)
Contact:

Post by Sindol » Mon Jul 26, 2004 8:22 am

It sitting doesn't work directionally speaking, you can just make the placeable not usable, but put an invisible object directly under it that is usable and has the sitdown script (like Jordicus described). That'll work.
So much fun,
yet so little time to enjoy it.
- Sindol
User avatar
frogmella
Apprentice Scholar
Posts: 816
Joined: Wed Sep 18, 2002 12:35 pm
Location: London, UK -- GMT

Post by frogmella » Mon Jul 26, 2004 1:08 pm

*off to give it a try*
thanks
f
User avatar
Jordicus
Team Member; Retired with Honors
Posts: 8042
Joined: Tue Jan 21, 2003 3:46 pm
Location: Whitehall, PA (GMT -4)
Contact:

Post by Jordicus » Mon Jul 26, 2004 1:50 pm

frogmella wrote:@ Gimlor

... where can I find/check on the status of USENODE1? It's not in the properties for my usable seat. Thanks in advance for the help.

f
IIRC, USENODE1 and such are all part of the walkmesh properties. you'd probably have to use GMax or something like that so see them
You see things and you say, "Why?" But I dream things that never were and say, "Why not?" George Bernard Shaw
Post Reply