randydg Posted May 13, 2005 Share Posted May 13, 2005 // the some_action is a function that usually starts with "Action" AssignCommand(oCreature,giveitem(a_robe_17) or what am i supose to do after the ocreature, to make it give me an item? Link to comment Share on other sites More sharing options...
General Kenobi Posted May 13, 2005 Share Posted May 13, 2005 I sooo totally don't follow your question:confused: do you want to know something about how to get an item using the "giveitem" cheats or a scripting ??? on how to place an item? DM Link to comment Share on other sites More sharing options...
randydg Posted May 13, 2005 Author Share Posted May 13, 2005 I'm trying to get an npc after a conversation give you a datapad. but i can't figure it out. Link to comment Share on other sites More sharing options...
Darth333 Posted May 13, 2005 Share Posted May 13, 2005 Originally posted by randydg // the some_action is a function that usually starts with "Action" AssignCommand(oCreature,giveitem(a_robe_17) or what am i supose to do after the ocreature, to make it give me an item? If you want to give an item to the PC, use the following code: void main() { CreateItemOnObject ( "a_robe_17", GetFirstPC()); } For another creature: void main() { CreateItemOnObject ( "a_robe_17", GetObjectByTag ("Creature_tag_goes_here")); } For a dataped, simply replace a_robe_17 by your item template. Link to comment Share on other sites More sharing options...
randydg Posted May 13, 2005 Author Share Posted May 13, 2005 thank you sooo much. im also having trouble on a walk up script where the npc walks up to you and autostarts the dialog, ok i got it working but it autostarts soon as i come into the area everytime. i don't want this, i just want it to start 1 time and thats when i come close by him. script: --------------------------------------------------------------------- void main() { object oNPC=GetObjectByTag("Twilekmale"); location lMe=GetLocation(GetFirstPC()); ActionDoCommand(SetCommandable(TRUE,oNPC)); AssignCommand (oNPC,ActionForceMoveToLocation(lMe,FALSE)); AssignCommand (oNPC, ActionStartConversation(GetFirstPC())); } ----------------------------------------------------------------------- i compiled it then put the script under the npc under scipts then on onnotice. is this not right? and if i need to i'll make a new thread with this. Link to comment Share on other sites More sharing options...
stoffe Posted May 13, 2005 Share Posted May 13, 2005 Originally posted by randydg (snip) i compiled it then put the script under the npc under scipts then on onnotice. is this not right? and if i need to i'll make a new thread with this. If you put that script as it is in the creature's OnPerception event slot then it will fire as soon as the creature spawns if there are any other creatures within a 30 meter radius. The OnPerception event fires whenever the creature perceives, or loses perception, of any creature, not just the Player or any party members. When a creature is spawned into the area its OnPerception event will immediately fire for all creatures it can see. Wrap the script code in a: if (GetIsPartyLeader(GetLastPerceived())) { ... } ...condition and it should only fire when he spots the player controlled character. (Besides, if the script is assigned to the NPCs AI event script slots you don't need to use the GetObjectByTag() call to get the NPC. Just use OBJECT_SELF instead. The AssignCommand()s are also unnecessary if the creature is the object that runs the script already.) (And you probably want to assign a variable check or something to the script as well so it only fires once, otherwise he'll run after you as soon as you leave his perception range, or whenever you return.) (Oh, and use ActionMoveToObject instead of ActionMoveToLocation, otherwise he will run to where the player was when the script fired, which isn't necessarily where the player is when he arrives if the player is running around. ) Link to comment Share on other sites More sharing options...
randydg Posted May 13, 2005 Author Share Posted May 13, 2005 last thing then i'm done. after this question i should have everything down and can do it on my own. object oNPC=GetObjectByTag("sithlord"); killobject; is this correct? i promise this is the last scripting question, i'm just trying to get back on my feet from being away so long. and getting used to kotor2 Link to comment Share on other sites More sharing options...
stoffe Posted May 13, 2005 Share Posted May 13, 2005 Originally posted by randydg last thing then i'm done. after this question i should have everything down and can do it on my own. object oNPC=GetObjectByTag("sithlord"); killobject; is this correct? i promise this is the last scripting question, i'm just trying to get back on my feet from being away so long. and getting used to kotor2 Killobject? Are you trying to kill the creature or just remove it from the game world? object oNPC=GetObjectByTag("sithlord"); ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oNPC); ...if you want to kill it. And... object oNPC=GetObjectByTag("sithlord"); DestroyObject(oNPC); ...if you just want to get rid of it. Link to comment Share on other sites More sharing options...
randydg Posted May 13, 2005 Author Share Posted May 13, 2005 thanks for all your help, i think i got it under control now. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.