Jump to content

Now this doesn't make sense


namine95

Recommended Posts

I'm scripting an spell that's being cast at all targets within an cone-like range.

My script looks like this:

 

SCN ElectricBurstScript

 

ref Target

ref Activator

float height

 

Begin ScriptEffectStart

 

if GetDead == 1 || GetInFaction 0001DBCD == 1 ;Player Faction

Return

 

Else

 

set Target to GetSelf

 

if ( Player.GetHeadingAngle Target <= 40 || Player.GetHeadingAngle Target <= -40 )

 

set Activator to Player.PlaceAtMe 0SpellActivator 1, 65, 0 (Hidden Activator placed in front of the Caster at an short distance)

set height to Player.GetPos z

set height to height + 101 (Moved the Activator up a bit so its placed exactly in front of the hands for the touch cast animation, looks really cool :happy: )

 

Activator.SetPos z, height

Activator.Cast 0201AEE6 Target

Player.PlaySound3D SplShockHit

 

Activator.Disable

Activator.DeleteReference

Endif

Endif

End

 

The problem lies at the Angle part and i've tried editing it lots of times.. but it still doesnt want to work. The positive angle 0 to 40 works just as intended but not the negative :ermm: there it launches the whole script from -0 to -180 (The whole negative Angle) although by the looks of the script, it should work. Unless i have missed something.

Link to comment
Share on other sites

well, if you really want to make sure it works well, there are such spells done on Midas Magic, so you could just look at how these spells were done

it may be a solution to your problem

 

I just did a moment earlier o.o the scripts he writes are so advanced that it's like rocket science to me xD

and by the looks of it, he's not using the GetHeadingAngle like i am.. Still i don't understand how and why it doesnt work properly =.=

 

I recently tried making the script Return if the Angles are Greater than -40/40 but it seems like it didnt change anything at all.. the negative side's STILL launching at any negative angle

Edited by namine95
Link to comment
Share on other sites

i am just shooting in the dark here, but maybe change the || (or statement) into an "and" statement?? (i don't know how it's done in the CS, but if it's like C#, it should be &&)

almost forgot that in this case, you will also have to change the second to >= -40, otherwise it will be even worse

 

maybe this will solve the problem

because -80 is still smaller then 40, so it's always checking the first statement (or so i think, but i may be wrong here)

Edited by WastelandAssassin
Link to comment
Share on other sites

I solved it at last! maybe not the most optimal way, but now it works perfectly :biggrin:

 

 

ref Target

ref Activator

float height

 

Begin ScriptEffectStart

 

if GetDead == 1 || GetInFaction 0001DBCD == 1 ;Player Faction

Return

 

Else

 

set Target to GetSelf

 

If Player.GetHeadingAngle Target <= -0.01 && Player.GetHeadingAngle Target >= -40.0

 

 

set Activator to Player.PlaceAtMe 0SpellActivator 1, 65, 0

set height to Player.GetPos z

set height to height + 101

Activator.SetPos z, height

 

Activator.Cast 0201AEE6 Target

SetPlayerProjectile 0201AEE6

Player.PlaySound3D SplShockHit

 

Activator.Disable

PrintToConsole "Activator Deleted:"

Activator.DeleteReference

PrintToConsole "True"

 

Return

 

Else

 

if Player.GetHeadingAngle Target >= 0.01 && Player.GetHeadingAngle Target <= 40.0

 

set Activator to Player.PlaceAtMe 0SpellActivator 1, 65, 0

set height to Player.GetPos z

set height to height + 101

Activator.SetPos z, height

 

Activator.Cast 0201AEE6 Target

SetPlayerProjectile 0201AEE6

Player.PlaySound3D SplShockHit

 

Activator.Disable

PrintToConsole "Activator Deleted:"

Activator.DeleteReference

PrintToConsole "True"

 

Else

 

Return

 

Endif

Endif

Endif

 

End

 

Thanks for the tips =]

Link to comment
Share on other sites

  • Recently Browsing   0 members

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