Well I'll start off by saying that I hate to make multiple topics in any forum, but I am having a lot of trouble with a script I've been trying to put together. Now I suck at scripting, so I've mostly been drifting around the interwebs in search of multiple scripts to compile together into what I want. Normally I'm able to do this successfully, but it seems I've actually come to the end of the line of my own adequacy.
I am trying to create a placeable (in this case a shaft of light) where once approached (10-20 feet or so), said placeable spawns an encounter I've premade and the placeable disappears/is destroyed. In addition, I am trying to make it so this placeable/encounter will respawn every four minutes or so. Is this at all possible?
PS. More of a want than a need, but it can't hurt to ask: is it possible for a script to destroy a placeable (preferably with an animation) triggered by the emptying of a container/chest? Then this placeable and this chest respawns every twenty minutes or so?
I know I'm asking for a lot, but I would immensley appreciate it and even add credits to the finished module if desired. These two scripts (more importantly the first) are essential to the gameplay element of the module. Pretty much every encounter will be made through the placeable-destruction script, if such script is possible.
Script Assistance
Débuté par
Junnest
, sept. 27 2011 07:14
#1
Posté 27 septembre 2011 - 07:14
#2
Posté 27 septembre 2011 - 08:02
You should be able to do what you're hoping for quite easily. Set the encounter you've painted down to respawn every 4 minutes, and then make a script for the encounter triggers OnEnter something like this:
void DelayedCreateObject (string sResRef, location lTarget);
void main()
{
object oPC = GetEnteringObject();
// stops NPCs from triggering the encounter.
if (!GetIsPC (oPC)) return;
// Will only run the rest of the script to spawn the encounter if the
// lightshaft is present.
object oTarget = GetObjectByTag("LIGHT_SHAFT_TAG_HERE");
if (!GetIsObjectValid (oTarget)) return;
// Grab the resref and location before destroying
string sResRef = GetResRef (oTarget);
location lTarget = GetLocation (oTarget);
DestroyObject (oTarget);
DelayCommand (240.0, DelayedCreateObject (sResRef, lTarget) );
}
void DelayedCreateObject (string sResRef, location lTarget)
{
// You can't delay creation normally, so you make a seperate function
// to create the object and delay that instead.
CreateObject (OBJECT_TYPE_PLACEABLE, sResRef, lTarget, FALSE, "LIGHT_SHAFT_TAG_HERE");
}
Just make sure that the lightshaft has a unique tag, or else it might check/destroy the wrong one. I just wrote that quickly, and test compiled it rather than testing. If it doesn't work quite right, or you have questions, don't hesitate to ask.
Edit: Fixed the lines I'd messed up.
void DelayedCreateObject (string sResRef, location lTarget);
void main()
{
object oPC = GetEnteringObject();
// stops NPCs from triggering the encounter.
if (!GetIsPC (oPC)) return;
// Will only run the rest of the script to spawn the encounter if the
// lightshaft is present.
object oTarget = GetObjectByTag("LIGHT_SHAFT_TAG_HERE");
if (!GetIsObjectValid (oTarget)) return;
// Grab the resref and location before destroying
string sResRef = GetResRef (oTarget);
location lTarget = GetLocation (oTarget);
DestroyObject (oTarget);
DelayCommand (240.0, DelayedCreateObject (sResRef, lTarget) );
}
void DelayedCreateObject (string sResRef, location lTarget)
{
// You can't delay creation normally, so you make a seperate function
// to create the object and delay that instead.
CreateObject (OBJECT_TYPE_PLACEABLE, sResRef, lTarget, FALSE, "LIGHT_SHAFT_TAG_HERE");
}
Just make sure that the lightshaft has a unique tag, or else it might check/destroy the wrong one. I just wrote that quickly, and test compiled it rather than testing. If it doesn't work quite right, or you have questions, don't hesitate to ask.
Edit: Fixed the lines I'd messed up.
Modifié par Failed.Bard, 27 septembre 2011 - 11:33 .
#3
Posté 27 septembre 2011 - 10:07
I really really appreciate all the help, man. I have come across what seems to be just a small error, that I could have probably solved myself if it weren't for my scripting incompetence.
I placed the placeable tagged "spawn1" in the center of the encounter trigger, which is set to 240 seconds to respawn. The trigger has the OnEnter script you posted for me, but it didn't compile. It gave me the message "ERROR: DECLARATION DOES NOT MATCH PARAMETERS" for line 17. In both places where you specified to insert the light shaft tag, I entered "spawn1". Maybe you know what this means?
I placed the placeable tagged "spawn1" in the center of the encounter trigger, which is set to 240 seconds to respawn. The trigger has the OnEnter script you posted for me, but it didn't compile. It gave me the message "ERROR: DECLARATION DOES NOT MATCH PARAMETERS" for line 17. In both places where you specified to insert the light shaft tag, I entered "spawn1". Maybe you know what this means?
#4
Posté 27 septembre 2011 - 11:17
Oops, my mistake there. I changed a line in my post without confirming it in the toolset. Really sorry about that, I added extra variables to the wrong command. Fixed the lines in the original posting of the script.
Modifié par Failed.Bard, 27 septembre 2011 - 11:31 .
#5
Posté 27 septembre 2011 - 11:51
No need to be sorry at all, you're saving me from tons of frustration messing with scripts that I know next to nothing about. As of right now, the script works almost perfectly. The only bug I'm having now is that the shaft of light isn't respawning, but the encounter trigger is.
#6
Posté 27 septembre 2011 - 01:59
Alright, I figured out why the creation part wasn't working. I'd thought encounters just "turned off", so to speak, but it looks as though they're deleted then recreated later when they're "active" again. Since the encounter isn't there any longer, the delayed part can't run.
It should work, as is, if you place a seperate generic trigger down in the same place and put the script in the on enter of that instead.
I'd also noticed it doesn't seem to want to destroy a static placeable, so you might need to make sure you're using a light that's set that way in the palette, and not just adjusted on the map, or it might not work properly on the second time.
It should work, as is, if you place a seperate generic trigger down in the same place and put the script in the on enter of that instead.
I'd also noticed it doesn't seem to want to destroy a static placeable, so you might need to make sure you're using a light that's set that way in the palette, and not just adjusted on the map, or it might not work properly on the second time.
#7
Posté 27 septembre 2011 - 02:30
I did the generic trigger idea and it works absolutely perfectly. Thank you so much for this. A module ain't a module without the combat and, in this case, the fancy encounter animations. =P
#8
Posté 03 octobre 2011 - 11:33
Now I've been trying to get this one script to work for forever, now, and quite frankly I think I'm going crazy. I am trying to have an item with "use unique power" that practically mounts you up instantly (that means no horse sattlebag storage or anything). To do this I used the proper resref (blackhorse) and used the OnActivateItem script of the module to try summoning this creature and then mounting it all in one motion, one after the other.
Once mounted I wanted it to be exactly the same as any other mounted horse, only once you dismount, the horse is immediately dismissed. If possible I was trying to get the visual of the player using the item, suddenly appearing mounted on the horse, and then appearing the same as when they started upon dismounting.
I've accomplished summoning the horse and that's it. I can mount it, but only manually, whereas I wanted the script to automatically mount me on the horse. So far I've gone so nuts that I pretty much erased all my progress out of confusion and aggitation.
Note: You could compare this whole thing to World of Warcraft's mount system, if you will.
Once I have the script down, I planned on making individual horse summons/mounts scripts, within the same script, tied to the tag of the item with the "use unique power" ability. I think I can figure that out, as long as I manage to finish script itself. Can anyone help me?
Once mounted I wanted it to be exactly the same as any other mounted horse, only once you dismount, the horse is immediately dismissed. If possible I was trying to get the visual of the player using the item, suddenly appearing mounted on the horse, and then appearing the same as when they started upon dismounting.
I've accomplished summoning the horse and that's it. I can mount it, but only manually, whereas I wanted the script to automatically mount me on the horse. So far I've gone so nuts that I pretty much erased all my progress out of confusion and aggitation.
Note: You could compare this whole thing to World of Warcraft's mount system, if you will.
Once I have the script down, I planned on making individual horse summons/mounts scripts, within the same script, tied to the tag of the item with the "use unique power" ability. I think I can figure that out, as long as I manage to finish script itself. Can anyone help me?
Modifié par Junnest, 03 octobre 2011 - 11:36 .
#9
Posté 03 octobre 2011 - 03:44
You mount the horse by casting the mount horse spell on it, if I remember right. I had similar issues when I made the "Summon Mount" spell for my little mod. I can post the code I used for the creation and mounting when I get home again tomorrow if nobody else has helped you with it before then.
As for unsummoning it as soon as the horse is dismounted, I'm not sure how to do that part. That was the aspect of my spell I never got working properly, since once the horse is mounted the original variables and duration you might have put onto it when you created it are lost.
If it's possible to make it off of a unique resref horse, I suppose you could put something into its on HB script, but that will only work if it creates the same resref version horse when you dismount, and not the standard version of it. I'll do a bit of testing on that tomorrow as well.
It might be best to handle it in the dismount spell. That way you can do your checks as soon as the PC dismounts to see if the horse should be "unsummoned". I'll test out how much work it is to change that as well. It might be a fair bit, since I think the code that handles that is in an include.
As for unsummoning it as soon as the horse is dismounted, I'm not sure how to do that part. That was the aspect of my spell I never got working properly, since once the horse is mounted the original variables and duration you might have put onto it when you created it are lost.
If it's possible to make it off of a unique resref horse, I suppose you could put something into its on HB script, but that will only work if it creates the same resref version horse when you dismount, and not the standard version of it. I'll do a bit of testing on that tomorrow as well.
It might be best to handle it in the dismount spell. That way you can do your checks as soon as the PC dismounts to see if the horse should be "unsummoned". I'll test out how much work it is to change that as well. It might be a fair bit, since I think the code that handles that is in an include.
Modifié par Failed.Bard, 03 octobre 2011 - 03:45 .
#10
Posté 04 octobre 2011 - 05:53
I attempted using an erf I downloaded off of nwvault as an alternate mounting option, and while it wasn't what I wanted, it made it so that once you mounted an item would appear in your inventory that could be used to dismount. Maybe that could work, considering how you say the variables are lost from the mounted creature? The item could maybe have a tag that is listed in the OnActivateItem script where the script can call for onuse-dismount/dismiss?
I would appreciate it sooo much if you could help me get this thing to work. I've been hung up on it for what I thought would be hours, what has turned into days. Out of all the scripting elements I have to implement before progressing with this module, this is the last (next to the death system, which I already have figured out).
I would appreciate it sooo much if you could help me get this thing to work. I've been hung up on it for what I thought would be hours, what has turned into days. Out of all the scripting elements I have to implement before progressing with this module, this is the last (next to the death system, which I already have figured out).
#11
Posté 04 octobre 2011 - 11:56
There's actually no reason why the same item can't be used to both summon/mount, and dismount/unsummon. I'll be back home in three hours or so now, so I'll see about turning my summon mount spell into an item that does both then.
The only tricky thing will be checking for the horse if they dismounted using the standard horse radial and then removed it from the party, but I should be able to find the naming convention used for tagging the horses to take care of that.
The only tricky thing will be checking for the horse if they dismounted using the standard horse radial and then removed it from the party, but I should be able to find the naming convention used for tagging the horses to take care of that.
#12
Posté 04 octobre 2011 - 05:05
Yeah, I was thinking about that at the point when I was so desperate - I was just going to leave a sign at the start of the module or a note in the journal that says to use the dismount item instead of radial menu option (a kinda pathetic way out). But that would be amazing if the script could call for the same dismount/dismiss/unsummon by both the radial menu and unique item use. I'm also assuming that with this script I can set the resref/tag of other mount models included in CEP 2.4, which would expand a lot of the ideas I was originally forced to disregard due to this scripting issue (but I won't get my hopes up yet just in case the script and the models aren't compatible for some reason or other).
I appreciate all the effort you're putting into this, I really do. Can't stress that enough.
I appreciate all the effort you're putting into this, I really do. Can't stress that enough.
#13
Posté 04 octobre 2011 - 06:06
Okay, this should work with any single resref mount. I don't have cep 2.4 installed, so it was tested with a horse, but it should work for the alternate mounts in other packages as well.
First, the item script:
#include "x2_inc_switches"
void main()
{
if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
object oTarget = GetItemActivator();
location lTarget = GetLocation (oTarget);
if (!GetLocalInt (oTarget, "MOUNTED"))
{
SetLocalInt (oTarget, "MOUNTED", TRUE);
object oSteed = CreateObject (OBJECT_TYPE_CREATURE, "put_resref_here", lTarget);
// Assigns the mount to oTarget. The delay is just to ensure the Steed is created fully first.
DelayCommand (0.3, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_ASSIGN_MOUNT, oSteed, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
DelayCommand (0.4, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_ASSIGN_MOUNT, oTarget, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
DelayCommand (0.5, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_MOUNT, oSteed, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
}
else
{
DeleteLocalInt (oTarget, "MOUNTED");
AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_DISMOUNT, oTarget, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
}
}
Then put this into the heartbeat event of the custom mount:
void main()
{
if (GetLocalInt (OBJECT_SELF, "UNMOUNTED"))
{
DeleteLocalInt (GetMaster (OBJECT_SELF), "MOUNTED");
DestroyObject (OBJECT_SELF);
}
else
{
SetLocalInt (OBJECT_SELF, "UNMOUNTED", TRUE);
}
}
It's nothing fancy, just destroys the mount on the second HB after the player dismounts. You could add a VFX to the "summoning" and "unsummoning" if you wanted, I just put the basic support in place.
First, the item script:
#include "x2_inc_switches"
void main()
{
if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
object oTarget = GetItemActivator();
location lTarget = GetLocation (oTarget);
if (!GetLocalInt (oTarget, "MOUNTED"))
{
SetLocalInt (oTarget, "MOUNTED", TRUE);
object oSteed = CreateObject (OBJECT_TYPE_CREATURE, "put_resref_here", lTarget);
// Assigns the mount to oTarget. The delay is just to ensure the Steed is created fully first.
DelayCommand (0.3, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_ASSIGN_MOUNT, oSteed, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
DelayCommand (0.4, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_ASSIGN_MOUNT, oTarget, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
DelayCommand (0.5, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_MOUNT, oSteed, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
}
else
{
DeleteLocalInt (oTarget, "MOUNTED");
AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_DISMOUNT, oTarget, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
}
}
Then put this into the heartbeat event of the custom mount:
void main()
{
if (GetLocalInt (OBJECT_SELF, "UNMOUNTED"))
{
DeleteLocalInt (GetMaster (OBJECT_SELF), "MOUNTED");
DestroyObject (OBJECT_SELF);
}
else
{
SetLocalInt (OBJECT_SELF, "UNMOUNTED", TRUE);
}
}
It's nothing fancy, just destroys the mount on the second HB after the player dismounts. You could add a VFX to the "summoning" and "unsummoning" if you wanted, I just put the basic support in place.
Modifié par Failed.Bard, 04 octobre 2011 - 06:07 .
#14
Posté 04 octobre 2011 - 06:52
Everything compiled successfully. I placed the appropriate resref and even tried a second one when the first didn't work for the OnActivateItem module event, placing that other script in the heartbeat event for either creatures, but when I use the item ingame nothing happens. I assumed the actual item that I was using had to have a certain tag or resref, assuming it was "MOUNTED" I gave that a try. Everything looks just fine script-wise, I think maybe I am missing a component.
Update: I decided to create a new module without CEP, put the scripts in the module and creature events with the appropriate resref, but had the same result. Just for the sake of it, I also gave the item the resref and tag of "MOUNTED", but I doubt that's even necessary.
Update: I decided to create a new module without CEP, put the scripts in the module and creature events with the appropriate resref, but had the same result. Just for the sake of it, I also gave the item the resref and tag of "MOUNTED", but I doubt that's even necessary.
Modifié par Junnest, 04 octobre 2011 - 06:53 .
#15
Posté 04 octobre 2011 - 07:31
Ah, I take it you're not entirely sure how to use tag based scripting then. You'll want the items tag to be the same as the script name. In that particular case, the tag name isn't case sensative, though it generally is.
If you tag the item "SUMMON_MOUNT", and save the script as "summon_mount", then that should be all you need to do with it to make it work, assuming that tag based scripting is turned on.
You can check that in the on module load event, there'll be a switch o use tag based scripting that might be commented out. Make sure that line is just like this (no // in front):
SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
If you tag the item "SUMMON_MOUNT", and save the script as "summon_mount", then that should be all you need to do with it to make it work, assuming that tag based scripting is turned on.
You can check that in the on module load event, there'll be a switch o use tag based scripting that might be commented out. Make sure that line is just like this (no // in front):
SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
#16
Posté 05 octobre 2011 - 12:13
I checked to see if the OnModuleLoad event had that switch in it, and it looks exactly like that. So I changed the tag of the item to the same name as the OnActivateItem event script name, but I'm having the same result (both in the CEP and non-CEP modules). I remade the items to include the script name as the resref as well as the tag, with no results. I don't doubt this is an issue on my end, though.
#17
Posté 05 octobre 2011 - 09:31
You want the OnActivateItem module event script to be default if you're using tag based scripts. You don't need to make a change to that at all.
When any item activates one of the Cast Spell: Unique Power abilities those scripts will attempt to execute a script with the same name as the items tag. If the OnActivateItem module script is changed, then it might not necessarily be setting the proper item event switch before the code executes, which would make the script exit when it gets to that check.
When any item activates one of the Cast Spell: Unique Power abilities those scripts will attempt to execute a script with the same name as the items tag. If the OnActivateItem module script is changed, then it might not necessarily be setting the proper item event switch before the code executes, which would make the script exit when it gets to that check.
#18
Posté 05 octobre 2011 - 10:45
Oh yeah, I know what you mean by tag-based scripting now. Or at least I used to know several years ago and now remember. As for the result of this script...
You, sir, are amazing. Thank you for going through all this trouble. It looks just as I would have liked, so it's next to perfect. One thing that is a little strange is that the horse stands around for about 5-10 seconds after the dismount before getting dismissed/destroyed. Is there any way to make that a little quicker if not instant? I doubt there is considering it seems that the delay is caused by the processing of the heartbeat script itself and not an actual scripted delay, I was just wondering is all.
Whether the horse sticks around for a few seconds before disappearing or not, this is exactly what I was looking for and it works great (even dismounts/dismisses automatically when entering a no-mount zone, nice!). A million thanks to you and your patience.
You, sir, are amazing. Thank you for going through all this trouble. It looks just as I would have liked, so it's next to perfect. One thing that is a little strange is that the horse stands around for about 5-10 seconds after the dismount before getting dismissed/destroyed. Is there any way to make that a little quicker if not instant? I doubt there is considering it seems that the delay is caused by the processing of the heartbeat script itself and not an actual scripted delay, I was just wondering is all.
Whether the horse sticks around for a few seconds before disappearing or not, this is exactly what I was looking for and it works great (even dismounts/dismisses automatically when entering a no-mount zone, nice!). A million thanks to you and your patience.
Modifié par Junnest, 05 octobre 2011 - 10:45 .
#19
Posté 05 octobre 2011 - 11:56
I had to put the delay in, to ensure that the horse wasn't destroyed in that 0.5 seconds between when it's created and the player mounts it. I'd considered just having it be a delayed DestroyObject to get around that, but it still would have likely meant a delay of 2-8 seconds before being destroyed on dismount, instead of the 6-12 seconds it is now.
One thing you could do, is add a 2 stage VFX to the dismissal. Something like the ghostly pulse when the variable is initially set, and then an unsummoning effect when it's destroyed. While it would still have the same delay, it would look a little more like it was meant to be that way then.
Edit: Try this in the mounts HB script.
void main()
{
if (GetLocalInt (OBJECT_SELF, "UNMOUNTED"))
{
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_FNF_SMOKE_PUFF), GetLocation (OBJECT_SELF));
DeleteLocalInt (GetMaster (OBJECT_SELF), "MOUNTED");
DestroyObject (OBJECT_SELF);
}
else
{
SetLocalInt (OBJECT_SELF, "UNMOUNTED", TRUE);
ApplyEffectToObject (DURATION_TYPE_PERMANENT, EffectVisualEffect (VFX_DUR_GHOSTLY_PULSE), OBJECT_SELF);
}
}
One thing you could do, is add a 2 stage VFX to the dismissal. Something like the ghostly pulse when the variable is initially set, and then an unsummoning effect when it's destroyed. While it would still have the same delay, it would look a little more like it was meant to be that way then.
Edit: Try this in the mounts HB script.
void main()
{
if (GetLocalInt (OBJECT_SELF, "UNMOUNTED"))
{
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_FNF_SMOKE_PUFF), GetLocation (OBJECT_SELF));
DeleteLocalInt (GetMaster (OBJECT_SELF), "MOUNTED");
DestroyObject (OBJECT_SELF);
}
else
{
SetLocalInt (OBJECT_SELF, "UNMOUNTED", TRUE);
ApplyEffectToObject (DURATION_TYPE_PERMANENT, EffectVisualEffect (VFX_DUR_GHOSTLY_PULSE), OBJECT_SELF);
}
}
Modifié par Failed.Bard, 05 octobre 2011 - 12:03 .
#20
Posté 05 octobre 2011 - 02:26
That looks fantastic. I can't thank you enough for how much you've helped me. I've finished implementing all the mounts into the game and they all work great. It will be a long while before this this releases and I just might open a beta period for those willing to help me with the bugs, but hopefully someday you'll be able to take a look at where your efforts are going if you so happen to be interested.
Until the next scripting issue arrives... farewell and thank you.
Until the next scripting issue arrives... farewell and thank you.
#21
Posté 19 octobre 2011 - 03:51
Back again with a new and much simpler issue (or so I think). I can't manage to forge the simple idea of a quest reward script that gives the PC (and the PC only) 5 gold and 20 experience for every item by the tag "NW_IT_MSMLMISC13" in the PC's inventory. All of those items are then destroyed. Otherwise the PC would have to start up a new conversation to turn in each individual item which is just a hassle for those with large quantities of said item.
The idea is that this item is proof of a kill and the NPC rewards the player per kill. Can anyone help me?
The idea is that this item is proof of a kill and the NPC rewards the player per kill. Can anyone help me?
#22
Posté 20 octobre 2011 - 01:17
There are actually two ways to do this. One would award the gold and XP for each item, and the other would do a count, and then award based on using that count as a multiplier.
Since I'm away from home for a few more days still this time, I'll try to find you a link to a script that'd work for you. I'd just write one, but I can't double check terminology here.
I'll just edit this post if I find an example.
Edit: Okay, try this one. Hopefully I got all the terms right.
void main()
{
object oPC = GetPCSpeaker();
int nCounter;
object oItem = GetFirstItemInInventory (oPC);
while (GetIsObjectValid (oItem) )
{
if (GetTag (oItem) == "NW_IT_MSMLMISC13")
{
DestroyObject (oItem);
nCounter ++;
}
oItem = GetNextItemInInventory(oPC);
}
if (nCounter > 0)
{
GiveXPToCreature (oPC, nCounter * 20);
GiveGoldToCreature (oPC, nCounter * 5);
}
}
Since I'm away from home for a few more days still this time, I'll try to find you a link to a script that'd work for you. I'd just write one, but I can't double check terminology here.
I'll just edit this post if I find an example.
Edit: Okay, try this one. Hopefully I got all the terms right.
void main()
{
object oPC = GetPCSpeaker();
int nCounter;
object oItem = GetFirstItemInInventory (oPC);
while (GetIsObjectValid (oItem) )
{
if (GetTag (oItem) == "NW_IT_MSMLMISC13")
{
DestroyObject (oItem);
nCounter ++;
}
oItem = GetNextItemInInventory(oPC);
}
if (nCounter > 0)
{
GiveXPToCreature (oPC, nCounter * 20);
GiveGoldToCreature (oPC, nCounter * 5);
}
}
Modifié par Failed.Bard, 20 octobre 2011 - 01:33 .





Retour en haut






