Jump to content

Crystal spells


PanzerOfGod

Recommended Posts

If (Timer > 9.7)
Set Timer to Timer + GetSecondsPassed
EndIf

It compiles correctly, but only one crystal appears ingame just like before. Did i do something wrong?

 

All you did was quote me... Are you telling me to change > to >= like it was in your script? That doesn't work either...

Link to comment
Share on other sites

So I switch > to <=? The same problem still happens with that adjustment; only one crystal shows up. Maybe the problem is with another one of my scripts? Here are all the scripts relating to the crystal:

 

The Spell:

Scriptname SMCSmallRotatingImpureCrystalSpellScript

Ref EvilCrystal01
Ref EvilCrystal02
Ref EvilCrystal03
Ref EvilCrystal04
Ref EvilCrystal05
Ref EvilCrystal06
Ref EvilCrystal07
Ref EvilCrystal08
Ref EvilCrystal09
Ref EvilCrystal10
Ref EvilCrystal11
Ref EvilCrystal12
Ref EvilCrystal13
Ref EvilCrystal14
Ref EvilCrystal15
Ref EvilCrystal16
Ref EvilCrystal17
Ref EvilCrystal18
Ref EvilCrystal19
Ref EvilCrystal20
Short Counter
Float Timer

Begin ScriptEffectStart
If (Counter == 0)
If (Timer < .4)
	Set EvilCrystal01 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 1)
If (Timer > .4 && Timer < .7)
	Set EvilCrystal02 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 2)
If (Timer > .8 && Timer < 1.1)
	Set EvilCrystal03 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 3)
If (Timer > 1.2 && Timer < 1.6)
	Set EvilCrystal04 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 4)
If (Timer > 1.7 && Timer < 2.1)
	Set EvilCrystal05 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 5)
If (Timer > 2.2 && Timer < 2.6)
	Set EvilCrystal06 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 6)
If (Timer > 2.7 && Timer < 3.1)
	Set EvilCrystal07 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 7)
If (Timer > 3.2 && Timer < 3.6)
	Set EvilCrystal08 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 8)
If (Timer > 3.7 && Timer < 4.1)
	Set EvilCrystal09 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 9)
If (Timer > 4.2 && Timer < 4.6)
	Set EvilCrystal10 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 10)
If (Timer > 4.7 && Timer < 5.1)
	Set EvilCrystal11 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 11)
If (Timer > 5.2 && Timer < 5.6)
	Set EvilCrystal12 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 12)
If (Timer > 5.7 && Timer < 6.1)
	Set EvilCrystal13 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 13)
If (Timer > 6.2 && Timer < 6.6)
	Set EvilCrystal14 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 14)
If (Timer > 6.7 && Timer < 7.1)
	Set EvilCrystal15 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 15)
If (Timer > 7.2 && Timer < 7.6)
	Set EvilCrystal16 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 16)
If (Timer >7.7  && Timer < 8.1)
	Set EvilCrystal17 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 17)
If (Timer > 8.2 && Timer < 8.6)
	Set EvilCrystal18 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 18)
If (Timer > 8.7 && Timer < 9.1)
	Set EvilCrystal19 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Counter == 19)
If (Timer > 9.2 && Timer < 9.6)
	Set EvilCrystal20 to Player.PlaceAtMe SMCCrystalRotationTest
	Set Counter to Counter + 1
EndIf
EndIf
If (Timer <= 9.7)
Set Timer to Timer + GetSecondsPassed
EndIf
End

Begin ScriptEffectFinish
EvilCrystal01.Disable
EvilCrystal01.RemoveMe
EvilCrystal02.Disable
EvilCrystal02.RemoveMe
EvilCrystal03.Disable
EvilCrystal03.RemoveMe
EvilCrystal04.Disable
EvilCrystal04.RemoveMe
EvilCrystal05.Disable
EvilCrystal05.RemoveMe
EvilCrystal06.Disable
EvilCrystal06.RemoveMe
EvilCrystal07.Disable
EvilCrystal07.RemoveMe
EvilCrystal08.Disable
EvilCrystal08.RemoveMe
EvilCrystal09.Disable
EvilCrystal09.RemoveMe
EvilCrystal10.Disable
EvilCrystal10.RemoveMe
EvilCrystal11.Disable
EvilCrystal11.RemoveMe
EvilCrystal12.Disable
EvilCrystal12.RemoveMe
EvilCrystal13.Disable
EvilCrystal13.RemoveMe
EvilCrystal14.Disable
EvilCrystal14.RemoveMe
EvilCrystal15.Disable
EvilCrystal15.RemoveMe
EvilCrystal16.Disable
EvilCrystal16.RemoveMe
EvilCrystal17.Disable
EvilCrystal17.RemoveMe
EvilCrystal18.Disable
EvilCrystal18.RemoveMe
EvilCrystal19.Disable
EvilCrystal19.RemoveMe
EvilCrystal20.Disable
EvilCrystal20.RemoveMe
End

 

The Crystal (an activator named SMCCrystalRotationTest) script:

ScriptName SMCSmallRotatingImpureCrystalScript

short constantsset
Ref TrigRef

float rspeed ; in degrees/s
float hdist ; horizontal distance from the player
float rpos ; position on the circle
float mod_x ; positions relative to the player
float mod_y
float mod_z
float org_x ; position of the player
float org_y
float org_z

Begin GameMode

   ; setting up constants
   if constantsset == 0
       set rspeed       to  70 ; constant radial speed
       set mod_z        to 90 ; constant height
       set hdist        to 60 ; constant distance
       set constantsset to   1 ; done setting up the constants
   endif

   ; updating the position on the circle (rpos)
   set rpos to rpos + ( rspeed * getSecondsPassed )
   if rpos > 360
       set rpos to rpos - 360
   endif

   ; setting the mods, via the SinCosTan function
   set math.fin1 to rpos
   setStage math 15                ; SinCosTan(rpos) function call
   set mod_x to math.fout  * hdist ; sin(rpos) * hdist
   set mod_y to math.fout2 * hdist ; cos(rpos) * hdist

   ; getting the player's position
   set org_x to Player.getPos X
   set org_y to Player.getPos Y
   set org_z to Player.getPos Z

   ; setting my own position
   set org_x to org_x + mod_x
   setPos X, org_x
   set org_y to org_y + mod_y
   setPos Y, org_y
   set org_z to org_z + mod_z
   setPos Z, org_z

End

 

The Scroll that gives the spell (which I highly doubt could be the problem) script:

Scriptname SMCSmallImpureCrystalCircleScrollScipt

Short ControlVar

Begin OnSell RewandriilRef
If (ControlVar == 0)
Player.AddSpell SMCSmallRotatingImpureCrystalSpell
Set ControlVar to 1
EndIf
End

Link to comment
Share on other sites

Haha! It's nearly seamless now! Just a couple small adjustments, an triggerzone, maybe upward/downward oscillation 8) . Perhaps I'll make each individual crystal rotate on its z axis...Abrumal, people like you and vagrant are even more helpful than the wiki. Thanks!
Link to comment
Share on other sites

How would I go about making a spell that an activator cast hostile against my enemies? What I mean is, I have a spell that summons an activator, and when the player activates that activator, it casts a spell. I want the spell that it casts to get me in trouble with everyone within a certain radius. How can I use scripting to accomplish this?
Link to comment
Share on other sites

If you want anyone nearby to attack the player, you could use StartCombat player, or just use an area-effect Frenzy spell.

 

If you want to damage only actors who are already hostile to the player, you could probably use GetCombatTarget to check if they're currently attacking. This probably wouldn't detect if they're attacking a summon or a companion.

Link to comment
Share on other sites

How do you make an item slowly ascend? My next spell will involve large crystals coming up from the ground in front of the player. Which reminds me, is there a way I could GetLOS or something to make sure that the crystal come up in the direction the player is facing?
Link to comment
Share on other sites

How do you make an item slowly ascend? My next spell will involve large crystals coming up from the ground in front of the player. Which reminds me, is there a way I could GetLOS or something to make sure that the crystal come up in the direction the player is facing?

Use player.getheading to determine where the player is facing. Use a script on the activator being created by the spell to move it into position by using an incremental

begin onload
if once != 1
set endposz to player.getposz
set once to 1
endif
if self.getpos z < endposz
set newz to self.getpos z + 2
self.setpos z newz
endif

or something similar. Just make sure the base point of the activator is a bit higher than where the bottom of the mesh is (difference of atleast 32 units), unless you want there to be a chance of a gap. While you could technically animate the activator to move instead, doing it this way would allow you to do another sort of animation on the activator (IE breaking when hit). Thought about doing something like this myself, but never got around to it. Should all be possible.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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