Jump to content

Need Help With A Script


The_Vyper

Recommended Posts

I'm trying to modify the script for those spell-casting stones in Ayleid ruins so they target all actors in range instead of just the Player.

 

The original script is:

 

 

 

scn ARTrapEvilStone01SCRIPT
 
; when activated will shoot fireball at player after 3 sec
 
float timer
short ready
ref mySelf
ref myParent
short next
short SpellRank
 
begin onActivate
 
if isActionRef player == 0 && timer <= 0 && ready == 0
playgroup forward 1
set timer to 8
set ready to 1
set next to 1
endif
 
end
 
begin gameMode
 
; daisy-chain
if next == 1 && timer <= 5
set mySelf to getSelf
set myParent to getParentRef
myParent.activate mySelf 1
set next to 0
endif
 
;This section will choose the trap spell based on the PC's level... hopefully
if player.GetLevel <= 5
set SpellRank to 1
elseif ( player.GetLevel >= 6 ) && ( player.GetLevel <= 10 )
set SpellRank to 2
elseif ( player.GetLevel >= 11 ) && ( player.GetLevel <= 15 )
set SpellRank to 3
elseif ( player.GetLevel >= 16 ) && (player.GetLevel <= 20)
set SpellRank to 4
elseif ( player.GetLevel >= 21 )
set SpellRank to 5
endif
 
if timer <= 4 && ready == 1 && SpellRank > 0
; check to make sure player is still in range
if getDistance player < 700
;Debug message
;message "Rank %.0f Freezy Spell", SpellRank, 10
if SpellRank == 1
cast StandardFrostDamageTarget1Novice player
elseif SpellRank == 2
cast StandardFrostDamageTarget2Apprentice player
elseif SpellRank == 3
cast StandardFrostDamageTarget3Journeyman player
elseif SpellRank == 4
cast StandardFrostDamageTarget4Expert player
elseif SpellRank == 5
cast StandardFrostDamageTarget5Master player
endif
endif
set ready to 0
endif
 
if timer > 0
set timer to timer - getSecondsPassed
endif
 
end

My modified version is:

scn AATestTrapStoneActor01SCRIPT
 
; come within range and this thing will shoot a fireball at you (range is 1400)
 
float timer
short ready
short disabled
short SpellRank
Ref Actor
 
begin onActivate
     
     Set Actor to GetActionRef
 
if disabled == 0
set disabled to 1
set timer to 0
else
set disabled to 0
endif
 
 
end
 
begin gameMode
 
if SpellRank == 0 && disabled == 0
 
if getDistance Actor < 1400 && timer <= 0
playgroup forward 0
set ready to 1
set timer to 8
 
;This section will choose the trap spell based on the PC's level... hopefully
if player.GetLevel <= 5
set SpellRank to 1
elseif ( player.GetLevel >= 6 ) && ( player.GetLevel <= 10 )
set SpellRank to 2
elseif ( player.GetLevel >= 11 ) && ( player.GetLevel <= 15 )
set SpellRank to 3
elseif ( player.GetLevel >= 16 ) && (player.GetLevel <= 20)
set SpellRank to 4
elseif ( player.GetLevel >= 21 )
set SpellRank to 5
endif
endif
endif
 
if timer <= 4 && ready == 1 && SpellRank > 0
; check to make sure player is still in range
if getDistance Actor < 1400
;Debug message
;message "Rank %.0f Freezy Spell", SpellRank, 10
if SpellRank == 1
cast StandardFrostDamageTarget1Novice Actor
elseif SpellRank == 2
cast StandardFrostDamageTarget2Apprentice Actor
elseif SpellRank == 3
cast StandardFrostDamageTarget3Journeyman Actor
elseif SpellRank == 4
cast StandardFrostDamageTarget4Expert Actor
elseif SpellRank == 5
cast StandardFrostDamageTarget5Master Actor
endif
set ready to 0
set spellrank to 0
 
endif
 
endif
 
if timer > 0
set timer to timer - getSecondsPassed
endif
 
end
 
begin onReset
 
reset3DState
set SpellRank to 0
 
end

For some reason, this does absolutely nothing; it doesn't fire at anyone or anything, or even play any animations. What do I need to do to get this thing to fire at every creature and/or NPC in range?
Link to comment
Share on other sites

  • Recently Browsing   0 members

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