First basic Script

Post » Wed Jun 20, 2012 8:16 pm

Hi

I am wokring on my first script, its for a boss fight and I know its completely wrong.
So this is a boss with a lot of health, when the boss reaches 8000 hp or less I want the boss to cast a spell.

I have not even tried it because I know its not going to work, I would be greatful for any help getting started on this

 Scriptname akurdsfight extends ReferenceAlias Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)    if akurd.GetActorValue("health") ==< 8000    akurd.Cast lamespell Player bothhands    endifEndEvent

Thanks
PS we need a IRC
User avatar
-__^
 
Posts: 3420
Joined: Mon Nov 20, 2006 4:48 pm

Post » Thu Jun 21, 2012 3:45 am

Scriptname akurdsfight extends ReferenceAlias spell property lamespell auto ; you need to set this property in the CK in this alias attached script propertiesactor akurd = self.getreference() as actorEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)    if akurd.GetActorValue("health") =< 8000; I changed ==< for =<    lamespell.cast(player); you need to set the bothhands paramether in the spell    endifEndEvent
User avatar
kat no x
 
Posts: 3247
Joined: Mon Apr 16, 2007 5:39 pm

Post » Wed Jun 20, 2012 9:19 pm

Hi

I am wokring on my first script, its for a boss fight and I know its completely wrong.
So this is a boss with a lot of health, when the boss reaches 8000 hp or less I want the boss to cast a spell.

I have not even tried it because I know its not going to work, I would be greatful for any help getting started on this


It looks pretty good except you're forgetting that functions have parenthesis after them, and that the arguments go in those parenthesis. Also, is that logical supposed to be "greater than or equal to" or "less than or equal to"? Also, you need it to extend ObjectReference, and attach this to the Boss.
Scriptname akurdsfight extends ObjectReferenceSpell Property YourSpellProperty AutoEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)	if Self.GetActorValue("health") <= 8000 ;Less than or equal to. Also, "Self" is the current Object the script is running on.		 YourSpellProperty.RemoteCast(Self, Self, Game.GetPlayer()) ;Make a spell property, and assign it your spell.	endifEndEvent

Who is akurd? Also, Cast() needs to be called from a Spell, not an Actor. You can tell which Form the function needs to be called on by looking at the word after the dash ( - ) on it's function page. For example, the page for Cast() on the wiki is "Cast - Spell". Hope I helped.
User avatar
Vicky Keeler
 
Posts: 3427
Joined: Wed Aug 23, 2006 3:03 am

Post » Thu Jun 21, 2012 4:39 am

Cool, that was a quick reply.

Also, is that logical supposed to be "greater than or equal to" or "less than or equal to"?
It is meant to be less than or equal to

"Self" is the current Object the script is running on.
thanks that is very useful to know.


Who is akurd
Kurd is a boss in my dungeon, I am to lazy to use the filter for some reason so I put a in front of everything remove it later.

Thanks for you help guys, I have not done scripting for games in over 10 years and do not remember a thing.
I will study your replys so I understand how it works and then implement it. Should be enough infomation to create a few good boss battles :)
User avatar
Farrah Lee
 
Posts: 3488
Joined: Fri Aug 17, 2007 10:32 pm

Post » Thu Jun 21, 2012 2:06 am

Cool, that was a quick reply.


It is meant to be less than or equal to


thanks that is very useful to know.



Kurd is a boss in my dungeon, I am to lazy to use the filter for some reason so I put a in front of everything remove it later.

Thanks for you help guys, I have not done scripting for games in over 10 years and do not remember a thing.
I will study your replys so I understand how it works and then implement it. Should be enough infomation to create a few good boss battles :smile:

Also, a good thing to remember is that you can't use Editor ID's in scripts anymore. You need to make an Actor or ObjectReference property, and define it in the Properties Window.
User avatar
Izzy Coleman
 
Posts: 3336
Joined: Tue Jun 20, 2006 3:34 am

Post » Thu Jun 21, 2012 4:39 am

Ok, those scripts compiled with errors but helped me learn quite a bit.

I created a new one that sort of does what I want
The problem is that it is "OnHit" so every time I hit the actor that is under the GetActorValue it will cast the spell, I only want it to be casted once. Also there is no cast animation so I know I am going to have to use InterruptCast() some where in here.
Scriptname akurdbossfight extends actor ; because i get function error with ObjectReference because of GetActorValueSpell Property lamespell AUTO ;assign a spell via properties when attached to NPC ; I asigned a healing spell for testingSpell Property enragespell AUTO ;assign a spell via properties when attached to NPCEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)	   if Self.GetActorValue("health") <= 8000				 lamespell.Cast(Self, Self)	   if Self.GetActorValue("health") <= 5000				 lamespell.Cast(Self, Self)		if Self.GetActorValue("health") <= 3000			   enragespell.Cast(Self, Self)	 endif		endif		   endifEndEvent

Do I have to use something more like the following?
Scriptname akurdbossfight extends actorSpell Property lamespell AUTO ;assign a spell via properties when attached to NPCSpell Property enragespell AUTO ;assign a spell via properties when attached to NPCEvent OnCombatStateChanged(Actor akTarget, int aeCombatState)if (akTarget == Game.GetPlayer())	if (aeCombatState == 0)	 elseif (aeCombatState == 1)	   elseif Self.GetActorValue("health") <= 8000				 self.InterruptCast()				 lamespell.Cast(Self, Self)		elseif Self.GetActorValue("health") <= 5000				 self.InterruptCast()				 lamespell.Cast(Self, Self)		elseif Self.GetActorValue("health") <= 3000			   self.InterruptCast()			   enragespell.Cast(Self, Self)		endif		   endifEndEvent 

I know the wiki says cast and remotecast "This function casts the spell instantaneously. This is mainly desirable only for non-actors, because it will not animate an actor."

Any solutions
thanks
User avatar
Adrian Powers
 
Posts: 3368
Joined: Fri Oct 26, 2007 4:44 pm

Post » Thu Jun 21, 2012 9:23 am

In most cases, you'll not need the 'Self' keyword as you can just call the functions implicitly.
Self.GetActorValue("health") <= 8000
GetActorValue("health") <= 8000

Usually, the only time 'Self' is necessary is when passing the calling object as an argument.
User avatar
James Baldwin
 
Posts: 3366
Joined: Tue Jun 05, 2007 11:11 am

Post » Wed Jun 20, 2012 6:32 pm

Using an integer is very useful if you need something to fire once.

Scriptname akurdbossfight extends actorSpell Property lamespell AUTO ;assign a spell via properties when attached to NPCSpell Property enragespell AUTO ;assign a spell via properties when attached to NPCInt Toggle = 0Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)	   If Self.GetActorValue("health") <= 8000 && Toggle == 0				 lamespell.Cast(Self, Self)				 Toggle = 1		elseif Self.GetActorValue("health") <= 5000 && Toggle == 1				 lamespell.Cast(Self, Self)				 Toggle = 2		elseif Self.GetActorValue("health") <= 3000 && Toggle == 2			   enragespell.Cast(Self, Self)			   Toggle = 3 ; Prevents multiple firings of this If		endif		   endifEndEvent 
User avatar
Enie van Bied
 
Posts: 3350
Joined: Sun Apr 22, 2007 11:47 pm

Post » Wed Jun 20, 2012 6:10 pm

cool, thanks, so int is like a float right?
So in order to animate the spell I am going to have to use a package.
Because I am going to have lots of other stuff going on in some of my boss fights the script will be useful.
So what I was thinking is to remove the line "lamespell.Cast(Self, Self)" and replace it with "self.InterruptCast()" then create a package and set as a condition "getscriptvariable akurdbossfight Toggle == 2"
What do you think about doing it this way?
User avatar
Penny Flame
 
Posts: 3336
Joined: Sat Aug 12, 2006 1:53 am

Post » Wed Jun 20, 2012 9:56 pm

cool, thanks, so int is like a float right?
So in order to animate the spell I am going to have to use a package.
Because I am going to have lots of other stuff going on in some of my boss fights the script will be useful.
So what I was thinking is to remove the line "lamespell.Cast(Self, Self)" and replace it with "self.InterruptCast()" then create a package and set as a condition "getscriptvariable akurdbossfight Toggle == 2"
What do you think about doing it this way?

An int is an integer (whole numbers). A Float is a very small or very large number. They are used for decimals, but since we only really need whole numbers, we use Integers. I wouldn't suggest doing it that way. If you really need to, you could use Debug.SendAnimationEvent() to animate the actor.
User avatar
Rachyroo
 
Posts: 3415
Joined: Tue Jun 20, 2006 11:23 pm

Post » Wed Jun 20, 2012 11:17 pm

yeah it is much easier to script boss fights and I really do not want to use packages because they are buggy.
Every time I try to set a condition with getquestvariable and getscriptvariable I get

SCRIPTS: Need to add new parameter type 22 to TESParameters::FillandInitSelectionCombobox. 
User avatar
Kelly John
 
Posts: 3413
Joined: Tue Jun 13, 2006 6:40 am

Post » Thu Jun 21, 2012 9:11 am

Using "Debug.SendAnimationEvent" in theory sounds like a good idea but I am new at this and do not understand how it works, none of the scripts in skyrim seem to be using it fot me to have a look at it.
Does "Debug.SendAnimationEvent" loop or am I going to have to do something like I did in the following. Will I have to make a property for the animation?

Scriptname akurdbossfight extends actorSpell Property lamespell AUTO ;assign a spell via properties when attached to NPCSpell Property enragespell AUTO ;assign a spell via properties when attached to NPCDmagSelfConCharge Property DmagSelfConCharge AUTODmagSelfConLoop Property DmagSelfConLoop AUTOInt Toggle = 0Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)		  If Self.GetActorValue("health") <= 8000 && Toggle == 0	   						  self.InterruptCast()								 Debug.SendAnimationEvent(DmagSelfConCharge)								 utility.wait(0.3)  								 Debug.SendAnimationEvent(DmagSelfConCharge)								 utility.wait(0.3)								   									 Debug.SendAnimationEvent(DmagSelfConLoop)								 utility.wait(0.3)						   	  Debug.SendAnimationEvent(DmagSelfConLoop)								 utility.wait(0.3)						   	  Debug.SendAnimationEvent(DmagSelfConLoop)								 utility.wait(0.3)								 lamespell.Cast(Self, Self)								 Toggle = 1


Sorry for being a noob guys lol
User avatar
Flesh Tunnel
 
Posts: 3409
Joined: Mon Sep 18, 2006 7:43 pm

Post » Wed Jun 20, 2012 7:56 pm

Using "Debug.SendAnimationEvent" in theory sounds like a good idea but I am new at this and do not understand how it works, none of the scripts in skyrim seem to be using it fot me to have a look at it.
Does "Debug.SendAnimationEvent" loop or am I going to have to do something like I did in the following. Will I have to make a property for the animation?

Scriptname akurdbossfight extends actorSpell Property lamespell AUTO ;assign a spell via properties when attached to NPCSpell Property enragespell AUTO ;assign a spell via properties when attached to NPCDmagSelfConCharge Property DmagSelfConCharge AUTODmagSelfConLoop Property DmagSelfConLoop AUTOInt Toggle = 0Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)		  If Self.GetActorValue("health") <= 8000 && Toggle == 0	   						  self.InterruptCast()								 Debug.SendAnimationEvent(DmagSelfConCharge)								 wait(0.3)  								 Debug.SendAnimationEvent(DmagSelfConCharge)								 wait(0.3)								   									 Debug.SendAnimationEvent(DmagSelfConLoop)								 wait(0.3)						   	  Debug.SendAnimationEvent(DmagSelfConLoop)								 wait(0.3)						   	  Debug.SendAnimationEvent(DmagSelfConLoop)								 wait(0.3)								 lamespell.Cast(Self, Self)								 Toggle = 1


Sorry for being a noob guys lol

I really can't answer yet, because I don't know what kind of enemy Kurd is. Is he a monster? An NPC? If he's an NPC, this would be very easy. If it's a monster, I would need to know what kind of Monster it is, so I can see it behavior graphs, and determine what Anim Events it has.
User avatar
Steven Nicholson
 
Posts: 3468
Joined: Mon Jun 18, 2007 1:24 pm

Post » Wed Jun 20, 2012 7:32 pm

he is a NPC
User avatar
Umpyre Records
 
Posts: 3436
Joined: Tue Nov 13, 2007 4:19 pm

Post » Wed Jun 20, 2012 8:11 pm

Ok, then this is pretty easy.
Scriptname akurdbossfight extends actorSpell Property lamespell AUTO ;assign a spell via properties when attached to NPCSpell Property enragespell AUTO ;assign a spell via properties when attached to NPCInt Toggle = 0Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)		   If Self.GetActorValue("health") <= 8000 && Toggle == 0							 Self.EquipSpell(lamespell, 1)							 Utility.Wait(0.3)							 Debug.SendAnimationEvent(Self, "Magic_Equip")							 Utility.Wait(0.3)							 Debug.SendAnimationEvent(Self, "MRh_SpellSelfStart") ;Causes him to cast the spell.									  Toggle = 1				elseif Self.GetActorValue("health") <= 5000 && Toggle == 1							 Self.EquipSpell(lamespell, 1)							 Utility.Wait(0.3)							 Debug.SendAnimationEvent(Self, "Magic_Equip")							 Utility.Wait(0.3)							 Debug.SendAnimationEvent(Self, "MRh_SpellSelfStart") ;Causes him to cast the spell.									  Toggle = 2				elseif Self.GetActorValue("health") <= 3000 && Toggle == 2							 Self.EquipSpell(enragespell, 1)							 Utility.Wait(0.3)							 Debug.SendAnimationEvent(Self, "Magic_Equip")							 Utility.Wait(0.3)							 Debug.SendAnimationEvent(Self, "MRh_SpellSelfStart") ;Causes him to cast the spell.											  Toggle = 3 ; Prevents multiple firings of this If				endif				   endifEndEvent;Notes:; Debug.SendAnimationEvent() actually sends animation EVENTS, not animations. This means calling the "MRh_SpellSelfStart"; Anim Event will ACTUALLY cause the actor to cast a spell. Another example is "AttackStart", it will actually make the; Actor throw a punch, and will hurt anything in front of it. This is why I use "Magic_Equip", as it will ACTUALLY cause the; actor to equip whatever magic is in his "active" weapon slot. So I hope this taught you a lot about Anim Events. Bye!;; Also, I assumed these spells are on self. I hope this is right because I used the Self magic spell anim event.;;;;;; <3; Moopus
User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Wed Jun 20, 2012 6:19 pm

For some reason Debug.SendAnimationEvent is not working for me and I have no idea why :(


Spoiler
Scriptname akurdbossfight extends actorSpell Property lamespell AUTO ;assign a spell via properties when attached to NPCSpell Property enragespell AUTO ;assign a spell via properties when attached to NPCScene property tauntscene autoScene property tauntscene2 autoScene property tauntscene3 autoScene property tauntscene4 autoScene property tauntscene5 autoInt Toggle = 0Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)				   If Self.GetActorValuePercentage("health") <= 0.9 && Toggle == 0			   										  self.InterruptCast()														 Self.EquipSpell(lamespell, 1)														 Self.EquipSpell(lamespell, 0)														 Debug.SendAnimationEvent(Self, "Magic_Equip")														 Utility.Wait(0.3)														 Debug.SendAnimationEvent(Self, "DualMagic_SpellSelfStart") ;Causes him to cast the spell.																		  Toggle = 1																												 Utility.Wait(6) ;wait for actor to finish acting before scene														 Self.UnequipSpell(lamespell, 1)														 Self.UnequipSpell(lamespell, 0)														 tauntscene.Start() ;the boss taunts/mocks the player								elseif Self.GetActorValuePercentage("health") <= 0.8 && Toggle == 1							   						  self.InterruptCast()														 Self.EquipSpell(lamespell, 1)														 Debug.SendAnimationEvent(Self, "Magic_Equip")														 Utility.Wait(0.3)														 Debug.SendAnimationEvent(Self, "DualMagic_SpellSelfStart") ;Causes him to cast the spell.																		  Toggle = 2														 Utility.Wait(6) ;wait for actor to finish acting before scene																							  Self.UnequipSpell(lamespell, 1)														 tauntscene.Start() ;the boss taunts/mocks the player																					elseif Self.GetActorValuePercentage("health") <= 0.6 && Toggle == 2							   						  self.InterruptCast()														 Self.EquipSpell(enragespell, 1)														 Self.EquipSpell(enragespell, 0)														 Debug.SendAnimationEvent(Self, "Magic_Equip")														 Utility.Wait(0.3)														 Debug.SendAnimationEvent(Self, "DualMagic_SpellSelfStart") ;Causes him to cast the spell.																	 Toggle = 3 ; Prevents multiple firings of this If																											 Utility.Wait(6) ;wait for actor to finish acting before scene														 Self.UnequipSpell(lamespell, 1)														 Self.UnequipSpell(enragespell, 0)														 tauntscene.Start() ;the boss taunts/mocks the player								endifEndEvent
User avatar
Manuela Ribeiro Pereira
 
Posts: 3423
Joined: Fri Nov 17, 2006 10:24 pm

Post » Thu Jun 21, 2012 5:29 am

Just out of curiosity, why did you put "dualmagic_spellselfstart" instead of "MRh_spellselfstart" ? :happy:"

Also, why the "self.equipspell(lamespell, 0)"? i thought 1 was enough?
User avatar
Jhenna lee Lizama
 
Posts: 3344
Joined: Wed Jun 06, 2007 5:39 am

Post » Wed Jun 20, 2012 10:50 pm

because Mrh = Magic right Hand and it is a spell that requires both hands. I did try MRh_spellselfstart and changing the spell to be cast from right hand and it still did not work.

self.equipspell(lamespell, 0) 0 = left hand 1 = right hand 3 = voice, I added it in to try to get it to work.
User avatar
Jennifer Rose
 
Posts: 3432
Joined: Wed Jan 17, 2007 2:54 pm


Return to V - Skyrim