Help with some scripts...

Post » Sat Oct 16, 2010 2:03 pm

Script 1:
This script is attached to a critical hit effect. When the weapon lands a critical hit, the enemy is supposed to stop fighting for 5 seconds unless he/she/it has 7 or more Intelligence. This is the current script:
scn PieceOfEdenCritEffectScriptfloat timerint Intelligenceint AggressionBegin ScriptEffectStart	set Intelligence to GetAV Intelligence	set Aggression to GetAV Aggression	if Intelligence < 7		SetAV Aggression 0	EndIf	if Intelligence < 7     	if timer < 5         		set timer to timer + getSecondsPassed		else			ShowMessage test			SetAV Aggression Aggression			set timer to 0		EndIf	EndIfEnd

For some reason, it doesn't work and the critical hit just does nothing (the Critical Damage is set to 0)...

Script 2:
I need a script that makes the weapon have 100% (or 95%, anyways the max possible percentage) accuracy in VATS from any distance... Any ideas how to do it?
User avatar
WYatt REed
 
Posts: 3409
Joined: Mon Jun 18, 2007 3:06 pm

Post » Sat Oct 16, 2010 9:17 am

Getting an NPC to stop fighting an enemy that it is supposed to be fighting, while really controlling the situation, can be a gigantic pain in the ass. Just changing the aggression will not tend to be enough to get what you want. In all honesty I'd angle this from a different approach, such as maybe, if the thing has the vulnerable INT level, apply the same effect as paralyzing palm but have it last for a shorter period. Something along those lines. Like - don't try to trick the AI into not fighting an enemy, really force the mob into temporary helplessness instead.

There's also the setrestrained function, which could do what you need, but for what you're describing the paralysis deal has its upsides. You pick, tho.

Edit: also - - - scripteffectstart isn't where you'd put a timer, that's a one-time-pass block.
User avatar
Samantha Pattison
 
Posts: 3407
Joined: Sat Oct 28, 2006 8:19 pm

Post » Sat Oct 16, 2010 7:21 am

Thanks, this my revised script(s):

This script is attached to the critical hit:
scn PieceOfEdenCritEffectScriptint IntelligenceBegin ScriptEffectStart	set Intelligence to GetAV Intelligence	if Intelligence < 7		player.AddPerk UWfUPPieceOfEdenPlaceholder	EndIfEnd


This script is attached to the weapon:
scn PieceOfEdenWeapScriptfloat timerref myselfBegin GameMode	set myself to GetSelf	If player.HasPerk UWfUPPieceOfEdenPlaceholder == 1     	if timer < 5			myself.SetRestrained 1     		set timer to timer + getSecondsPassed		else			ShowMessage test			myself.SetRestrained 0			set timer to 0			player.RemovePerk UWfUPPieceOfEdenPlaceholder		EndIf	EndIfEnd


The perk is just an empty perk. Does this look good? I'm off to try it.
User avatar
Joe Bonney
 
Posts: 3466
Joined: Tue Jul 17, 2007 12:00 pm

Post » Sat Oct 16, 2010 11:54 am

For some reason, it doesn't work and the critical hit just does nothing (the Critical Damage is set to 0)...

I know with Object Effects on weapons, the weapon must do at least 1 point of damage for the effect to be applied to the target. It's possible that Critical Effects might have a similar requirement. Do some tests with the weapon's Damage and/or Critical Damage set to at least 1 to see if your Critical Effect is actually fired. To make sure that possible problems in your effect script are not a factor, make the first line in the ScriptEffectStart block something like:
PrintC "ScriptEffecStart"

By the way, http://fose.silverlock.org/fose_command_doc.html#PrintToConsole (PrintC) is a FOSE function, invaluable for this sort of thing. It's worth running FOSE just for this purpose, even if you plan on making your mod non-FOSE-required - simply remove or comment out the PrintC lines before releasing it. You could even get fancy and do something like:
set rActor to GetSelfPrintC "ScriptEffecStart: affected actor = <%i> <%n>" rActor rActor


Getting an NPC to stop fighting an enemy that it is supposed to be fighting, while really controlling the situation, can be a gigantic pain in the ass. Just changing the aggression will not tend to be enough to get what you want. ...

That's definitely true, as I've learned from experience. When I was playing around with the http://www.youtube.com/watch?v=3En4r2XTb_E, I tried to use methods similar to those in http://www.fallout3nexus.com/downloads/file.php?id=3284, and while it worked, the results weren't really satisfactory as you can see from that video. I didn't exactly copy what was done in the Groovatron though, so maybe take a look in there yourself to see what you can learn.

But like Tarrant suggests, if you'd be happy doing something other than this, you'll likely save yourself a lot of trouble.


Script 2:
I need a script that makes the weapon have 100% (or 95%, anyways the max possible percentage) accuracy in VATS from any distance... Any ideas how to do it?

Use a hidden Perk for that. Look at the Commando, Gunslinger, and Sniper Perks for examples.
User avatar
Sammygirl500
 
Posts: 3511
Joined: Wed Jun 14, 2006 4:46 pm

Post » Sat Oct 16, 2010 1:35 am

Player.addperk? Are you sure?

I thought youd be doing something more like

cios MyTrappingActorEffect

meaning, it gets applied to the enemy, not the player?

You didnt mean to have the player become trapped when hit right? you meant the target?

I only mean the perk as an example of which actor effects to apply.
User avatar
Ana
 
Posts: 3445
Joined: Sat Jul 01, 2006 4:29 am

Post » Sat Oct 16, 2010 1:22 pm

Also, in the last script you posted:
set myself to GetSelf

myself will be set to the weapon. I don't think that's what you want...
User avatar
Rebecca Dosch
 
Posts: 3453
Joined: Thu Jan 18, 2007 6:39 pm

Post » Sat Oct 16, 2010 9:15 am

I know the problem is with the SetRestrained because the "test" message pops 5 seconds after the critical hit is landed. As for the VATS part, I did make a hidden perk that sets the Calculate to Hit Chance to 100%, but it doesn't take distance as a factor, so it's still really low at long distances...

EDIT: Pinball, just saw you message. How can I set myself to the target?
User avatar
Chloe Mayo
 
Posts: 3404
Joined: Wed Jun 21, 2006 11:59 pm

Post » Sat Oct 16, 2010 9:29 am

I know the problem is with the SetRestrained because the "test" message pops 5 seconds after the critical hit is landed. As for the VATS part, I did make a hidden perk that sets the Calculate to Hit Chance to 100%, but it doesn't take distance as a factor, so it's still really low at long distances...
In the "Calculate To Hit Chance" entry point, are you sure you're using "Set Value" and not "Multiply Value" or something else? If it's on "Set Value", I'd think that should work.

EDIT: The last revision of the http://geck.gamesas.com/index.php?title=Entry_Point&diff=13364&oldid=12607 on the GECK wiki (made in February 2009) adds a note that "Calculate To Hit Chance" was broken as of the 1.1.0035 patch. I have no idea if that's true, or if it is, if it was fixed in any of the four patches released since that page was updated.


EDIT: Pinball, just saw you message. How can I set myself to the target?
Just do things in the effect script like you were doing before. In effect scripts, the target is the implicit reference. You'd only need to do:
Begin ScriptEffectStart	SetRestrained 1End

I only used GetSelf above because I needed to pass the reference to PrintC.

EDIT: To help you out further, here's your timer to "un-restrain" the target after 5 seconds. Note the http://geck.gamesas.com/index.php/Category:Blocktypes:
Begin ScriptEffectUpdate     	if timer < 5         	set timer to timer + getSecondsPassed	else		SetRestrained 0	endifEnd

User avatar
Lillian Cawfield
 
Posts: 3387
Joined: Thu Nov 30, 2006 6:22 pm

Post » Sat Oct 16, 2010 9:27 am

OK, so the enemy now becomes restrained, bu he doesn't go back to normal. Here is the new script:
scn PieceOfEdenWeapScriptfloat timerBegin GameMode	If player.HasPerk UWfUPPieceOfEdenPlaceholder == 1     	if timer < 5			SetRestrained 1     		set timer to timer + getSecondsPassed		else			ShowMessage test			SetRestrained 0			set timer to 0			player.RemovePerk UWfUPPieceOfEdenPlaceholder		EndIf	EndIfEnd


EDIT: Just noticed you edit.

EDIT2: This is my new script, still not working (enemies not un-restraining):
scn PieceOfEdenWeapScriptfloat timerBegin GameMode	if player.HasPerk UWfUPPieceOfEdenPlaceholder == 1		SetRestrained 1	endifEndBegin ScriptEffectUpdate	if player.HasPerk UWfUPPieceOfEdenPlaceholder == 1 	    if timer < 5    	     	set timer to timer + getSecondsPassed		else			ShowMessage test			SetRestrained 0			set timer to 0			player.RemovePerk UWfUPPieceOfEdenPlaceholder		endif	endifEnd

Am I using the ScriptEffectUpdate block right?
User avatar
Alisia Lisha
 
Posts: 3480
Joined: Tue Dec 05, 2006 8:52 pm

Post » Sat Oct 16, 2010 12:46 pm

I believe that the http://cs.elderscrolls.com/constwiki/index.php/GameMode block in your script is just restraining the enemy over and over again. A DoOnce variable should fix that.

Edit: I shouldn't have posted since I don't know much about scripted effects. :blush:
Please excuse my post.
User avatar
loste juliana
 
Posts: 3417
Joined: Sun Mar 18, 2007 7:37 pm

Post » Sat Oct 16, 2010 2:45 pm

...
Am I using the ScriptEffectUpdate block right?

No, you need to go back to simply doing everything in an Effect Script like you were before. Here is the entire script you can use for your Critical Effect:

ScriptName PieceOfEdenCritEffectScriptfloat timerBegin ScriptEffectStart	SetRestrained 1EndBegin ScriptEffectUpdate     	if timer < 5         	set timer to timer + getSecondsPassed	else		SetRestrained 0	endifEnd

There's no need for any new script on the weapon (Object Script), and in general you don't want to use a GameMode block in an Effect Script.

If you want it to be dependent on the player having that perk, you can still wrap things in those condition checks like you did, but I don't understand why you're removing the perk afterward - unless your intention is for this to be one-time use only.

Hmm... I forgot to think about effect duration here. To use the script above, you'd need to give your effect a duration of more than 5 seconds (and to be tidy, you should also throw a http://geck.gamesas.com/index.php/Dispel command after "SetRestrained 0"). But this is all making it more complicated than it needs to be anyway. Just set the effect duration to 5 seconds (on the http://geck.gamesas.com/index.php/Effect_Item form in your http://geck.gamesas.com/index.php/Actor_Effect), and use this for the effect script instead:

ScriptName PieceOfEdenCritEffectScriptBegin ScriptEffectStart	SetRestrained 1EndBegin ScriptEffectFinish	SetRestrained 0End

No reason to code a timer for a duration effect. You can do the http://geck.gamesas.com/index.php/HasPerk condition check in the Effect Item form too.
User avatar
Music Show
 
Posts: 3512
Joined: Sun Sep 09, 2007 10:53 am

Post » Sat Oct 16, 2010 2:23 am

It worked (!), but there is a bug. If the enemy is restrained and an attack is supposed to finish him off, he won't die but the exp will be given. This can be used to earn unlimited exp. Any ideas for a workaround?
User avatar
Isaac Saetern
 
Posts: 3432
Joined: Mon Jun 25, 2007 6:46 pm

Post » Sat Oct 16, 2010 4:17 am

Wow, that's... interesting. Add another condition on the Effect Item form, for http://geck.gamesas.com/index.php/GetDead == 0. That seems to take care of it.
User avatar
lolly13
 
Posts: 3349
Joined: Tue Jul 25, 2006 11:36 am

Post » Sat Oct 16, 2010 7:29 am

Thanks, it works perfectly now :) Any ideas about the VATS problem?
User avatar
Nathan Hunter
 
Posts: 3464
Joined: Sun Apr 29, 2007 9:58 am


Return to Fallout 3