Jump to content

I need help whit Scripting


namine95

Recommended Posts

Well... i'm trying to make a Bound staff spell and my script looks like this:

 

----------------------------------------------------------

 

scn 000BoundNecroStaff

 

begin scripteffectstart

player.additem UniqueStaffApotheosis 1

player.equipitem UniqueStaffApotheosis

end

 

Begin scripteffectfinish

Player.unequipitem UniqueStaffApotheosis

player.removeitem UniqueStaffApotheosis 1

end

 

----------------------------------------------------------

 

I just have one problem i can't figure out. :ermm:

I want the weapon to disappear when i press the button, F (Puts the weapon Down).

But i don't know how to make the script work like that. o-o''

any piece of advice or help will be deeply appreciated! :sweat:

Link to comment
Share on other sites

Well, you'll need to use a script attached to the staff with an OnDrop block, like this.

 

Begin OnDrop

End

 

How you want to get rid of the staff from the world is up to you, but removeitem won't

work because it's not in the player's inventory.

If you're wanting it to be unsummoned due to sheathing (like other bound weapons) you'd need to use a gamemode block instead. This can be a bit tricky, but something like;

 

short toggle

begin gamemode
if player.getequipped <staffID> == 1
if player.isweaponout == 1 && toggle == 0
   set toggle to 1
elseif player.isweaponout != 1 && toggle == 1
   set toggle to 0
   player.unequipitem <staffID> 1
endif
endif

begin onunequip
player.removeitem <staffID> 1
player.dispel <spell ID of summon spell>
endif

Attached to the item.

 

Making the item flagged as a quest item will prevent the player from being able to drop it, and thus removing the necessity of adding scripting in an ondrop block, setting up a dummy actor to pick up the item, ect. The purpose of the variable is so that the weapon isn't immediately unsummoned if the player didn't have their weapon out upon summoning. This should make it so that the player can keep the weapon sheathed without it being instantly removed, but unable to re-sheath it once it has been unsheathed without the item being removed.

 

There are a few notes under http://cs.elderscrolls.com/constwiki/index.php/EquipItem that you might find interesting.

Link to comment
Share on other sites

Well, you'll need to use a script attached to the staff with an OnDrop block, like this.

 

Begin OnDrop

End

 

How you want to get rid of the staff from the world is up to you, but removeitem won't

work because it's not in the player's inventory.

If you're wanting it to be unsummoned due to sheathing (like other bound weapons) you'd need to use a gamemode block instead. This can be a bit tricky, but something like;

 

short toggle

begin gamemode
if player.getequipped <staffID> == 1
if player.isweaponout == 1 && toggle == 0
   set toggle to 1
elseif player.isweaponout != 1 && toggle == 1
   set toggle to 0
   player.unequipitem <staffID> 1
endif
endif

begin onunequip
player.removeitem <staffID> 1
player.dispel <spell ID of summon spell>
endif

Attached to the item.

 

Making the item flagged as a quest item will prevent the player from being able to drop it, and thus removing the necessity of adding scripting in an ondrop block, setting up a dummy actor to pick up the item, ect. The purpose of the variable is so that the weapon isn't immediately unsummoned if the player didn't have their weapon out upon summoning. This should make it so that the player can keep the weapon sheathed without it being instantly removed, but unable to re-sheath it once it has been unsheathed without the item being removed.

 

There are a few notes under http://cs.elderscrolls.com/constwiki/index.php/EquipItem that you might find interesting.

 

 

Hmm.. i tried to make the script look more like yours, but it said at Line 15: Nested begin/end blocks are not allowed. (begin onunequip) :wacko:

 

Now i made up whit a script for the weapon.. attached to it. But it still doesn't want to disappear when i sheat it. At least it doesn't add duplicated staffs into my inventory... it used to do that. now it works just like a Bound item but it lasts forever until it's deleted. o.O

 

scn 000UseOnceItemScriptALTERNATIVE

ref myOwner
short dostate
short WeaponOut


begin ondrop
set doState to 1
end

begin onunequip
set doState to 1
end


begin GameMode

 if DoState == 0
if myOwner.isActor == 0
	set myOwner to GetContainer
	if getisID UniqueStaffApotheosis 
	   MyOwner.AddSpell TestShock
	endif
elseif myOwner.IsWeaponOut
	  set WeaponOut to 1
elseif WeaponOut
	Set doState to 1
	MyOwner.RemoveSpell TestShock
	RemoveMe
endif
 Return
  elseif DoState < 2
set doState to doState + 1
 else
set doState to 0
set myOwner to GetContainer
if myOwner != 0
 MyOwner.RemoveSpell TestShock
	RemoveMe
else
  MyOwner.RemoveSpell TestShock
endif
endif
	

	



end

 

(I used "TestShock" as the Spell to summon the Staff because it feels like TestShock is completely useless and doesn't affect the game in a single way :P. So in this fact it's called Magician Staff but the ID is just "TestShock")

Link to comment
Share on other sites

Hmm.. i tried to make the script look more like yours, but it said at Line 15: Nested begin/end blocks are not allowed. (begin onunequip) :wacko:

That's because I ommitted the all important "end" before starting a new block. It's not that hard to fix.

 

As for making it a quest item, this is for no other reason than to prevent the player from being able to sell, drop, or misplace the summoned item as long as they have it. It helps avoid exploits which might grant the player infinite money, an endless supply of summoned weapons, or simply bloating their save. All it is is a flag when you define the item, you don't have to make it actually used by anything quest related.

Link to comment
Share on other sites

Hmm.. i tried to make the script look more like yours, but it said at Line 15: Nested begin/end blocks are not allowed. (begin onunequip) :wacko:

That's because I ommitted the all important "end" before starting a new block. It's not that hard to fix.

 

As for making it a quest item, this is for no other reason than to prevent the player from being able to sell, drop, or misplace the summoned item as long as they have it. It helps avoid exploits which might grant the player infinite money, an endless supply of summoned weapons, or simply bloating their save. All it is is a flag when you define the item, you don't have to make it actually used by anything quest related.

 

I can't believe it's so hard to make a single script that just deletes the weapon when it's sheated lol xDD

I'm such a noob on scripting .-.

Well... maybe because it's my first time but im learning ^^

 

I don't have any problem whit money or so.. i just want it to disappear once it's sheated. It would be a disaster (well not literally xDDD) if it's getting dropped on the ground. Any NPC could pick it up during combat or something like that and start blowing up the whole town. If that happens alot people would die and some would prolly disappear permanently after a while because they aren't "Essential" and have a Respawn. i think that sucks. but someday i will put a respawn on everything except the stuff that's supposed to be dead :P

 

A script that makes the weapon disappear when using the Spell again would be awesome... but i don't have a single idea or clue on how to make it work like that. X-x

 

OMFG! Lol i made it work. the weapon diappears when i sheat it =P

but there's a tiny problem :pinch:

The spell summoning the staff disappears thoo xD

in this case i have to use the "player.addspell" all over .-.

Link to comment
Share on other sites

Yay =]

 

it finally works!

 

i just had to remove some things in the script.. it looks like it was an victim of a Massacre.

but now the spell stays when the weapon is sheated and the weapon disappears from the game completely until the spell is used again. ^^

 

 

 

Thanks for the Advice and all support you guys gave me =]

i really appreciated it!

 

 

The script attached to the weapon ended up like this:

 

scn 000UseOnceItemScriptALTERNATIVE

ref myOwner
short dostate
short WeaponOut


begin ondrop
set doState to 1
end

begin onunequip
set doState to 1
end


begin GameMode

 if DoState == 0
if myOwner.isActor == 0
	set myOwner to GetContainer
	if getisID UniqueStaffApotheosis 
	   MyOwner.AddSpell TestShock
	endif
elseif myOwner.IsWeaponOut
	  set WeaponOut to 1
elseif WeaponOut
	Set doState to 1
			RemoveMe
endif
 Return
  elseif DoState < 2
set doState to doState + 1
 else
set doState to 0
set myOwner to GetContainer
if myOwner != 0
 
   RemoveMe
else
  endif
 endif
	

	



end

 

And the Summoning Spell, like This:

 

Scn 000WeaponAddScript
; - - Should be NPC Friendly

ref me
short doState
short FrameCount
ref myItem


begin ScriptEffectStart
set me to Getself
if isSpellTarget TestShock
	set myItem to UniqueStaffApotheosis
	endif
Message "Summoned Weapon" 1
Message "Summoned Weapon" 1
me.removeItem MyItem  99
me.Additem MyItem 1
end

begin ScriptEffectUpdate
set FrameCount to FrameCount + 1

if DoState == 0 && FrameCount > 1
   me.EquipItem MyItem 0
   set doState to 1
endif
end

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...