lord_yig Posted April 29, 2005 Share Posted April 29, 2005 There may already have been a question like this but i can't find it with the search features. So i ask... Beeing a complete noob in scripting, how could i make a holocron to work as it should work... I want to make it an activable object that through some dialogue options can make the PC, or any NPC in his party who already is a jedi, to learn some force power he don't already knew. I was thinking about giving one or two force power (all three levels of each) for a single holocron and to make several of them... But it would certainly need some good scripting skill and some dialogue editing too... And for a holocron to work really correctly with some past jedi's hologram to be shawn i prefer not to think about this for the time beeing, we'll see if the basic works first... (but it would be cool no ?) If one of the pro roaming here can give some advices it would be greatly appriciated before i try to plundge myself into the scripting tutorials (and the madness that comes with it ) Link to comment Share on other sites More sharing options...
Xcom Posted April 29, 2005 Share Posted April 29, 2005 Originally posted by lord_yig I want to make it an activable object that through some dialogue options can make the PC, or any NPC in his party who already is a jedi, to learn some force power he don't already knew. Do you want it to be a placeable object, meaning that it just sits somewhere in one place and player can interact with like with container... or you want it to be an item that player can acquire and then use from the inventory? Link to comment Share on other sites More sharing options...
lord_yig Posted April 30, 2005 Author Share Posted April 30, 2005 Originally posted by Xcom or you want it to be an item that player can acquire and then use from the inventory? That's exactly how i'd like it to work. But i don't know much about scripting... I'll have to learn... Link to comment Share on other sites More sharing options...
Xcom Posted April 30, 2005 Share Posted April 30, 2005 Originally posted by lord_yig That's exactly how i'd like it to work. But i don't know much about scripting... I'll have to learn... Hmm, that'll be more work, though the scripting part of that isn't that hard. 1. You need to make item template for you holocron, an UTI file. It must be a usable object that runs spell onuse. 2. You need to modify spells.2da and create unique force power (aka spell). The force power is basically a fake as it's only needed to run a script. 3. You need to create an NPC templace (UTC file). This will be the character that will spawn when you use the holocron, and he/she will automatically start coversation with you. 4. You need to have conversation (DLG file) for the character which will control who gets what. 5. I think you'll need two scripts. The first one is for spawning the character and running dialog. This will be spell script that fires when player uses holocron. The second script will fire from the dialogue itself and actually give powers depending on the choices you make during the dialogue. It will also destroy the character/hologram when you exit conversation. The script strongly depends on the structure of your dialogue. Link to comment Share on other sites More sharing options...
Colma Adawin Posted April 30, 2005 Share Posted April 30, 2005 That sounds like a good idea. When you could descover the Sith Holocron on Korriban, goto Dantooine enclave, in the Jedi Archives there could be a Jedi Holocron, you click it, and it'll disappear, but then it'll be in the Ebon Hawk Cargo Bay. you could use it a certain amount of times, once every time you enter the Ebon Hawk. each time you use it, it'll give you the Level up screen for Powers, and when your at a certain level it'll give you some Prestige Feats. That would be a definent Download for me!! Obviasly it will take sometime, but if your dedicated to learn scripting, it should work perfectly. Good Luck if you decide to take this up!!! MattCole Link to comment Share on other sites More sharing options...
Lorden Darkblade Posted April 30, 2005 Share Posted April 30, 2005 I like Matt's idea It will be very cool if you can do it Link to comment Share on other sites More sharing options...
Jeff Posted April 30, 2005 Share Posted April 30, 2005 Originally posted by MattColejk you could use it a certain amount of times, once every time you enter the Ebon Hawk. each time you use it, it'll give you the Level up screen for Powers, and when your at a certain level it'll give you some Prestige Feats. That would be a definent Download for me!! If that would happen I would definately download it. That is a great idea and although it would be hard, it would be worth it I think. Good luck! Link to comment Share on other sites More sharing options...
tk102 Posted April 30, 2005 Share Posted April 30, 2005 Originally posted by MattColejk you could use it a certain amount of times, once every time you enter the Ebon Hawk. each time you use it, it'll give you the Level up screen for Powers, and when your at a certain level it'll give you some Prestige Feats. I believe the level up screen will not work unless you are actually leveling up -- otherwise I suspect it would replace what force power you selected for the level that you're already at. But you could get the same effect through a dialog where the player can choose what power he wants to learn. It would also give the author of the mod more control over what powers to make available. The trickier part would be keeping track of how often the holocron could be used. Link to comment Share on other sites More sharing options...
Colma Adawin Posted April 30, 2005 Share Posted April 30, 2005 Originally posted by tk102 I believe the level up screen will not work unless you are actually leveling up -- otherwise I suspect it would replace what force power you selected for the level that you're already at. But you could get the same effect through a dialog where the player can choose what power he wants to learn. It would also give the author of the mod more control over what powers to make available. The trickier part would be keeping track of how often the holocron could be used. THATS WHAT I WAS SUPPOSED TO SAY Thanx TK, you just made it a bit eaiser for lord_yig MattCole Link to comment Share on other sites More sharing options...
TheCorman Posted April 30, 2005 Share Posted April 30, 2005 (idea from some mod dialogs I've looked at) Couldn't you use a varible from the tutorial? (no affect on the rest of the game). Like upon getting the holocron "001EBO_Cockpit_Door" is set to 10, upon first use its set to 11, 2nd 12 etc. In the dialog you just have to have x amount of the same dialog, but have it with conditional script needing a certain number, for first use 10, second 11, etc, and then set it to the next varible. When you figure the player should no longer be able to use it just create a dialog option saying that the energy within the holocron is gone or something. Dialog would probably look somethinglike this: (?) You have activate a holocron [uses conditinal script to check global for 10] ---Use [sets global to 11] -------Select a force power ----------- ---------------[dialog] ---------------------(continue) [End Dialog] You have activate a holocron [uses conditinal script to check global for 11] ---Use [sets global to 12] -------Select a force power (already listed) You have activate a holocron [uses conditinal script to check global for 12] ---Use [sets global to 13] -------Select a force power (already listed) The Force energy that was onced contained within this holcoron is gone [uses conditional script to check global for 13] --- (continue) [End Dialog] This might be totally off the mark and have a major defect but of course I don't know that much about scripting and dialouges *edit* and further on the dialog could be edited for new feats/powers, and you could also add how many times you've used it to the dialog Link to comment Share on other sites More sharing options...
lord_yig Posted May 1, 2005 Author Share Posted May 1, 2005 Thanks to all of you for your supports and ideas. Following your advices, here is what i have so far. I have an item uti file using the "Combat Shot" Baseitem ref. It make the "Use Item" button accessible in the inventory. I have a very basic script like this : void main() { // Spawn Creature NPC CreateObject( OBJECT_TYPE_CREATURE, "LY_Holocron_NPC_01", GetLocation(GetFirstPC()) ); // Start Conversation ActionStartConversation(OBJECT_SELF, "LY_Holocron_NPC_01", FALSE, CONVERSATION_TYPE_CINEMATIC, FALSE, "", "", "","", "", "", FALSE, -1, -1, 0); } I have a NPC utc file and a dialogue file. So far the item appears in the inventory and is linked with the script "OnActivate". The script compiled with now problem and warnings but won't launch (or doesn't do anything) once you clik on "Use Item" in the inventory. So i can't see if my dialogue works since the NPC won't spawn and the dialogue don't start... I have tried to understand Darth333 script from the "Force Zombie" mod but it is designed for attacking creature so i guess while using some feature i need it contains code that i don't need but i can't figured which part i may use and which i can remove ???? Link to comment Share on other sites More sharing options...
Prime Posted May 1, 2005 Share Posted May 1, 2005 I'm a little confused with what you are saying here, but do you know if the script is getting run? You could put some output directed to the feedback console so that you can at least see how far things are getting. You can add this for output are various points in your script: SendMessageToPC(GetFirstPC(), "my text"); Link to comment Share on other sites More sharing options...
lord_yig Posted May 1, 2005 Author Share Posted May 1, 2005 I have just tried what you have suggested. The messages are written in the console but it does not do anything. So the script is getting run but does not do what it is supposed to do... ???? Here is my second script... based on Darth333 force zombie script... // --------------------------------- // // Based on Darth333's d3_zombie.nss // // --------------------------------- // int LY_ITEM_ABILITY_HOLOCRON_01 = 282; #include "k_inc_debug" #include "k_inc_utility" void SpawnHolocron(string sTemp) { SendMessageToPC(GetFirstPC(), "SPAWN HOLO"); object oHolocron = CreateObject(OBJECT_TYPE_CREATURE, sTemp, GetLocation(OBJECT_SELF)); SetLocalNumber(oHolocron, 1, 0); } void main() { int nSpell = GetSpellId(); SendMessageToPC(GetFirstPC(), "GET SPELL ID"); if (nSpell == LY_ITEM_ABILITY_HOLOCRON_01) { SendMessageToPC(GetFirstPC(), "SPELL ID IS GOOD"); SpawnHolocron("ly_holocron_npc_01"); SendMessageToPC(GetFirstPC(), "START CONVERSATION"); ActionStartConversation(OBJECT_SELF, "LY_Holocron_NPC_01", FALSE, CONVERSATION_TYPE_CINEMATIC, FALSE, "", "", "","", "", "", FALSE, -1, -1, 0); } return; } Link to comment Share on other sites More sharing options...
Xcom Posted May 1, 2005 Share Posted May 1, 2005 AFAIK, the file names of yout dialogs, utc, uti files shouldn't exceed 16 characters (not counting the extension). ie: ly_holocron_npc_01.dlg is too long So, try renaming them and don't forget changing TemplateResRef for the NPC in GFFEditor as well. It should be the same as the filename (w/o extension). Assuming you name your files as follows, ly_holo.utc (for the hologram npc) ly_holo_dlg.dlg (and its dialog) try this script: void DB_PrintMsg(string sMsg) { SendMessageToPC(GetPartyLeader(),sMsg ); } void main() { object oHolo = GetObjectByTag("ly_holo"); if (GetIsObjectValid(oHolo)) { // don't run this if hologram already exists DB_PrintMsg("Hologram already exists"); return; } oHolo = CreateObject(OBJECT_TYPE_CREATURE, "ly_holo", GetLocation(OBJECT_SELF)); if (GetIsObjectValid(oHolo)) { DB_PrintMsg("Hologram created successfully"); DelayCommand(0.2, AssignCommand(oHolo, ActionStartConversation( OBJECT_SELF, "ly_holo_dlg"))); } else { DB_PrintMsg("Failed to spawn NPC"); } } Link to comment Share on other sites More sharing options...
Prime Posted May 1, 2005 Share Posted May 1, 2005 You also might want to check that... object oHolocron = CreateObject(OBJECT_TYPE_CREATURE, sTemp, GetLocation(OBJECT_SELF)); creates oHolocron ok. Check if the object is valid or not just to make sure. Link to comment Share on other sites More sharing options...
tk102 Posted May 1, 2005 Share Posted May 1, 2005 I thought a holocron would be a placeable, not a creature... Link to comment Share on other sites More sharing options...
Xcom Posted May 1, 2005 Share Posted May 1, 2005 Originally posted by tk102 I thought a holocron would be a placeable, not a creature... Hmm, from what I undestand it's not creature, it's an item that produces a hologram (a creature) when used. Link to comment Share on other sites More sharing options...
tk102 Posted May 1, 2005 Share Posted May 1, 2005 Oh yes... that makes sense then. Carry on! (congrats on post #1000, Xcom) Link to comment Share on other sites More sharing options...
lord_yig Posted May 1, 2005 Author Share Posted May 1, 2005 Originally posted by Xcom Thanks Xcom, your code works perfectly... Now i have to edit the dialogue, add sounds, etc... But when i quit the dialog the NPC stand there i have tried to add : DestroyObject(GetObjectByTag("ly_holo")); to the script #1 field but it does not work. Another problem is that the npc does not spawn in front of the character and is show from behind... It may come from the orientation of the npc when he spawns. How can i modify that ? Link to comment Share on other sites More sharing options...
stoffe Posted May 1, 2005 Share Posted May 1, 2005 Originally posted by lord_yig But when i quit the dialog the NPC stand there i have tried to add : DestroyObject(GetObjectByTag("ly_holo")); to the script #1 field but it does not work. Did you write that directly into the script field in the dialog editor, or did you put it into a script file that you put the name of in the script field in the dialog editor? The field only accepts the resref of a compiled script, not script code. Originally posted by lord_yig Another problem is that the npc does not spawn in front of the character and is show from behind... It may come from the orientation of the npc when he spawns. How can i modify that ? Try this modified variant, this should spawn the creature about a meter in front of the player, facing them: void main() { object oHolo = GetObjectByTag("ly_holo"); if (GetIsObjectValid(oHolo)) return; float fRot = GetFacing(OBJECT_SELF); location lLoc = Location(GetPosition(OBJECT_SELF) + AngleToVector(fRot), (fRot - 180.0)); oHolo = CreateObject(OBJECT_TYPE_CREATURE, "ly_holo", lLoc); if (GetIsObjectValid(oHolo)) DelayCommand(0.2, AssignCommand(oHolo, ActionStartConversation( OBJECT_SELF, "ly_holo_dlg"))); } Link to comment Share on other sites More sharing options...
lord_yig Posted May 1, 2005 Author Share Posted May 1, 2005 Originally posted by stoffe -mkb- Try this variant, this should spawn the creature about a meter in front of the player, facing them: Thanks for your help Stoffe your variant works But the NPC still is seen from the back in the dialogue... I get the view from above one of the NPC's shoulder, looking at the player... I have tried to edit the camera angle in the dialogue file but it does not do anything at all... But at least i have manage to destroy the hologram at the end of the dialogue by running a script from the correct field in the general properties of the dialogue file, here is the code, if i have made any mistake tell me, it works but i don't know if this is the correct or the best method to do it : void main() { object oHolocron = GetObjectByTag("ly_holo_npc_01"); if (GetIsObjectValid(oHolocron)) { DestroyObject(oHolocron); SendMessageToPC(GetPartyLeader(),"HOLOCRON - DestroyHolocron : Hologram Destroyed" ); } else { SendMessageToPC(GetPartyLeader(),"HOLOCRON - DestroyHolocron : Hologram Does Not Exists" ); } } Link to comment Share on other sites More sharing options...
Xcom Posted May 1, 2005 Share Posted May 1, 2005 Originally posted by lord_yig But at least i have manage to destroy the hologram at the end of the dialogue by running a script from the correct field in the general properties of the dialogue file, here is the code, if i have made any mistake tell me, it works but i don't know if this is the correct or the best method to do it : Yes, it looks okay. The thing is that you need several scripts for your dialogue. You will be giving out powers to the characters. That also requires scripting. So, I would suggest that you make ONE script that handles all dialog tasks depending on passed parameter. for example //:: ly_holo.nss void main() { int nAction = GetScriptParameter(1); int nPower = GetScriptParameter(2); switch(nAction) { // GRANT SPELL // case 1: { object oTarget = GetPCSpeaker(); if (!GetSpellAcquired(nPower,oTarget)) { GrantSpell(nPower,oTarget); } } break; // EXIT CONVERSATION AND DESTROY HOLOGRAM THEREAFTER// case 2: { DelayCommand(0.2, DestroyObject(OBJECT_SELF)); } break; default: break; } } Now, when you want to give certain power to the user of the holocron, you enter the name of the scipt in "Script #1" field. Enter 1 in "P1" field. Enter spell index in the P2 field. The spell indicies (codes) can be found in spells.2da. When you exiting the conversation, use this script again. Only enter 2 in P1 field this time. Only apply this to the last entry that has "End Dialog" flag because destroying object while it's in the conversation isn't very good idea. Link to comment Share on other sites More sharing options...
stoffe Posted May 1, 2005 Share Posted May 1, 2005 Originally posted by lord_yig But the NPC still is seen from the back in the dialogue... I get the view from above one of the NPC's shoulder, looking at the player... I have tried to edit the camera angle in the dialogue file but it does not do anything at all... That's strange, they should spawn facing you. I just tested the script in my game, and the test creature spawns facing me no matter how I turn my character. Are you running this in an enclosed space where the desired spawn location may be impassable, so the game adjusts the spawn location automatically to what it conciders the closest valid spot? Don't know what to suggest since it works here.... If you can't get it to work for whatever reason, you could always fall back to ugly workarounds. Try adding this just after the creature has spawned: AssignCommand(oHolo, SetFacingPoint(GetPosition(GetFirstPC()))); Link to comment Share on other sites More sharing options...
Xcom Posted May 1, 2005 Share Posted May 1, 2005 Originally posted by stoffe -mkb- That's strange, they should spawn facing you. I just tested the script in my game, and the test creature spawns facing me no matter how I turn my character. I might have an idea about why this is happening. lord_yig, whom exactly did you use to test your holocron? Was it a party member like Atton or was it your main player? If it was a party member, then it would make sense. Link to comment Share on other sites More sharing options...
lord_yig Posted May 1, 2005 Author Share Posted May 1, 2005 Originally posted by Xcom Was it a party member like Atton or was it your main player? If it was a party member, then it would make sense. [/b] It was with the main character, i have only tested with a new game in Peragus, adding the holocron in the inventory with some savegame editing. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.