According to the Lexicon TakeGoldFromCreature and TakeGold both fail if run from an area or module event - This function will fail if called from an area or module event (like an area's OnEnter). However, it works on triggers, so you can just paint a trigger around the arrival area to get the same effect.
You can correctly execute these functions from area and module events - I have only tested the OnClientEnter and OnAreaEnter events, using ExecuteScript like so:
//Place this in the OnClientEnter or OnAreaEnter event
void main()
{
object oTarget = GetEnteringObject();
ExecuteScript("takegold", oTarget);
}
You must also create a script (in this case named "Takegold") to house the function you are using...
//Takegold.nss
void main()
{
//Take all gold and destroy it.
TakeGoldFromCreature(GetGold(OBJECT_SELF), OBJECT_SELF, TRUE);
}
RE: OnClientEnter TakeGoldFromCreature (TakeGold)
Débuté par
Pstemarie
, juil. 17 2011 07:11
#1
Posté 17 juillet 2011 - 07:11
#2
Posté 17 juillet 2011 - 08:16
TakeGoldFromCreature works directly in OnClientEnter.. 
Lexicon is known to have numerous mistakes in it. (or otherwise outdated information)
Lexicon is known to have numerous mistakes in it. (or otherwise outdated information)
Modifié par Xardex, 17 juillet 2011 - 08:20 .
#3
Posté 18 juillet 2011 - 11:07
Tested it yesterday at length. Just checked again in an empty test script with only those two functions. Neither one works - so if you've got soemthing that does I'd love to see the block of code. 
I know the Lexicon has errors or outdated info, but the updated version not so so much.
I know the Lexicon has errors or outdated info, but the updated version not so so much.
Modifié par Pstemarie, 18 juillet 2011 - 11:09 .
#4
Posté 18 juillet 2011 - 02:35
You have to assign an object to take the gold in order to make it work. I'm not sure why, it's just one of those oddities with nwscript.
int nGold = GetGold(oTarget);
AssignCommand (oTarget, TakeGoldFromCreature(nGold, oTarget, TRUE));
Oddly enough, you have have the character take the gold from themselves, and it'll still work as long as you're destroying it.
edit: switched it to oTarget since that's what you used.
int nGold = GetGold(oTarget);
AssignCommand (oTarget, TakeGoldFromCreature(nGold, oTarget, TRUE));
Oddly enough, you have have the character take the gold from themselves, and it'll still work as long as you're destroying it.
edit: switched it to oTarget since that's what you used.
Modifié par Failed.Bard, 18 juillet 2011 - 02:36 .
#5
Posté 18 juillet 2011 - 04:05
Ty - hadn't thought of that route.
EDIT - that method does indeed work, but because of timing issues I wound up removing the gold and equipment stripping function to its own script anyway.
EDIT - that method does indeed work, but because of timing issues I wound up removing the gold and equipment stripping function to its own script anyway.
Modifié par Pstemarie, 18 juillet 2011 - 04:43 .





Retour en haut







