Jump to content

Need help with this script


Dakilleux

Recommended Posts

I'd like to know what I should change for it to work. The intent of this spell effect is to make the target spin increasingly fast for the spell's duration.

 

scriptname GravitySpell

 

short Spinorama

short CurrentAngleZ

long SpinTime

 

Begin ScriptEffectStart

set CurrentAngleZ to target.GetAngle Z

set Spinorama to 1

set SpinTime to CurrentAngleZ + Spinorama

End

 

Begin ScriptEffectUpdate

target.SetAngle Z, SpinTime

set Spinorama to Spinorama + Spinorama

End

 

Begin ScriptEffectFinish

Message "Spell is finished."

End

 

 

The finish function is for testing purposes.

Link to comment
Share on other sites

http://cs.elderscrolls.com/constwiki/index.php/GetSelf

http://cs.elderscrolls.com/constwiki/index.php/GetAngle

http://cs.elderscrolls.com/constwiki/index.php/SetAngle

 

And a script portion that does something similar but doesn't increase in speed.

 

Begin scripteffectstart
set target to getself
set counter to 35
set heading to target.getangle z
target.setrestrained 1
if target == player
disableplayercontrols
endif
end

Begin scripteffectupdate
if counter >= 1
set heading to heading + 6
target.setangle z, heading
set counter to counter - 1
if target == player
	triggerhitshader 1
endif
elseif counter <= 0
if target == player
	enableplayercontrols
endif
target.setrestrained 0
endif
end

Begin scripteffectfinish
target.setrestrained 0
if target == player
	enableplayercontrols
	player.setrestrained 0
	else
		target.setrestrained 0
endif
end

 

An increasing effect could probably be achieved by implementing a positive counter instead of a negative one (counter variable counts up for each pass instead of down), and applying the value of that counter to the angle adjustment.

Link to comment
Share on other sites

Thanks but I still don't get what's wrong with my script :/

 

I've looked around the CS wiki but nothing helps

 

Edit: Here's a revised version

 

scriptname WhirlwindEffect

 

short target

short currentz

short momentum

long rotate

 

Begin ScriptEffectStart

set target to getself

set momentum to 1

target.setrestrained 1

End

 

Begin ScriptEffectUpdate

set currentz to target.GetAngle Z

set rotate to momentum + currentz

target.setangle z, rotate

End

 

Begin ScriptEffectFinish

target.setrestrained 0

End

 

it tells me this:

 

Script 'WhirlwindEffect', Line 17

Syntax Error. Invalid Reference 'target' (only object references and reference variables are allowed in this context).

Link to comment
Share on other sites

I;ll just redo the code and you'll see the differences.

 

scriptname WhirlwindEffect

ref target
float currentz
float rotate

Begin ScriptEffectStart
set target to getself
target.setrestrained 1
End

Begin ScriptEffectUpdate
set currentz to target.GetAngle Z
set rotate to currentz + 1
target.setangle z, rotate
End

Begin ScriptEffectFinish
target.setrestrained 0
End

 

then you gotta make sure the spell last more than a few seconds otherwise the last block will run and end the spell's effect.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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