Still trying to figure out a way to get a shrinking spell to

Post » Wed Jun 20, 2012 2:16 am

Since SetScale(int akScale) doesn't affect the resized objects' collision data (a giant chicken or tiny dragon using this is still considered to be "really" it's original size) - would it work to make a copy of, say, the player's model, and apply it to a shrunken or enlarged version of his race, and have it look the same?

For example, make a race for each existing race called "*_MiniMe" and "*_GiantMe"that is basically a Scaled version of the full sized race, and then change the players' race to Breton_Minime if he or she is a Breton getting shrunk, Altmer_Giantme if an Altmer getting grown, and so on...?
User avatar
JeSsy ArEllano
 
Posts: 3369
Joined: Fri Oct 20, 2006 10:51 am

Post » Tue Jun 19, 2012 5:50 pm

Changing race does seem to update the collision data for an actor, although it's worth mentioning that this approach has the obvious drawback that it would not work for creatures or custom races.

Cipscis
User avatar
Chavala
 
Posts: 3355
Joined: Sun Jun 25, 2006 5:28 am

Post » Wed Jun 20, 2012 12:41 am

Changing race does seem to update the collision data for an actor, although it's worth mentioning that this approach has the obvious drawback that it would not work for creatures or custom races.

Cipscis

Not to mention not being able to animate the transformation...apparently something has been changed in the SetScale funtion recently too...I can no longer resize the player like i used to be able to (even though it used to CTD...and it STILL will CTD when I try it) - sometime in the last week, attempting to SetScale on the player tends to "Snap Back" to the original size a lot.

(edit) OK, wierd...now it is working again, but it teleports me up into the sky a lot. Great...new problems...heh
User avatar
Johnny
 
Posts: 3390
Joined: Fri Jul 06, 2007 11:32 am

Post » Wed Jun 20, 2012 5:05 am

Really? Is that only for set scale called in scripts? With the console command the collision for, well, at least chickens sizes with the mesh.
User avatar
Jeneene Hunte
 
Posts: 3478
Joined: Mon Sep 11, 2006 3:18 pm

Post » Tue Jun 19, 2012 4:09 pm

You can try it out...beware! This will CTD or lock your computer completely about 25% of the time, and teleport you into the sky another 25% (The Oops Xmarker is . This is meant to be a fire and forget script archetype spell on the caster. Scale is set as a property to whatever size you want it to go to (I've been using 0.5 for shrinking, and 2.0 for growing)

Spoiler
Scriptname SizeChanger extends activemagiceffect  import Gameimport UtilityEvent OnEffectStart(Actor Target,Actor Caster)	ObjectReference ChangeThis = Target	float Size = ChangeThis.GetScale()	float FinalSize = Size * Scale	float Step = (FinalSize - Size)/100	ObjectReference Oops = ChangeThis.PlaceAtme(PanicButtonMarker,1,false,false)	int Count = 1	while Count <= 100		ChangeThis.SetScale(Size+(Step*Count))		Count += 1	endwhile	if ChangeThis.GetDistance(Oops) > 1000.0 ; Been teleported into the sky		ChangeThis.MoveTo(Oops)	endif	Oops.Delete()	ChangeThis.SetScale(FinalSize) ; For testing - just go to final size, since calling it multiple times can crash Skyrim.EndEventEvent OnEffectFinish(Actor Target,Actor Caster)	ObjectReference ChangeThis = Target	float Size = ChangeThis.GetScale()	float FinalSize = Size * (1/Scale)	float Step = (FinalSize -Size)/100	ObjectReference Oops = ChangeThis.PlaceAtme(PanicButtonMarker,1,false,false)	int Count = 1	while Count <= 100		ChangeThis.SetScale(Size+(Step*Count))		Count += 1		Wait(0.25)	endwhile	if ChangeThis.GetDistance(Oops) > 1000.0 ; Been teleported into the sky		ChangeThis.MoveTo(Oops)	endif	Oops.Delete()	ChangeThis.SetScale(FinalSize) ; Be sure of final size accuracy.EndEventactivator property PanicButtonMarker autoFloat Property scale  Auto  

Try growing to double size then walk through the low archways in Whiterun...they will pass through your "waist" when you should be blocked by them.
User avatar
JaNnatul Naimah
 
Posts: 3455
Joined: Fri Jun 23, 2006 8:33 am

Post » Wed Jun 20, 2012 4:30 am

"Shrink" and "Enlarge" spells are the first scripts I wrote when I got the Creation Kit. I didn't do anything to solve the collision issues though; my "enlarged" actors tend to lose their hands/feet in the floor :-)

I'll share my script when I'm back at the home PC - it's very similar to Redwood Elf's example above in that I have a "Step" value and I slowly ease the scale up/down towards a max/min value so that it looks animated. I never once had this crash on me - I hope it isn't crashing for other people using the mod in which I distributed it ("Museum Curiosities" in the Steam workshop).
User avatar
Nienna garcia
 
Posts: 3407
Joined: Wed Apr 25, 2007 3:23 am

Post » Tue Jun 19, 2012 11:39 pm

The SetScale command is actually quite hysterical.
The collision detection is not scaled and when you go to 1st person view it's as if you are still normal size, but the NPCs will stare up at you like you are a giant when viewed in 3rd person.
Makes for some interesting screenshots. lol
User avatar
Sophie Morrell
 
Posts: 3364
Joined: Sat Aug 12, 2006 11:13 am

Post » Tue Jun 19, 2012 7:12 pm

Hmm.... something must be amiss then, because if you try setting a chicken to 10 in game, his collision and hit box both scale up with him. They're far from 'well formed' on the mesh, but they're there.....
User avatar
BlackaneseB
 
Posts: 3431
Joined: Sat Sep 23, 2006 1:21 am

Post » Wed Jun 20, 2012 4:41 am

Hmm.... something must be amiss then, because if you try setting a chicken to 10 in game, his collision and hit box both scale up with him. They're far from 'well formed' on the mesh, but they're there.....

"Something is amiss" pretty much describes it. Part of the first quest I want to do involves shrinking down to skeever size in order to chase a skeever down its rathole to recover someting it took. However, due to the "Setscale doesn't shrink the players' collision box" problem, it doesn't work.
User avatar
Harry-James Payne
 
Posts: 3464
Joined: Wed May 09, 2007 6:58 am

Post » Tue Jun 19, 2012 7:55 pm

Maybe becuaue a chicken has no body part data?
User avatar
Bonnie Clyde
 
Posts: 3409
Joined: Thu Jun 22, 2006 10:02 pm

Post » Tue Jun 19, 2012 9:06 pm

I said I'd share my shrink/enlarge script, so here it is. I put this on a "fire and forget" - "aim" spell, so I've never tried it on the player character.

Spoiler

Scriptname MyChangeScaleScript extends ActiveMagicEffect{Make target of spell grow up to X it's base size, getting Y% larger per cast.}Import Utilityfloat Property TargetScale Auto{The scale towards which the target should grow (e.g. 1.5 is 50% base size)}float Property GrowthPerEffect Auto{The amount of size change per effect, negative value causes shrinking (e.g. if .2, a target with scale .5 grows to .6 (.2 * .5 = .1 increase)} Event OnEffectStart(Actor akTarget, Actor akCaster) float currentScale = akTarget.GetScale()float nextScale = currentScale + currentScale * GrowthPerEffectfloat loopScale = currentScalefloat changePerLoop = 0.003int numberOfLoops = 0; figure out if scale is already being effectedWait(0.2)float changedScale = akTarget.GetScale()if currentScale == changedScale  if (GrowthPerEffect > 0)   if nextScale > TargetScale	nextScale = TargetScale   EndIf   numberOfLoops = Math.Floor(Math.abs(currentScale - nextScale)/changePerLoop)   Debug.Trace("Entering Grow...currentScale=" + currentScale + ", nextScale=" + nextScale, 2)   While numberOfLoops > 0	loopScale+=changePerLoop	akTarget.SetScale(loopScale)	numberOfLoops-=1     EndWhile  Else   if nextScale < TargetScale	nextScale = TargetScale   EndIf   numberOfLoops = Math.Floor(Math.abs(currentScale - nextScale)/changePerLoop)   ;Debug.Trace("Entering Shrink...currentScale=" + currentScale + ", nextScale=" + nextScale, 2)   While numberOfLoops > 0	loopScale-=changePerLoop	akTarget.SetScale(loopScale)	numberOfLoops-=1   EndWhile  EndIf  if currentScale == akTarget.GetScale()   Debug.Notification("This spell isn't powerful enough to change the target's size")  Else   ;Debug.Trace("Exiting Grow/Shrink...currentScale=" + akTarget.GetScale(), 2)  EndIf  Else  Debug.Notification("The target is already undergoing a size change!")EndIf EndEvent

I haven't tried it on chickens, but I can confirm that spiders, skeevers, and "human" actors will not collision detect properly. It is, nevertheless, a lot of fun to play with.
User avatar
matt oneil
 
Posts: 3383
Joined: Tue Oct 09, 2007 12:54 am


Return to V - Skyrim