The Nexus Forums: I need help whit Scripting - The Nexus Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

I need help whit Scripting Custom Bound staff spell

#1 User is offline   namine95 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 27-August 09

Post icon  Posted 17 November 2009 - 07:03 PM

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:
0

#2 User is offline   zprospero 

  • The Clockmaker
  • PipPipPip
  • Group: Members
  • Posts: 911
  • Joined: 16-August 09

Posted 17 November 2009 - 08:31 PM

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.
0

#3 User is offline   Vagrant0 

  • Resident poster
  • Icon
  • Group: Staff
  • Posts: 5,770
  • Joined: 14-June 06

Posted 17 November 2009 - 09:36 PM

View Postzprospero, on Nov 17 2009, 09:31 PM, said:

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.elderscrol...x.php/EquipItem that you might find interesting.
0

#4 User is offline   namine95 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 27-August 09

Posted 18 November 2009 - 07:57 AM

Okay =]

I will check it out.
and eventually see if i can make it work,

Oh and! the bound weapon isn't designated as a Quest weapon. ^^
0

#5 User is offline   namine95 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 27-August 09

Posted 18 November 2009 - 08:13 AM

View PostVagrant0, on Nov 17 2009, 09:36 PM, said:

View Postzprospero, on Nov 17 2009, 09:31 PM, said:

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.elderscrol...x.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")
0

#6 User is offline   Vagrant0 

  • Resident poster
  • Icon
  • Group: Staff
  • Posts: 5,770
  • Joined: 14-June 06

Posted 18 November 2009 - 09:15 AM

View Postnamine95, on Nov 18 2009, 09:13 AM, said:

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.
0

#7 User is offline   namine95 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 27-August 09

Posted 18 November 2009 - 09:23 AM

View PostVagrant0, on Nov 18 2009, 09:15 AM, said:

View Postnamine95, on Nov 18 2009, 09:13 AM, said:

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 .-.
0

#8 User is offline   namine95 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 27-August 09

Post icon  Posted 18 November 2009 - 09:50 AM

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

0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Skin by Skinbox
Quality & cheap IPB skins, premade vBulletin styles, cheap Web templates and more! - Skinbox