Gavroche Posted May 9, 2008 Share Posted May 9, 2008 Yep there, I'm having difficulties with a small script of mine. This script should give your PC a different item with each NPC he's talking to, meaning if I'm talking to Bao-Dur I'll get a hydrospanner, if I'm talking to Mical I'll get medpacs, if I'm talking to Hanharr I'll get wookiee pr0n magazines, etc... Moreover, the items you get are different following your alignment. I tried to mirror a_makejedi's functioning as it seemed to be closer than any script to what I wanted to do. So here is what I wrote: #include "k_inc_debug" #include "k_inc_utility" void main() { if(IsDark()) { switch(GetScriptParameter( 1 )) { case 0: CreateItemOnObject("attons_ds_item", GetFirstPC(), 1); break; case 1: CreateItemOnObject("baos_ds_item", GetFirstPC(), 1); break; case 6: CreateItemOnObject("kreias_ds_item", GetFirstPC(), 1); break; case 9: CreateItemOnObject("visas_ds_item", GetFirstPC(), 1); break; case 11: CreateItemOnObject("micals_ds_item", GetFirstPC(), 1); break; } } else { switch(GetScriptParameter( 1 )) { case 0: CreateItemOnObject("attons_ls_item", GetFirstPC(), 1); break; case 1: CreateItemOnObject("baos_ls_item", GetFirstPC(), 1); break; case 6: CreateItemOnObject("kreias_ls_item", GetFirstPC(), 1); break; case 9: CreateItemOnObject("visas_ls_item", GetFirstPC(), 1); break; case 11: CreateItemOnObject("micals_ls_item", GetFirstPC(), 1); break; } } } Just replaced the ifs with a switch. Also, the scripter made a variable to save GetScriptParameter (called nScriptNumber IIRC) while I just inserted the function in the condition. I put this script into one line in each NPC's .dlg file and talk to them to see if I get what I want... Well, in fact it turns out that it doesn't work : I always get Atton's items whichever NPC I'm talking to. The Light Side/Dark Side check works well, but GetScriptParameter seems to always return 0. So how does it work in a_makejedi? Why can't I make it work? Thanks in advance for your wise support Link to comment Share on other sites More sharing options...
glovemaster Posted May 10, 2008 Share Posted May 10, 2008 I wrote a few notes on Script Parameters in TSL a while back: http://www.lucasforums.com/showthread.php?t=187983 If you want to flick through there and make sure you are using them correctly, because your script is fine. If you want a script that checks the NPC you are talking to then rather than setting it in the dialog nodes you could use: #include "k_inc_debug" #include "k_inc_utility" void main() { if(IsDark()) { string oConverse = GetTag(GetLastSpeaker()); if(oConverse == "Atton") CreateItemOnObject("attons_ds_item", GetFirstPC(), 1); if(oConverse == "BaoDur") CreateItemOnObject("baos_ds_item", GetFirstPC(), 1); if(oConverse == "Kreia") CreateItemOnObject("kreias_ds_item", GetFirstPC(), 1); if(oConverse == "Visas") CreateItemOnObject("visas_ds_item", GetFirstPC(), 1); if(oConverse == "Disciple") CreateItemOnObject("micals_ds_item", GetFirstPC(), 1); } else { string oConverse = GetTag(GetLastSpeaker()); if(oConverse == "Atton") CreateItemOnObject("attons_dls_item", GetFirstPC(), 1); if(oConverse == "BaoDur") CreateItemOnObject("baos_ls_item", GetFirstPC(), 1); if(oConverse == "Kreia") CreateItemOnObject("kreias_ls_item", GetFirstPC(), 1); if(oConverse == "Visas") CreateItemOnObject("visas_ls_item", GetFirstPC(), 1); if(oConverse == "Disciple") CreateItemOnObject("micals_ls_item", GetFirstPC(), 1); } } Link to comment Share on other sites More sharing options...
Gavroche Posted May 10, 2008 Author Share Posted May 10, 2008 Oh, alright! I just completly missed GetScriptParameter's purpose. Thought it returned directly the NPC's number ^^ Thanks glovemaster, and thanks one more time for the GetLastSpeaker function , I think I'm going to use this one. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.