Item Scripting/Spawn Summon?
![Zephirius](https://forums.beamdog.com/uploads/userpics/KEYH4THWCWVZ/n6VV98LH2SN2M.gif)
I have a little amulet that is supposed to summon a wraith to fight at your side. Only problem is that after I summon him, he's not associated to my group. How do I make him a true summon with it's picture hanging out in the upper right hand corner of my screen?
Also, I'm wholly uncertain on how to spawn the wraith where I click at on the screen? I just spawns next to the PC, PC = lLoc...
Anyway hope your all having a great day, and any help, even a nudge in the proper direction would be awsome.![:) :)](https://forums.beamdog.com/resources/emoji/smile.png)
Little bit of code I have...
Also, I'm wholly uncertain on how to spawn the wraith where I click at on the screen? I just spawns next to the PC, PC = lLoc...
Anyway hope your all having a great day, and any help, even a nudge in the proper direction would be awsome.
![:) :)](https://forums.beamdog.com/resources/emoji/smile.png)
Little bit of code I have...
object oUsed = GetItemActivated(); // The following section is for the Amulet of the Dead // The amulet summons a wraith. if (GetTag(oUsed) == "AMULET_DEAD") { // Get the PC, first. object oPC = GetItemActivator(); location lLoc = GetLocation(oPC); effect eSummon = EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eSummon, lLoc); DelayCommand(0.5, CreateObjectVoid(OBJECT_TYPE_CREATURE, "wraith", lLoc)); //object oMaster = GetMaster(GetObjectByTag("WRAITH")); } }
0
Comments
I did this with a rod that summons a Golem for wizard's to use as body guards.
I simply use the special ability on the rod to spawn it like you did, but the Golem is using the hechman script set (found on the characters listed in the "Standard/Other" list).
Darn!
that is the code for my item, then I have the ai from the henchmen characters running on the summoned golem.
Of course I never know if I do it the best way, but it does work.....
My Summon is a custom creature
So, I have the OnActivate setup to just redirect:
Then I tried this code: (I made wraith001 in the pallet beforehand, but tried wraith as well. It summoned a dwarf...)
It made a Wraith, but it had no AI. So you'll have to figure out how to add that to it. I'm sure you can just copy the script set from a standard summon creature resref.
Even though copying a standard pallet creature like wraith creates a new creature with a resref of wraith001, the actual bluprint resref of the original is nw_wraith. Maybe that's what you're missing... Though you'd still need to make a custom creature so that it would have the right AI.
How do I plug oPC into the the remaining script so that oPC is recongnized as GetItemActivator();
oPC is only being called once to identify as GetItemActivator(); Does oPC need to be referenced at any other time in the remaining script?
You are correct about GetItemActivator().
You define oPC but never use it.
In order to use it, you have to change ApplyEffectAtLocation to ApplyEffectToObject and put oPC in as the target object. This removes the ability to target where the summon appears.
To keep that, you need to go the ExecuteScript route. Pretty easy: 'summon_script' can be what I put earlier, I should just mention that the if(GetIsObjectValid(oTarget)) statement is there to block the user from targeting objects. That way they can only target locations on the ground. You can remove that, of course.