Very special script required!

Post » Sat May 28, 2011 4:44 am

I have a creature. It needs to be a companion to the player when a particular item is in the player's inventory, and needs to disappear when the player drops the item, and then reappear when the player picks up the item again. It is not a creature that can be summoned with one of the built-in spells, so I can't just enchant an item and force-equip and force-remove it when my item is moved in and out of inventory. How would I do this, and what is a good setting for the follow?
User avatar
Bethany Short
 
Posts: 3450
Joined: Fri Jul 14, 2006 11:47 am

Post » Sat May 28, 2011 4:28 am

I have a creature. It needs to be a companion to the player when a particular item is in the player's inventory, and needs to disappear when the player drops the item, and then reappear when the player picks up the item again. It is not a creature that can be summoned with one of the built-in spells, so I can't just enchant an item and force-equip and force-remove it when my item is moved in and out of inventory. How would I do this, and what is a good setting for the follow?

begin V.Specialscriptif ( player->GetItemCount, "V. special item" => 1 )    "V.specialCreature" -> enable ; must be a unique Id    PlaceAtPC, "V.specialCreature", 1, 120, 0    "V.specialCreature" -> Forcegreeting ;you should set this to initiate the companion scriptelse    "V.specialCreature" -> Disableendifend( 


absoloutly no Guarrantee it will work but it's worth giving it a shot. :)
User avatar
Sabrina Steige
 
Posts: 3396
Joined: Mon Aug 20, 2007 9:51 pm

Post » Sat May 28, 2011 12:32 am

So far it is almost functional, though follow isn't working right, and a creature that is already out doesn't disappear when the item is dropped, allowing for "cloning." What are good numbers to put in the AIFollow I attached to the creature greeting?
User avatar
Alkira rose Nankivell
 
Posts: 3417
Joined: Tue Feb 27, 2007 10:56 pm

Post » Sat May 28, 2011 9:03 am

So far it is almost functional, though follow isn't working right, and a creature that is already out doesn't disappear when the item is dropped, allowing for "cloning." What are good numbers to put in the AIFollow I attached to the creature greeting?

put this on the item
begin V.specialItemscriptshort OnPCDropIf ( OnPCDrop == 1 )    "V.SpecialCreature" -> disableendifend


What are you doing this for, may I ask?

Edit: , 1, 128, 1 for the AI follow :)
User avatar
Jeffrey Lawson
 
Posts: 3485
Joined: Tue Oct 16, 2007 5:36 pm

Post » Sat May 28, 2011 4:32 am

I'd try something like this:
script on the ring
begin mrdSummonItemScript; global short mrdSummonshort OnPCAddshort OnPCDropif ( OnPCDrop )	set OnPCDrop to 0	set mrdSummon to 0elseif ( OnPCAdd )	set OnPCAdd to 0	set mrdSummon to 1	PlaceAtPC mrdSummonCreatureID 1 120 0endifend
script on the creature
begin mrdSummonCreatureScript; global short mrdSummonfloat timerif ( GetDisabled )	if ( timer < 5 )		set timer to ( timer + GetSecondsPassed )		return	endif	set timer to 0	setdelete 1	returnendifif ( mrdSummon == 0 )	disableendifend

User avatar
Jeremy Kenney
 
Posts: 3293
Joined: Sun Aug 05, 2007 5:36 pm

Post » Sat May 28, 2011 3:06 am

Functional! Thanks all!
User avatar
Ally Chimienti
 
Posts: 3409
Joined: Fri Jan 19, 2007 6:53 am

Post » Fri May 27, 2011 7:54 pm

I could actualy use a script like that with gollum/smegol and the ring, that is a very nice idea actualy :)
User avatar
Melanie Steinberg
 
Posts: 3365
Joined: Fri Apr 20, 2007 11:25 pm


Return to III - Morrowind