Jump to content

ANOTHER scripting issue


Geeves83

Recommended Posts

Ok, so I'm trying to apply a fatigue damage effect to most explosions.

Bare with me here; I have done up a script, attached the script to a base effect, then referenced the base effect in a weapon object effect, which I then attached to an explosion (which is attached to a projectile, which is attached to a new ammo type I created....<whew>). I know this sounds kind of convoluted, but I wanted to use a script to put a formula into effect, rather than just a flat fatigue damage rate.

 

Anyway, here's the script;

 

-----------------------------

scn aaaExplosiveFatigueMedScript

 

ref myself

short FatigueDam

 

Begin ScriptEffectStart

 

set myself to GetSelf

Set FatigueDam to 20000

myself.damageav Fatigue FatigueDam

End

---------------------------

 

This is a simplified version of the script for testing, basically a script that is easy to tell if it's working or not. Anyway, the strange thing is that it DOES work (and did work even when I had a bunch of other conditions and equations in there), but it only works on some people. Or rather, it DOESN'T work on some people. For example, right now I'm testing on a legion patrol of 4 wandering around....and two of them it works on; they drop like flies, unconscious, first shot. But the other two, no matter how many times I hit them (the explosion damage is turned way down for testing), they are unaffected. I know that they have fairly normal fatigue ratings and are capable of being knocked out because I tested them with console commands, so I have no idea what's up. Does anyone else have any ideas? Like I said, this is simplified until I can get it working reliably, but the ultimate goal and what I had kind-of working before is a script that if the actor hit doesn't have the stonewall perk, they get hit with a flat rate of fatigue damage minus their damage threshold (with a possible multiplier) and a multiplier based on their endurance. As well, if the fatigue damage dealt is more than half their current fatigue level, they at least get knocked down. I also toyed around with the isdetected and isincombat conditions for the user of the weapon and the target, respectively, to apply extra fatigue if the targets where caught unaware, but I couldn't get that working at all.

 

Anyway, that's the plan, but I'd like to figure out what's going on with this first. Any help would be greatly appreciated. :)

Link to comment
Share on other sites

Huh....well, I tried your simplified version Ez0n3 and it works like a charm. It only starts to run into trouble when I use 'ref myself' and 'short fatiguedam'. Unfortunately as far as I know, in order to do some of the things I want to do I'm going to have to use them in my script. Here, I'll put the script as I originally had it up. Maybe someone'll see something I don't ... I've still much to learn when it comes to scripting. The GECK sure isn't making it easy, though....what with the lack of compiling error message.

 

-------------------------------------------------------------

scn aaaExplosiveFatigueHighScript

 

ref myself

short FatigueDam

 

Begin ScriptEffectStart

 

If myself.hasperk Stonewall != 1

set myself to GetSelf

Set FatigueDam to 600 -((myself.GetAV Endurance *5) +(myself.GetAV DamageThreshold *2))

myself.damageav Fatigue FatigueDam

if FatigueDam >= (myself.GetAV Fatigue) /2

player.pushactoraway myself 5

endif

Else

ShowMessage StonewallMessage

EndIf

 

End

----------------------------------------------

 

There it is. It could be a huge mess for all I know, but it's compiling, so that's a start. Also, for future reference (because I have a feeling I may be doing this a lot) how do you paste the separate box with the script in it to a post?

 

Edit: Obviously pasting it like this doesn't show the indents for the blocks, but I'm assuming I've got them set up, otherwise it wouldn't even compile, would it?

Edited by Geeves83
Link to comment
Share on other sites

If you're scripting, go get this - right now :)

GECK PowerUp for New Vegas

 

And editing your script in Notepad++ (free), UltraEdit (pay), etc and then pasting into the GECK/forum can be quite helpful. Especially with the syntax highlighter (Notepad++, UltraEdit), although you can make your own.

 

When you're composing a message, select the code to be displayed and click on the "<>" (Insert code snippet) in the little toolbar.

 

When a script is running on an actor (either assigned or via spell), you can leave "myself" out completely (in fact, preferred). Unless you're activating a ref -as if- it were activated by some other ref, etc. But I see now why you have it in there.

Begin OnActivate
set rMySelf to GetSelf
rSomeRef.Activate rMySelf ; activate rSomeRef as if this actor did it
End

"Player" is the actual reference name of the main character (you).

Player.AddItem Caps001 1 ; give me a cap please

Whoever has this script running on them will get a cap.

scn CapsAreGoodScript
Begin ScriptEffectStart
   AddItem Caps001 1
End

So,

scn aaaExplosiveFatigueHighScript

float fFatigueDam ; think this needs to be a float instead
ref rMySelf

Begin ScriptEffectStart
if (HasPerk Stonewall == 0)

	set fFatigueDam to (600 - ((GetAV Endurance * 5) + (GetAV DamageThreshold * 2)))
	DamageAV Fatigue fFatigueDam
	
	if (fFatigueDam >= (GetAV Fatigue / 2))
		set rMySelf to GetSelf ; actually, move this to here since it is only used if above is true
		Player.PushActorAway rMySelf 5 ; need "myself" here
	else
		ShowMessage StonewallMessage
	endif
	
endIf
End

Although, I'm not entirely sure what's going on here :P

 

Help and More Help

Edited by Ez0n3
Link to comment
Share on other sites

Awesome. It's working flawlessly right now as far as I can tell. Turns out the problem, near as I can tell, WAS all of the superfluous 'myself' references. It seems you were right, Ez0n3; Since the script is meant to run on actors already, I only need a reference in that one spot in the part of the script that knocks actors down. Thanks loads for the help! As well for the suggestion on the GECK power-up....have no idea how that slipped past me but it's going to be a lifesaver. :)
Link to comment
Share on other sites

  • Recently Browsing   0 members

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