JediMaster76 Posted June 18, 2008 Share Posted June 18, 2008 Alright, I'm ashamed at myself for even asking this question Anyway, I looked at "Frequently used script functions" copied/pasted the TakeGoldFromCreature script, and pasted it as so... void main() { TakeGoldFromCreature( GetFirstPC(),1000); } But it gives me this compilation error... ERROR: Type mismatch in parameter 1 call to "TakeGoldFromCreature". Any ideas on how I can fix this? I feel like a massive n00b, cuz I can't figure out the problem, I must be staring right at it, lol. Link to comment Share on other sites More sharing options...
ForeverNight Posted June 18, 2008 Share Posted June 18, 2008 I'm not great shakes at scripting, however, I think you have to move the first parenthesis so that it is 'connected' to TakeGoldFromCreature... I think, I wish Stoffe or somebody who actually understood this was here! Link to comment Share on other sites More sharing options...
Da_Man_2423 Posted June 18, 2008 Share Posted June 18, 2008 I searched "TakeGoldFromCreature" in KotOR Tool and this script came up... void main() { int nCredits = GetScriptParameter( 1 ); TakeGoldFromCreature ( nCredits, GetFirstPC () ); } It looks related enough to the script you tried, so I'm guessing you can use this script above. Link to comment Share on other sites More sharing options...
JediMaster76 Posted June 18, 2008 Author Share Posted June 18, 2008 It doesn't look like it, but it is the "d" and the ")" are touching. I tried it without them touching, but it returns the same error. *Edit* I tried the script you entered, Da_Man, but it returned this error... Undeclared Identifier: GetScriptParameter. Link to comment Share on other sites More sharing options...
ForeverNight Posted June 18, 2008 Share Posted June 18, 2008 @Da_Man: K1 doesn't use script parameters, that's TSL only. Hmm..... I think I have no clue as to what is going on......... Oh! Try removing the space between the "," and the 1000... I think that's what's wrong. Stoffe, where the heck are you? Link to comment Share on other sites More sharing options...
JediMaster76 Posted June 19, 2008 Author Share Posted June 19, 2008 Again, there is no space in the coding, it just appears that way. And again, I removed the space and tried it that way, and I received the same error. Link to comment Share on other sites More sharing options...
ForeverNight Posted June 19, 2008 Share Posted June 19, 2008 Shoot! I'm at the fraying end of my scripting knowledge... Just looked in KotOR Tool, and I can suggest the gold amount than the GetFirstPC().... I don't know if that helps, but it's all I can do. Otherwise, sit tight and hope that people who actually understand scripting will start helping! Link to comment Share on other sites More sharing options...
EnderWiggin Posted June 19, 2008 Share Posted June 19, 2008 Are you sure you're in K1 mode when you compile the script? I'm pretty sure only TSL deals with parameters. _EW_ Link to comment Share on other sites More sharing options...
ForeverNight Posted June 19, 2008 Share Posted June 19, 2008 ^^^^ Never thought to check the K1 compiling! -Do it! And, yes only TSL supports scripting parameters... Link to comment Share on other sites More sharing options...
JediMaster76 Posted June 19, 2008 Author Share Posted June 19, 2008 I know. I'm using K1 (i don't have K2 on my PC atm) and I am compiling it as a K1 script. Link to comment Share on other sites More sharing options...
ForeverNight Posted June 19, 2008 Share Posted June 19, 2008 Hmmm.... I can't help you here, sorry. Just hang tight, and hope that people that understand scripting will get over here. Sorry! Link to comment Share on other sites More sharing options...
Da_Man_2423 Posted June 19, 2008 Share Posted June 19, 2008 void main() { TakeGoldFromCreature(200, GetPCSpeaker(), TRUE); } Direct from a K1 script. I don't know how much different GetPCSpeaker is from GetFirstPC but this is the script that's used to take 200 credits from you when you land on Tatooine. Link to comment Share on other sites More sharing options...
EnderWiggin Posted June 19, 2008 Share Posted June 19, 2008 Try this one. It seems to work for others. void main() { TakeGoldFromCreature(GetFirstPC(), 1000); } _EW_ EDIT:: @Da_man: That returns true, it can't be right. This isn't a conditional. Link to comment Share on other sites More sharing options...
ForeverNight Posted June 19, 2008 Share Posted June 19, 2008 I was just gonna post that! But, just make it GetFirstPC() instead of GetPCSpeaker and that should do it! @EW: What it does is destroy the credits instead of putting them in the takers inventory. It's not a conditional. Link to comment Share on other sites More sharing options...
Ferc Kast Posted June 19, 2008 Share Posted June 19, 2008 You had the script reversed; I just used KotOR Tool & corrected the script: void main() { TakeGoldFromCreature(1000, GetFirstPC()); } It looks for the amount of credits to take, then it looks for who to take it from. It was only a minor error; I'm sure we all make them from time to time. Link to comment Share on other sites More sharing options...
JediMaster76 Posted June 19, 2008 Author Share Posted June 19, 2008 Well, Da_Man's script compiles successfully, but EnderWiggin's doesn't. Hmm. And I can't use Da_Man's script b/c its a conditional, correct? *Edit - Thanks Kast, works perfectly Thanks for the help, everybody! Link to comment Share on other sites More sharing options...
EnderWiggin Posted June 19, 2008 Share Posted June 19, 2008 I'm almost positive it will not work correctly. Because it returns true. That's weird. Mine was wrong; use Ferc's and you'll be fine. _EW_ Link to comment Share on other sites More sharing options...
Da_Man_2423 Posted June 19, 2008 Share Posted June 19, 2008 That was the exact script I was about to post... Yeah, had just tested mine without the true conditional and it works, so yeah. Scripting is a swing and miss thing with me. Link to comment Share on other sites More sharing options...
deathdisco Posted June 19, 2008 Share Posted June 19, 2008 I'm almost positive it will not work correctly. Because it returns true. That's weird. Mine was wrong; use Ferc's and you'll be fine. _EW_ ForeverNight is correct, it's not a conditional and TRUE/FALSE is used in other scripts that are not conditionals. It's just an extra parameter for that script command. From nwscript.nss: // 444: Take nAmount of gold from oCreatureToTakeFrom. // - nAmount // - oCreatureToTakeFrom: If this is not a valid creature, nothing will happen. // - [b]bDestroy: If this is TRUE, the caller will not get the gold. Instead, the[/b] // [b]gold will be destroyed and will vanish from the game[/b]. void TakeGoldFromCreature(int nAmount, object oCreatureToTakeFrom, int bDestroy=FALSE); Link to comment Share on other sites More sharing options...
Darth InSidious Posted June 19, 2008 Share Posted June 19, 2008 I'd recommend a script that looks more like this, myself: void main() { object oPC = GetFirstPC(); TakeGoldFromCreature(1000, oPC); } AFAIK, you get odd errors if you try to nest script functions directly... Link to comment Share on other sites More sharing options...
stoffe Posted June 19, 2008 Share Posted June 19, 2008 Anyway, I looked at "Frequently used script functions" copied/pasted the TakeGoldFromCreature script, and pasted it as so... TakeGoldFromCreature( GetFirstPC(),1000); Hmm, seems to be an error in that post. The parameters should be the other way around. The amount of credits to take first, then the object to take the credits from (and an optional third parameter if you want the credits to be destroyed rather than moved to the inventory of the object running the script). I've fixed the post in the tutorial thread. Odd that nobody has noticed that before. So you'd get: void main() { TakeGoldFromCreature(1000, GetFirstPC()); } If you aren't already you probably want to check that the player actually has 1000 gold first as well. You can use the GetGold() function to do that. If this is done via a dialog you can use a conditional script like: int StartingConditional() { return (GetGold(GetFirstPC()) >= 1000); } Link to comment Share on other sites More sharing options...
HdVaderII Posted June 19, 2008 Share Posted June 19, 2008 I ran into this problem a while ago. I worked it out myself, but that's weird that nobody has even mentioned it before. Sometimes it's good when you have to figure how to fix things yourself, though. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.