Jump to content

I Can't Write Script Worth Beans


OneTrueForky

Recommended Posts

I've always been able to make some cool effects, dungeons, lights, weapons, etc. But there's a mod I'm making, and in a room, there's a healing pool, something similar to a hot spring, steam, warm water, all of that fun stuff.

 

Here's the problem; I have NO idea how to code that. I've looked for tutorials on how to apply a healing script to static objects (I was thinking of using the KillBox as a base, with, of course, the "KillScript" removed, as I don't want the player to die when entering something that's supposed to heal them), and I have yet to find any. If anybody can point me in the right direction, that'd be superb, and if you want to write the code for me, hey, that's up to you, and I'll make sure to mention you.

 

Basically, the idea for the script I want:

 

Heals Health, Fatigue, and Magicka 30 points every 10 seconds, so in 60 seconds, a total of 1800 points of the three will be given to the player, but not exceeding the maximum the player can have (i.e., if the player has 250 health max, then it just stops at 250, no matter how long the player stays in the pool).

 

I thank anybody who helps, and I hope all of you have Happy Holidays.

 

And I did try a script, and it's ugly.

 

scn ForkysHealingRoomScript

; when activated will shoot a healing spell at player after 3 sec... Hopefully

float timer
short ready
ref mySelf
ref myParent
short next
short SpellRank

begin onActivate
	
if isActionRef player == 0 && timer <= 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 Forkyshealingspell", SpellRank, 10
		if SpellRank == 1
			cast StandardShockDamageTarget1Novice player
		elseif SpellRank == 2
			cast StandardShockDamageTarget2Apprentice player
		elseif SpellRank == 3
			cast StandardShockDamageTarget3Journeyman player
		elseif SpellRank == 4
			cast StandardShockDamageTarget4Expert player
		elseif SpellRank == 5
			cast StandardShockDamageTarget5Master player
		endif
	endif
	set ready to 0
endif

if timer > 0
	set timer to timer - getSecondsPassed
endif

end

 

It's basically a rip of the Red Welkynd Stones' spells, since they're traps that track the player within a certain range. If there's a way to modify this so it could actually work, then that wouldn't be bad, seeing as how I'm going to have inert ones anyways, so why not have them heal the player instead?

 

-OneTrueForky

Link to comment
Share on other sites

Would it be a possibility for you to put a triggerbox inside the pool, and have a spell that heals them x amount of points while they are in it (10 points per second? A total of 600 after 60 seconds.) I know how to do that, since that is a simple ability added to the player while they are in the triggerbox, and removed after they leave the box. It requires 2 trigger boxes; one inside it to give the ability, and 1+ at where the player can leave to remove it. The 1+ part is just one box and script, placed more than once. That is only if necessary. These are the scripts:

 

scn HealingPondTrigger01

;this script adds the ability to the player

Begin OnTrigger

Player.AddSpell HealingPondAb
end

 

scn HealingPondTrigger02

;this script removes the ability from the player

Begin OnTrigger

Player.RemoveSpell HealingPondAb
end

 

I understand you want it on a timer, but this is a possible solution, although it only amounts to 600 points a minute instead of 1800. I have done maybe one timer, last year, so I've forgotten completely how to do one :P

 

EDIT: If you want it to stop when they reach full stats, add short PlayerHealth, short PlayerFatigue, and short Player.Magicka to the top of the script, then add this part after the Player.AddSpell HealingPondAb to the first script:

 

Set PlayerHealth to Player.GetBaseAV Health
Set PlayerFatigue to Player.GetBaseAV Fatigue
Set PlayerMagicka to Player.GetBaseAV Magicka
if Player.GetAV Health == PlayerHealth && Player.GetAV Fatigue == PlayerFatigue && Player.GetAV Magicka == PlayerMagicka
Player.RemoveSpell HealingPondAb

 

That should, in theory, remove the spell when all three are fully restored.

Edited by Guest
Link to comment
Share on other sites

Would it be a possibility for you to put a triggerbox inside the pool, and have a spell that heals them x amount of points while they are in it (10 points per second? A total of 600 after 60 seconds.) I know how to do that, since that is a simple ability added to the player while they are in the triggerbox, and removed after they leave the box. It requires 2 trigger boxes; one inside it to give the ability, and 1+ at where the player can leave to remove it. The 1+ part is just one box and script, placed more than once. That is only if necessary. These are the scripts:

 

That should, in theory, remove the spell when all three are fully restored.

 

Gotta love the fact that I can't do math. It's Christmas Eve, and I am tired :P

 

So how would I go about adding a trigger? I mainly do aesthetics, so all the technical stuff baffles me. I've made a companion and that only required two-four lines of script. Hahaha thanks for those, I'll try them out, see if I can't figure out how to apply a trigger.

 

-OneTrueForky

 

P.S. I removed the scripts to save space :P

Link to comment
Share on other sites

You should be able to go into the Activators section of the CS, and then click on any Activator (not double click; that will open up editing) and then just type really fast on your keyboard t-r-i-g. The letters, I mean. It should show TrigBox, TriggerBox, or something similar with numbers. Go into your cell if you made one, or make a new one (this would be a better, to have a blank cell) and drag in the triggerboxes until you find one of the thick boxes, and one of the thin rectangles. Change the ID's of them to something else, like HealingPondTrig01 and HealingPondTrig02. Then add the scripts, the first one to the thick one, the second to the thinner ones. Then put the thick one over the pond, and then the thin ones around where you want the ability removed (like doorways that don't have a load door.)

 

EDIT: Don't worry, I'm tired too :P I've gone to 2 parties today :D (One with my parents and their friends, which I got bored at after two hours, and left to go to one with my friends.)

Edited by Guest
Link to comment
Share on other sites

Would it be a possibility for you to put a triggerbox inside the pool, and have a spell that heals them x amount of points while they are in it (10 points per second? A total of 600 after 60 seconds.) I know how to do that, since that is a simple ability added to the player while they are in the triggerbox, and removed after they leave the box. It requires 2 trigger boxes; one inside it to give the ability, and 1+ at where the player can leave to remove it. The 1+ part is just one box and script, placed more than once. That is only if necessary. These are the scripts:

 

scn HealingPondTrigger01

;this script adds the ability to the player

Begin OnTrigger

Player.AddSpell HealingPondAb
end

 

I understand you want it on a timer, but this is a possible solution, although it only amounts to 600 points a minute instead of 1800. I have done maybe one timer, last year, so I've forgotten completely how to do one :P

 

EDIT: If you want it to stop when they reach full stats, add short PlayerHealth, short PlayerFatigue, and short Player.Magicka to the top of the script, then add this part after the Player.AddSpell HealingPondAb to the first script:

 

Set PlayerHealth to Player.GetBaseAV Health
Set PlayerFatigue to Player.GetBaseAV Fatigue
Set PlayerMagicka to Player.GetBaseAV Magicka
if Player.GetAV Health == PlayerHealth && Player.GetAV Fatigue == PlayerFatigue && Player.GetAV Magicka == PlayerMagicka
Player.RemoveSpell HealingPondAb

 

That should, in theory, remove the spell when all three are fully restored.

 

So it SHOULD look like this if I added the shorts, right?

 

scn HealingPondTrigger01

short PlayerHealth
short PlayerFatigue
short Player.Magicka

;this script adds the ability to the player

Begin OnTrigger

Player.AddSpell HealingPondAb
end

 

And thanks for helping, by the way, thou shalt be credited, seeing as how you assisted me with this code :P

 

-OneTrueForky

Link to comment
Share on other sites

  • Recently Browsing   0 members

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