Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Hey guys, I really need help I've been looking everywhere and cannot find ANYTHING helpful. I'm trying to make an ammo type for 9mm that does extra damage against mutants and ghouls, but I cannot find out how to get the hit actor in an impact script? I think I know how I can do the extra damage, I think I know how to check for the creature type, and I know I need a scripteffectstart but I don't understand what I use to get the guy I hit with the bullet?

Link to comment

ok well nevermind after countless hours of looking for help I finally realized that all I need to do is use GetSelf

 

but now I've hit a new problem, how the fuck am I supposed to compile the script? Pressing save does absolutely nothing

Link to comment

ok well nevermind after countless hours of looking for help I finally realized that all I need to do is use GetSelf

 

but now I've hit a new problem, how the fuck am I supposed to compile the script? Pressing save does absolutely nothing

Install GECK powerup as per first post in this thread :)
Link to comment

 


but now I've hit a new problem, how the fuck am I supposed to compile the script? Pressing save does absolutely nothing

When you press save, if there are mistakes it won't save. If the script is 99% error free, then the script will save (and compile). You won't know what it does, or won't notice anything else than the script saving - just trust it.

Link to comment

 

ok well nevermind after countless hours of looking for help I finally realized that all I need to do is use GetSelf

 

but now I've hit a new problem, how the fuck am I supposed to compile the script? Pressing save does absolutely nothing

Install GECK powerup as per first post in this thread :)

 

 

Ah alright that got the error I was using Target as a variable name which is apparently a no-no

 

But now I've got the problem that my script, while it technically works, does not function how I want it to. I'm trying to create a Silver Bullet varient for certain types of ammo to do extra damage against Ghouls and Mutants, But when I tested this on a ghoul it was not doing any extra damage. How should I re-write this in order to properly apply extra damage?

ScriptName SilverBulletEffect

ref rTarget

Begin ScriptEffectStart
	set rTarget to GetSelf
	if rTarget.GetIsCreatureType 5 == 1
		rTarget.DamageAV Health 20
	endif
End
Link to comment

Check if GetSelf is valid here (is rTarget not null ?). If it is, then you can do away with GetSelf and rTarget by the way ! Otherwise there is a GetTarget or something similar. Check the vanilla scripts for shotgun ammo or boxing gloves.

Link to comment

Check if GetSelf is valid here (is rTarget not null ?). If it is, then you can do away with GetSelf and rTarget by the way ! Otherwise there is a GetTarget or something similar. Check the vanilla scripts for shotgun ammo or boxing gloves.

 

Ah alright, is there a way to print things to an output somwhere for me to check or how would you reccomend trying that? And I'll go look through those scripts. I based my script off of how the Zap Gloves work, so I'm assuming Getself must only work with melee weapons or something?

Link to comment

Alright so I swapped it to not use getself and instead just be

ScriptName SilverBulletEffect

Begin ScriptEffectStart
	if GetIsCreatureType 1 == 3 || GetIsCreatureType 4 == 1 || GetIsCreatureType 5 == 1 
		DamageAV Health 2000
	endif
End

Like coinshot script,and I raised the damage to be 2000 to make it blatantly obvious if it was wortking or not however I still have the problem of it not doing anything. I'll try putting a print in there now

Link to comment

And yeah now with the prints, I see it is firing Script Effect Start but not passing the if statement, So I do need to somehow get the actor the script is acting upon (again)

 

edit since I feel like I'm spamming:

I've now tried it again with getself now that I have prints and still no dice

Link to comment

This works in Another Kick in the Head:

scn RobarSilverSlugScript

Begin ScriptEffectStart

    if (GetInFaction RobarDDWarehouseFaction || GetInFaction RobarDDMcCarranFaction)
        if (GetRandomPercent < 50)
            Kill PlayerREF 0 0
        else
            Kill PlayerREF 1 0
        endif
    endif

End

The calling ref (GetSelf) is implicit.

 

I miss AKH..

post-158171-0-80928000-1436726859_thumb.png

Link to comment

Im trying to come up with a workaround for the missile bug where missiles fired outside of VATS do no impact damage, only the explosion damage. 

                             

I thought about turning off the explosion then using a script to implement the explosion. However, all scripts that i put on a non-hitscan projectile like a missile (such as via ammo impact scripts or via base effect scripts) it simply refuse to run.

 

The script itself is really simple, but it just will not run for some reason.

 

For example :

scn MissileFixBaseEffectScriptBegin ScriptEffectStartplaceatme MissileExplosionHEEND

That does absolutely nothing when i fire a missile. Any ideas?

 

Link to comment

huh, alright then it would seem my problem lies within my if statement, I'll try a few things out and see if I can manage to get anything to work

 

Am I able to print the outcome of things somehow? I tried doing this

ScriptName SilverBulletEffect

Begin ScriptEffectStart
	Print "You hit an actor"
	Print GetIsCreatureType 0
	Print GetIsCreatureType 1
	Print GetIsCreatureType 2
	Print GetIsCreatureType 3
	Print GetIsCreatureType 4
	Print GetIsCreatureType 5
	Print GetIsCreatureType 6
	Print GetIsCreatureType 7
	if (GetIsCreatureType 3 || GetIsCreatureType 4 || GetIsCreatureType 5 )
		Print "Actor is weak against Silver Bullets"
		DamageAV Health 2000
	endif
End

but it only printed "You hit an actor" and not 0s and a one. Unless GetIsCreatureType doesn't work and that was my problem all along?

Link to comment

You use Print for strings usually. You can use PrintC for other types of variables, but you must use a certain syntax.

You would like to change things like this:

If rMyRef.GetIsCreatureType 1
  PrintC "My creature is = 1"
elseif rMyRef.GetIsCreatureType 2
  PrintC "My creature is = 2"
etc.

To understand the parameters you want to pass to PrintC, you need to look for Format Specifiers

 

EDIT: I used PrintC, but I could have used Print, since I'm just printing a string.

Print allows concatenated syntax like this:

Print "My Int is " + $iMyInt + " and my string is " + $sMyString

While PrintC allows a syntax like this:

PrintC "My Int is %f and my string is %z" iMyInt sMyString
Link to comment

Alright, I've done something similar by just trying to pass a regular GetIsCreature and printing as such

ScriptName SilverBulletEffect

Begin ScriptEffectStart
	Print "You hit an actor"
	if GetIsCreature
		Print "Is a Creature"
		if (GetIsCreatureType 3 || GetIsCreatureType 4 || GetIsCreatureType 5 )
			Print "Actor is weak against Silver Bullets"
			DamageAV Health 2000
		endif
	endif
End

And alas it is still not even printing "Is a Creature" when I shoot at and damage ghouls with the ammo selected.  This is mildly infuriating

 

Also when looking at the reference stuff on the Geck website it said PrintC is the old version of print. Is there a specific reason you use it or is it habit?

Link to comment

Is there a specific reason you use it or is it habit?

no it's not a matter of habit, they're just different. As I said you use Print for strings, PrintC for other kinds of variables.

For example, this returns the hex of a reference:

PrintC "My ref is %i" rMyRef

Can't do this with Print.

 

About your issue with GetIsCreature, there are some functions that work only in some specific blocktypes (some only in conditions), this could be an example.

I don't have time to make experiments right now, but if you don't succeed with your script mine's probably the reason.

Nevermind, let me fire up the geck and write a small script

 

However, for what counts... you're doing very good in debugging your own script using Print / PrintC. Usually people tend to spit 300 lines of script and then ask "why it doesn't work?" without even narrowing down with some Print / PrintC

Link to comment

Thanks, I've got a lot of experience in the Lua scripting language so I've got a few skills that kinda carry over. When I run into problems like this I generally figure theres something like "there are some functions that work only in some specific blocktypes (some only in conditions), this could be an example." at hand not being mentioned anywhere in the documentation I'm looking at.

 

I'd also like to thank y'all for being the only place I could find with an active community who's able to help with this stuff, I hope to try and stick around and help people myself as I get better.

Link to comment

Ok so I have bigger fish to fry apperently because I used your exact script to replace my current one and it only printed

 

"I am a Feral Ghoul Trooper [iD]"

 

without anything else. Hmmmm

 

Edit: Going to jacobstown and shooting super mutants does work

 

perhaps my issue is that camp searchlight ghouls are glitched or something? :/ this is bad news indeed

Link to comment

WOOHOO I got it! You see, geck is a giant troll and even though Camp Searchlight Ghouls appear under Actors>Creatures>Feral Ghouls, they are actually Humanoid NPCs with their race set to ghoul so they can wear NCR armor. My final code if anyone is interested:

ScriptName SilverBulletEffect

Begin ScriptEffectStart
	if GetIsCreature
		if (GetIsCreatureType 3 || GetIsCreatureType 4 || GetIsCreatureType 5 )
			DamageAV Health 20
		endif
	elseif GetIsRace Ghoul
		DamageAV Health 20
	endif
End

Thanks a ton to everyone who helped :D .

Link to comment

 

Can't do this with Print.

 

You can ;).

Print "What is "+$SunnyREF+"'s form id? "+(GetFormIDString SunnyREF)+" and what is Alice's load order in hex? "+(NumToHex (GetModIndex "Alice.esp"))

The real power of print is that it accepts functions.

Link to comment

 

Im trying to come up with a workaround for the missile bug where missiles fired outside of VATS do no impact damage, only the explosion damage. 

                             

I thought about turning off the explosion then using a script to implement the explosion. However, all scripts that i put on a non-hitscan projectile like a missile (such as via ammo impact scripts or via base effect scripts) it simply refuse to run.

 

The script itself is really simple, but it just will not run for some reason.

 

For example :

scn MissileFixBaseEffectScriptBegin ScriptEffectStartplaceatme MissileExplosionHEEND

That does absolutely nothing when i fire a missile. Any ideas?

 

 

Anyone know why the script wont run?

 

Link to comment

 

 

Can't do this with Print.

 

The real power of print is that it accepts functions.

 

 

Absolutely. But then, this implies that you know these functions. And I often don't. :lol:

 

But being serious, when my computer will finally work again I'll show you what I feel it's the only difference between the twos.

Link to comment

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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use