Jump to content

Magic Effects without a set duration


lordbevan1

Recommended Posts

  • 1 month later...

This is possible through scripting. It could look something like this.

 

Your ring would have a script

If ( OnPCEquip == 1 ) ;This means the Player equipped it
  StartScript MyRandomSanctuarySpellScript
Endif

And then the other script

Begin MyRandomSanctuarySpellScript

Short RandomValue
Short DoOnce

Float TimePassed

If ( DoOnce == 0 )
  Set RandomValue to Random, 121 ;This sets a value between 1 and 120
  Set DoOnce to 1
Endif

Set TimePassed to ( TimePassed + GetSecondsPassed ) ;This constantly keeps time

If ( Player->GetSpell "my_sanctuary_spell" == 0 )
  Player->AddSpell "my_sanctuary_spell"
Endif

If ( TimePassed > RandomValue ) ;The random time limit has been reached
  If ( Player->GetSpell "my_sanctuary_spell" == 1 )
    Player->RemoveSpell "my_sanctuary_spell"
    Set DoOnce to 0
    StopScript MyRandomSanctuarySpellScript
  Endif
Endif
  
If ( Player->HasItemEquipped "my_sanctuary_ring" == 0 ) ;Player took the ring off
  Player->RemoveSpell "my_sanctuary_spell"
  Set DoOnce to 0
  StopScript MyRandomSanctuarySpellScript
Endif

End
Edited by RacerPlume
Link to comment
Share on other sites

  • 1 month later...

begin sanctuary1_120Script

short state
float timer

if ( MenuMode )
return
endif

if ( state )
if ( timer > 0 )
set timer to ( timer - GetSecondsPassed )
return
endif
set state to 0
player->RemoveSpell "lb1Sanctuary120"
player->RemoveSpellEffects "lb1Sanctuary120"
endif

if ( player->GetSpellEffects "lb1Sanctuary120" )
set state to 1
set timer to Random 1000 ; 0 <= timer <= 999
set timer to ( timer * 0.120 ) ; 0 <= timer <= 119
set timer to ( timer + 1 ) ; 1 <= timer <= 120
endif

end
Edited by abot
Link to comment
Share on other sites

  • Recently Browsing   0 members

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