New To Scripting - Will This Work?

Post » Wed Sep 22, 2010 4:01 am

Will this script work (using FOSE):

scn TheGordonCritEffeckScriptBegin GameMode	if IsSneaking == 1		player.SetWeaponCritEffect NONE WeapUniqueTheGordon	else		player.SetWeaponCritEffect MS13HeadExplodeSpell WeapUniqueTheGordon	endifEnd


I want that a weapon (WeapUniqueTheGordon) will cause a head explosion on a critical hit (essentialy a 1HKO), but only when out of Sneak Mode (for balance reasons). Will this work?
User avatar
Maeva
 
Posts: 3349
Joined: Mon Mar 26, 2007 11:27 pm

Post » Wed Sep 22, 2010 4:42 am

Bump... This is really important for my mod...
User avatar
Ashley Hill
 
Posts: 3516
Joined: Tue Jul 04, 2006 5:27 am

Post » Wed Sep 22, 2010 6:38 am

Did you just try it ingame? Often thats the easiest way to tell if it works when nobody can help you. I think that should work. The only thing is that it runs every frame, setting and resetting the crit effect, which just wastes processing power, but not much. You may want to, at a later time, redo this to optimize it, to only run when you change state, or first equip the gun.
User avatar
Jack
 
Posts: 3483
Joined: Sat Oct 20, 2007 8:08 am

Post » Wed Sep 22, 2010 2:54 am

I just wasn't sure about the SetWeaponCritEffect syntax. I'll try ASAP!
User avatar
brenden casey
 
Posts: 3400
Joined: Mon Sep 17, 2007 9:58 pm

Post » Wed Sep 22, 2010 11:44 am

I don't think you will be able to use 'none' as a criticle effect. But you could make a criticle effect called 'none' that is just a blank script or the like to fake it.
User avatar
Laura Mclean
 
Posts: 3471
Joined: Mon Oct 30, 2006 12:15 pm

Post » Wed Sep 22, 2010 9:45 am

Never mind I had the syntax wrong.
User avatar
Motionsharp
 
Posts: 3437
Joined: Sun Aug 06, 2006 1:33 am

Post » Tue Sep 21, 2010 10:28 pm

@pkleiss
I noticed that. Currently I'm using the Victory Rifle's effect as a placeholder.
User avatar
Strawberry
 
Posts: 3446
Joined: Thu Jul 05, 2007 11:08 am

Post » Wed Sep 22, 2010 4:29 am

Got it working. Simple code:

scn TheGordonCritEffeckScriptBegin GameMode	if player.IsSneaking == 1		player.SetWeaponCritEffect null WeapUniqueTheGordon	else		player.SetWeaponCritEffect MS13HeadExplodeSpell WeapUniqueTheGordon	endifEnd


null is a blank effect I made.
User avatar
Deon Knight
 
Posts: 3363
Joined: Thu Sep 13, 2007 1:44 am

Post » Wed Sep 22, 2010 12:42 pm

Couple things come to mind.

First if this is an effect script, you really want to stick to the three real effect script blocks. Gamemode isn't quite right.

If its a block of code you want to run just once, you put it in

begin scripteffectstart


Second thing is, IF this is REALLY a gamemode block being used in an effect script, you must build code to limit it to run once, because it'll run like 3 times. Like:

scn TheGordonCritEffeckScriptshort doonceBegin GameModeif doonce == 0     set doonce to 1	if IsSneaking == 1		player.SetWeaponCritEffect NONE WeapUniqueTheGordon	else		player.SetWeaponCritEffect MS13HeadExplodeSpell WeapUniqueTheGordon	endifendifend


You can also make a scripteffectupdate block have a one-time-run block embedded in it this way.

Even if you set NO DURATION on an effect, gamemode and scripteffectupdate blocks still get a couple of iterations in. The one that always runs once, cleanly, for me, is scripteffectstart.
User avatar
SaVino GοΜ
 
Posts: 3360
Joined: Mon Sep 17, 2007 8:00 pm


Return to Fallout 3