namine95 Posted January 10, 2011 Share Posted January 10, 2011 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 Targetref 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 EndifEndifEnd 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 More sharing options...
WastelandAssassin Posted January 10, 2011 Share Posted January 10, 2011 have you tried making it larger the -40, instead of smaller than -40??because it might treat negative numbers in the opposite way, meaning that the larger the negative number, the smaller it is (meaning -80 < -40 for example)i'm not sure if this will work, but it might Link to comment Share on other sites More sharing options...
namine95 Posted January 10, 2011 Author Share Posted January 10, 2011 Yup, i've tried =\ When i did that, the script launched from any angle including the positive :pinch: Link to comment Share on other sites More sharing options...
shubniggurath Posted January 10, 2011 Share Posted January 10, 2011 Hi. Uhm... and if you let the script turn the activator -40° to the right and then define the firecone to be from 0-80° ? That could simulate a 40 to -40 cone. IF the activator gets turned in the right way. Link to comment Share on other sites More sharing options...
namine95 Posted January 10, 2011 Author Share Posted January 10, 2011 I don't think rotating the activator will work.. i mean.. it always fires straight at the target its scripted to do, and it doesnt animate, the spell just comes out of it x.x Link to comment Share on other sites More sharing options...
WastelandAssassin Posted January 10, 2011 Share Posted January 10, 2011 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 doneit may be a solution to your problem Link to comment Share on other sites More sharing options...
namine95 Posted January 10, 2011 Author Share Posted January 10, 2011 (edited) 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 doneit 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 xDand 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 January 10, 2011 by namine95 Link to comment Share on other sites More sharing options...
WastelandAssassin Posted January 10, 2011 Share Posted January 10, 2011 (edited) 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 problembecause -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 January 10, 2011 by WastelandAssassin Link to comment Share on other sites More sharing options...
namine95 Posted January 10, 2011 Author Share Posted January 10, 2011 I solved it at last! maybe not the most optimal way, but now it works perfectly :biggrin: ref Targetref 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 EndifEndifEndif End Thanks for the tips =] Link to comment Share on other sites More sharing options...
Recommended Posts