It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
I'm trying to write a script that will make a character the player talks to run to another character. My code, though, throws a Declaration does not match parameters compile error each time. Any help would be greatly appreciated.

void main()
{
// Give the speaker some XP
RewardPartyXP(50, GetPCSpeaker());

// Set the variables
SetLocalInt(OBJECT_SELF, "nFirstTimeTalked", 1);

//Run to Falstadd
object oMiner = GetObjectByTag("ct_Miner", 1);
AssignCommand(oMiner, ActionMoveToObject("ct_Falstadd", TRUE, 1)); (error occurs here)
}
Post edited February 25, 2014 by Untraceable93
This question / problem has been solved by Hickoryimage
avatar
Untraceable93: I'm trying to write a script that will make a character the player talks to run to another character. My code, though, throws a Declaration does not match parameters compile error each time. Any help would be greatly appreciated.

void main()
{
// Give the speaker some XP
RewardPartyXP(50, GetPCSpeaker());

// Set the variables
SetLocalInt(OBJECT_SELF, "nFirstTimeTalked", 1);

//Run to Falstadd
object oMiner = GetObjectByTag("ct_Miner", 1);
AssignCommand(oMiner, ActionMoveToObject("ct_Falstadd", TRUE, 1)); (error occurs here)
}
I don't know scripting, but wouldn't that last parameter be ("ct_Miner", TRUE, 1) instead of ("ct_Falstadd", TRUE, 1)?

*edit* Hmm, no I think I'm wrong there. Carry on.
Post edited February 25, 2014 by Coelocanth
From my understanding, that's the reference to the object they're supposed to move to, though I'll try that just in case.
avatar
Untraceable93: I'm trying to write a script that will make a character the player talks to run to another character. My code, though, throws a Declaration does not match parameters compile error each time. Any help would be greatly appreciated.

void main()
{
// Give the speaker some XP
RewardPartyXP(50, GetPCSpeaker());

// Set the variables
SetLocalInt(OBJECT_SELF, "nFirstTimeTalked", 1);

//Run to Falstadd
object oMiner = GetObjectByTag("ct_Miner", 1);
AssignCommand(oMiner, ActionMoveToObject("ct_Falstadd", TRUE, 1)); (error occurs here)
}
It occurs to me that you have defined oMiner but not 'Falstadd'. Have you tried doing something like:

//Run to Falstadd
object oMiner = GetObjectByTag("ct_Miner", 1);
object oTarget = GetObjectByTag("ct_Falstadd");
AssignCommand(oMiner, ActionMoveToObject(oTarget, TRUE, 1));
}
Post edited February 26, 2014 by Hickory
Ah, that would probably help with getting rid of any variable errors, but I'm still getting the "Declaration does not match Parameters" error somewhere on the assign command line.
avatar
Untraceable93: Ah, that would probably help with getting rid of any variable errors, but I'm still getting the "Declaration does not match Parameters" error somewhere on the assign command line.
Hmm. Looking at this script is it possible that you should be using:

//Run to Falstadd
object oMiner;
object oTarget;
oMiner = GetNearestObjectByTag("ct_Miner", 1);
oTarget = GetNearestObjectByTag("ct_Falstadd");
AssignCommand(oMiner, ActionMoveToObject(oTarget, TRUE, 1));
}

I know it shouldn't really matter, but computer logic can sometimes be very quirky. It's a thought. Otherwise, I can't see anything wrong according to the wiki syntax.
Nope. Still get the parameter error on that last line. I have the correct ammount of parameters for both assigncommand and actionmovetoobject, though, so I'm not sure where or why it's tripping up.
avatar
Untraceable93: Nope. Still get the parameter error on that last line. I have the correct ammount of parameters for both assigncommand and actionmovetoobject, though, so I'm not sure where or why it's tripping up.
The only other thing I can think of is that fRange is supposed to be a floating point number. So perhaps try:

AssignCommand(oMiner, ActionMoveToObject(oTarget, TRUE, 1.0));

Or even try it without the run and fRange parameters, just to see if that is where the problem lies:

AssignCommand(oMiner, ActionMoveToObject(oTarget));
Changing it to a 1.0 worked! Thanks so much
avatar
Untraceable93: Changing it to a 1.0 worked! Thanks so much
There's that 'quirky' I mentioned earlier. :D