Pavlos Posted October 24, 2005 Share Posted October 24, 2005 How do you change someone so that they are sitting down, and can you have a proper conversation with them if they are. I want the Onderon DIplomat in 204TEL to sit down on a bench I've spawned in, actually I think what I've done to the module so far makes it feel better- I haven't gotten round to adding in any sidequests etc. but I'll be doing that some other time. Link to comment Share on other sites More sharing options...
Tupac Amaru Posted October 24, 2005 Share Posted October 24, 2005 You can do this by writing a custom spawn and user define script. The spawn script should enable on dialogue end events and play the animation. This is a modified version of the default spawn script the Onderon diplomat uses that will make him sit down: #include "k_inc_generic" #include "k_inc_treas_k2" void main() { // Enable user defined on dialogue end event. GN_SetSpawnInCondition( SW_FLAG_EVENT_ON_DIALOGUE_END ); //OPTIONAL BEHAVIOR - Fire User Defined Event 1011 // Code taken from the default spawn script: //****** BEGIN DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ****** GN_SetDayNightPresence(AMBIENT_PRESENCE_ALWAYS_PRESENT); // This function although poorly named sets up the listening patterns and other // important data for the creature it should never be removed. GN_SetListeningPatterns(); SetLocalNumber(OBJECT_SELF, 11, 6);// FAK - OEI default turret cooldown //****** END DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ****** //****** TREASURE PLACEMENT PlaceCritterTreasure(OBJECT_SELF, Random(4)-2); //****** TURN ON WALKPOINTS ****** // The following line causes the object to follow waypoints GN_WalkWayPoints(); // Added code for making him sit down: // Play sit animation. AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_LOOPING_SIT_CHAIR, 1.0, -1.0)); // Set facing. Replace the numbers with whereever character should look. vector vFacing = Vector(0.0, 0.0, 0.0); AssignCommand( OBJECT_SELF, SetFacingPoint(vFacing)); // Don't turn around to face player during conversation. SetLockOrientationInDialog(OBJECT_SELF, TRUE); SetOrientOnClick(OBJECT_SELF, FALSE); } Then make a user defined script, save it under a unique name and add the code for the animation above in the Dialogue End event (number 1011) like in this modified default user defined script: #include "k_inc_generic" #include "k_inc_debug" #include "k_inc_utility" void main() { int nUser = GetUserDefinedEventNumber(); if(nUser == 1001) //HEARTBEAT { } else if(nUser == 1002) // PERCEIVE { } else if(nUser == 1003) // END OF COMBAT { } else if(nUser == 1004) // ON DIALOGUE { } else if(nUser == 1005) // ATTACKED { } else if(nUser == 1006) // DAMAGED { } else if(nUser == 1007) // DEATH { } else if(nUser == 1008) // DISTURBED { } else if(nUser == 1009) // BLOCKED { } else if(nUser == 1010) // SPELL CAST AT { } else if(nUser == 1011) //DIALOGUE END { // Sit down again after dialog ends. AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_LOOPING_SIT_CHAIR, 1.0, -1.0)); // Set facing. Replace the numbers with whereever he should look. vector vFacing = Vector(0.0, 0.0, 0.0); AssignCommand( OBJECT_SELF, SetFacingPoint(vFacing)); // Don't turn around to face player during conversation. SetLockOrientationInDialog(OBJECT_SELF, TRUE); SetOrientOnClick(OBJECT_SELF, FALSE); } else if(nUser == HOSTILE_RETREAT) { UT_ReturnToBase(); } } Compile the two scripts. In the character's .utc put the script names in the fields ScriptSpawn and ScriptUserDefine. In the character's dialog add the Animation 10424 in every entry node if he shouldn't stand up during a dialogue. If you want him to stand up you should remove the SetLockOrientationInDialog and SetOrientOnClick commands in the above scripts as those prevent him from facing the player. Link to comment Share on other sites More sharing options...
Pavlos Posted October 24, 2005 Author Share Posted October 24, 2005 Wow thanks! Great Tutorial! This will really help. Such a small thing as sitting dwon constantly demands that script?! Geez! Edit: When you say, "and add the code for the animation above in the Dialogue End event," do you mean the name of the file? I'm fine with the rest but I got lost there. Edit: I got him sitting down, I think that is the first script, but once dialogue ends he stands up again. Can you explain to me how to make the second one work step by step, if you don't mind of course. If you can't be bothered I'm sure I'll figure it out. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.