Jump to content
Omny87

Need Help With Scripting A Skeletonizing Mod!

Recommended Posts

Quote

So you can easily put ; in front of some lines of the script to narrow down the problem.

Sheesh; can't believe I forgot that. Thanks!

 

Quote

Now the first important question is: was the event firing 4 times since the begin? because if it was then you would have probably noticed it, but you never mentioned it.

So I disabled all but "the event fired" line with semicolons. When I killed someone and looked at the console, "the event fired" was indeed listed four times. Still not sure why. I tried it with different weapons too; still the same effect.

 

Quote

And second, the timer doesn't work on a function which is executed in a single frame, it can't calculate the time since it leasts 0.02 seconds

Really? I thought the laser glow/disintegration effects last just shy of 2 seconds. At least it seems that way according to the effect shader windows, as well as the vanilla disintegration script. Guess I'm reading it wrong?

 

EDIT: Found the culprit for the multiple event fired line: it was the quest script that I have the skeletonizer scripts attached to. This is how I wrote it:

 

ScriptName OMNYSkellyQuestScript

Begin GameMode

    If GetGameLoaded

    SetJohnnyOnDyingEventHandler 1 OMNYLaserSkeletonizerScript 0
    SetJohnnyOnDyingEventHandler 1 OMNYPlasmaSkeletonizerScript 0
    SetJohnnyOnDyingEventHandler 1 OMNYCharredSkeletonizerScript 0
    SetJohnnyOnDyingEventHandler 1 OMNYShockSkeletonizerScript 0

    endif

end

I disabled all but the laser script with semicolons, and sure enough, the "the event fired" only showed up once.

 

I'd rather not have all four scripts happen at once; I feel like that might cause problems.

Share this post


Link to post
4 hours ago, Omny87 said:

Really? I thought the laser glow/disintegration effects last just shy of 2 seconds. At least it seems that way according to the effect shader windows, as well as the vanilla disintegration script. Guess I'm reading it wrong?

 

 

The effect, not the script. The script leasts 1 frame, so 1 sec / framerate, so it can't count 2 seconds or whatever value you want on a timer. You must use something that leasts some time, i.e. a gamemode on a quest, or a spell, something that allows to count the time you need

Share this post


Link to post

I don't know why they chose it, but it makes sense to me, the fact that an event is istantaneous. It's perfectly in line with the rest of scripting, with how it works.

Share this post


Link to post
3 hours ago, Omny87 said:

No I mean, how would I do that?

Well... you could create your own custom spell (check LaserDisintegrationEffect and LaserDisintegrationFXSpell to copy them), then you will attach your own script (in the same way that LaserDisintegrationEffectScript is attached to it), then inside that script you'll be able to put your timer inside a block that leasts some time (i.e. the ScriptEffectUpdate). Then, inside your event handler, you'll call your new spell with the CIOS command. Hopefully it'll cast the spell on the actor even if he's dead, let's see. Take a look at the duration of the spell (i.e. the laser effect leasts 4 seconds), because that's the max value that the timer will be able to handle.

Share this post


Link to post

I actually did go ahead and tried to design my own effect shader to replace the vanilla disintegration effect I was using before. I was messing around with settings all afternoon and I almost got what I wanted, but I can't seem to replicate it again. Should have written it down or something :(

 

I'll try your advice as well; thanks!

Share this post


Link to post

Well, after taking a few days to step back I'm back to working on this, and I've looked into your advice- I'm not entirely sure how to implement them though?

 

Like, I made my own Actor/Base effects (OMNYLaserSkellyFXSpell, and OMNYLaserSkellyBaseEffect respectively) and I've connected the two together like the vanilla laser effects, but I can't seem to get them to play with my script?

 

Here's what I got:

 

Actor effect: OMNYLaserSkellyFXSpell (exactly like the LaserDisintegrationFXSpell, but with my custom base effect below)

 

Base Effect: OMNYLaserSkellyBaseEffect (exactly like the LaserDisintegrationEffect, but attached to my laser skeletonizer script)

 

And here's my latest script:

 

scn OMNYLaserSkeletonizerScript

Float Timer
ref rActor
ref rKiller

begin Function {rActor}

	Print "The event fired"
	set rKiller to rActor.GetKiller

	if rKiller.IsWeaponInList OMNYListOfLasers
		Print "the killer's weapon is eligible"
			if (rActor.GetIsCreature == 0) && (rActor != PlayerRef)
				Print "the victim is eligible"
				rActor.PMS LaserCritGlowFXShader
				rActor.CIOS OMNYLaserSkellyFXSpell
				rActor.additem OMNYLaserSkellySuit 1
				Set Timer to 1.8
					If Timer <= 0.5
						rActor.equipitem OMNYLaserSkellySuit 1
					Endif
			EndIf
	endif
	Print "welcome to the bone zone"
		
end

But in-game, all that happens is the laser crit glow and the sizzling noise (which is new and exactly what I wanted, granted), but no disintegration effects, no sparks, and no skeletons!

 

I am so goddamn frustrated by all this I'm on the verge of just giving up.

 

 

 

Share this post


Link to post

A timer is something like this:

 

if fTimer < somevalue

   Set fTimer to fTimer +GetSecondsPassed

else

   ; The time has passed, do something

endif

 

A timer must be placed inside a script which executes continuously, so that everytime it executes it will sum GetSecondsPassed, which is the gap from the previous execution.

Share this post


Link to post

So I tried adding in a timer like this:

 

scn OMNYLaserSkeletonizerScript

Float Timer
ref rActor
ref rKiller

begin Function {rActor}

	Print "The event fired"
	set rKiller to rActor.GetKiller

	if Timer < 4
		Set Timer to Timer + GetSecondsPassed
		else 
		set Timer to 0
	Endif


	if rKiller.IsWeaponInList OMNYListOfLasers
		Print "the killer's weapon is eligible"
			if (rActor.GetIsCreature == 0) && (rActor != PlayerRef)
				Print "the victim is eligible"
				rActor.PMS LaserCritGlowFXShader
				rActor.PMS OMNYLaserSkellyEffect
				rActor.additem OMNYLaserSkellySuit 1
					if (GetSecondsPassed <= 2.0) && (rActor.GetDead == 1)
						rActor.equipitem OMNYLaserSkellySuit 1
						rActor.SMS LaserCritGlowFXShader
						rActor.SMS OMNYLaserSkellyEffect
					Endif
			EndIf
	endif
	Print "welcome to the bone zone"
		
end

But it still doesn't change anything.

 

My goal is to make it so that once they get killed via an energy weapon they:

 

1- get covered with the glowing/sparking disintegration effect

2- turn into a skeleton about 1 second later while still glowing

3- have the glowing fade away to reveal the skeleton.

 

Right now they turn into skeletons instantly upon death. I'm trying to use the timer to delay the skeleton effect, to make the disintegration look a bit more "realistic". But thus far all my attempts are fruitless. Here's a video recording I made of what I got so far.

 

Here's what my custom Effect Shader looks like in GECK:

 

image.png.36c1e4a8009d5d9ca6c6b77e2a73d3b6.png

 

Share this post


Link to post

Because the logic behind the script is not correct. Here how the game reads it:

- is timer <4? yes it is, so add GetSecondsPassed. It's the first time the script runs, so it probably will be still 0.

- is (all the other conditions to change it in skeleton?) yes, then change it to skeleton.

period.

You're declaring it as Function{rActor}, so I guess it's still the event handler we were talking on the other page of comments. As I said that event handler runs on a single frame, when the enemy dies, so that timer will never increase.

A correct logic would be using the event handler to cast a spell to the enemy, with the CIOS command. That spell will least some time, and in a script attached to the spell you'll put the timer. The only thing to test in this case will be if the spell casted on the dead body, will still execute even if he's dead, I don't remember.

Share this post


Link to post

So I should probably have a separate script for the actual "spell" and have this script be the one applying the spell on death?

Share this post


Link to post
4 hours ago, Omny87 said:

So I should probably have a separate script for the actual "spell" and have this script be the one applying the spell on death?

Exactly. That's what I was meaning here:

Quote

Well... you could create your own custom spell (check LaserDisintegrationEffect and LaserDisintegrationFXSpell to copy them), then you will attach your own script (in the same way that LaserDisintegrationEffectScript is attached to it), then inside that script you'll be able to put your timer inside a block that leasts some time (i.e. the ScriptEffectUpdate). Then, inside your event handler, you'll call your new spell with the CIOS command. Hopefully it'll cast the spell on the actor even if he's dead, let's see. Take a look at the duration of the spell (i.e. the laser effect leasts 4 seconds), because that's the max value that the timer will be able to handle.

but it was explained quite bad, glad we understood. The only thing I don't know is if the spell will actually be casted on a dead actor, I don't remember, it needs to be tested.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...