PDA

View Full Version : I need a script...


Darth Xander
11-30-2007, 09:27 PM
Could somebody make me a script that spawns a custom npc right next to the pc? I made this but It will not work:
void main () {
location locNPC=Location(GetFirstPC);
object oNPC=GetObjectByTag(pc_jedi");}

Miles Edgeworth
11-30-2007, 09:48 PM
This should work:

CreateObject( OBJECT_TYPE_CREATURE,
"pc_jedi", GetLocation(GetFirstPC()));

Darth Xander
12-08-2007, 10:11 AM
This should work:

CreateObject( OBJECT_TYPE_CREATURE,
"pc_jedi", GetLocation(GetFirstPC()));
That script won't work, It says something about a syntax error at CreateObject. By the way this is for TSL.

Marius Fett
12-08-2007, 10:24 AM
Try putting a void main () at the start of it, like this:



void main()

{

CreateObject( OBJECT_TYPE_CREATURE,
"pc_jedi", GetLocation(GetFirstPC()));

}

Darth Xander
12-08-2007, 10:40 AM
THANK YOU THANK YOU THANK YOU. DarthDingDong YOU ROCK!!!!

Marius Fett
12-08-2007, 10:59 AM
Umm..... no problem... :lol:

Darth Xander
12-08-2007, 11:27 AM
I have almost finished my W.I.P but could I have a script that makes an npc salute?

Marius Fett
12-08-2007, 11:31 AM
I don't know how to do that, I SUCK at scripting........

Darth Xander
12-08-2007, 04:11 PM
Also I need this npc I am making to act and react like a party member but he musn't be a party member. Basically all I want him to do is to be follow me around.

glovemaster
12-08-2007, 07:48 PM
You could try:

void main()
{
CreateObject(OBJECT_TYPE_CREATURE, "pc_jedi", GetLocation(GetFirstPC()));
object PC_JEDI = GetObjectByTag("pc_jedi");
AssignCommand(PC_JEDI, ActionPlayAnimation(104, 1.0));
DelayCommand(5.0, AssignCommand(PC_JEDI, ActionForceFollowObject(GetFirstPC())));
}

This will only get the created NPC to salute and follow the lead player, if you want to script in combat then im thinking of a "OnHeartBeat" script to get whether or not you are in combat, who the target is and to attack that target.

Darth Xander
12-09-2007, 10:10 AM
I used Dak Vesser's script to make him follow me
but I still need to make the guy salute.
You guys who helped me will be fully credited.


// k_fpm_heartbtxx

#include "k_inc_debug"
#include "k_inc_generic"
#include "k_inc_switch"
#include "k_inc_utility"



void main()
{



object oEnemy = GetNearestCreature(CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY);
if(!GN_GetSpawnInCondition(SW_FLAG_AI_OFF) && !GetSoloMode())
{
if(GetPartyMemberByIndex(0) != OBJECT_SELF)
{
if(//GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOW &&
GetCurrentAction(OBJECT_SELF) != ACTION_WAIT &&
!GetIsConversationActive() &&
!GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) &&
GetCommandable())
{

if(!GN_GetIsFighting(OBJECT_SELF) && !GetIsObjectValid(oEnemy))


ClearAllActions();
if(GetDistanceBetween(OBJECT_SELF, GetPartyMemberByIndex(0)) < 5.0)
{
ClearAllActions();
ActionForceMoveToObject(GetPartyMemberByIndex(0), FALSE, 1.0);
//SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the bWalk routine.");
}
if(GetDistanceBetween(OBJECT_SELF, GetPartyMemberByIndex(0)) > 5.0)
{
ClearAllActions();
ActionForceMoveToObject(GetPartyMemberByIndex(0), TRUE, 3.5);
//SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the bRun routine.");
}

}
}
}
else if(GetSoloMode() && GetCurrentAction(OBJECT_SELF) == ACTION_FOLLOWLEADER)
{
ClearAllActions();
}
if(GN_GetSpawnInCondition(SW_FLAG_EVENT_ON_HEARTBE AT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1001));
}



}

DarthJebus05
12-09-2007, 10:42 AM
Doesn't a Sith salute in the game? If this is for a dialog file, just find the animation. What are you looking for exactly? Someone that salutes randomly? Dialog animations?

Darth Xander
12-09-2007, 11:43 AM
I am after a script that makes the npc salute not an animation.

Marius Fett
12-09-2007, 11:55 AM
The script would fire an animation... :lol:

Darth Xander
12-09-2007, 04:05 PM
Ok last one, forget teh salute it was a lame idea anyway. I need a script that makes a placeable disappear once it closes. And by disapperar I mean like fading away not "pop out of existance".
Thank you guys for all your help I won't forget this.

Edit: I have finished this mod, thank you everyone who helped ans tried to help. You have all been fully credited and I will post a link soon.

DarthJebus05
12-27-2007, 07:46 AM
:O Never posted the link... unless it's in another thread. Anyways, I just bought my TSL from Ebay tonight, so instant download when I get it :P

Marius Fett
12-27-2007, 09:19 AM
I just got my new copy of TSL off Amazon.co.uk :lol:

DarthJebus05
12-27-2007, 10:00 AM
Amazon doesn't deliver to my area :(