Jump to content

Why can't I save this script? I'm not very good.


iRonnie16

Recommended Posts

scn VictoryRifleKnockdownScript
ref myself
Begin ScriptEffectStart
If myself.hasperk Stonewall != 1
set myself to GetSelf
player.pushactoraway myself 5
Else
ShowMessage StonewallMessage
EndIf
begin ScriptEffectUpdate
set myself to GetSelf
if myself == player
;ShowWarning "Poisoned by tranquilizer!"
float randomTime
set randomTime to 5.0 + 20.0/99.0 * GetRandomPercent
set timerEffect to randomTime
ShowMessage FixerDizzyMsg
PlaySound FXPoisonStinger; <---- J.S. Added as complement to removing the sound from the associated MGEF, for P04 (5/28/11).
endif
end
begin ScriptEffectUpdate
set myself to GetSelf
if myself == player
if timerEffect <= 0
PlaySound FXPoisonStinger
;ApplyImageSpaceModifier BarkScorpionPoisonISFX
set timerEffect to 5.0 + 20/99.0 *GetRandomPercent
else
set timerEffect to (timerEffect - GetSecondsPassed)
endif
endif
end

Link to comment
Share on other sites

There are quite a lot of things wrong with that script. Firstly, you have two BeginScriptEffectUpdate blocks. This takes up an unnecessary number of lines, and it a very odd thing to do.

 

Secondly, you're creating a variable within a block. This is a very bad thing to do, it can cause a number of problems. Variables should always be created before beginning a block.

 

However, technically, neither of these errors would actually stop your script from saving. What is stopping your script from saving is that you're referencing a variable that you've not created, timerEffect and also that you've not closed your first block.

 

There are also a few things in your script that, whilst not being errors, don't make much sense. Firstly:

    if myself.hasperk Stonewall != 1
        set myself to GetSelf
        player.pushactoraway myself 5
    else
        ShowMessage StonewallMessage
    endif
(...)
    if myself == player
        ;ShowWarning "Poisoned by tranquilizer!"
        set fTimerEffect to 5.0 + 20.0/99.0 * GetRandomPercent
        set bTimerstart to 1
    endif

This means that you might be trying to push the player away from themselves in your BeginScriptEffectStart block.

 

You also set "timerEffect" to "randomtime", but then you don't do anything with "randomtime" making that variable pointless.

 

Also, you don't need to set "myself" whithin each block. Setting it during the BeginScriptEffectStart block means that it will still be valid in the other blocks too.

 

Try this instead:

scn VictoryRifleKnockdownScript
ref rMyself
short bTimerStart
float fTimerEffect
 
Begin ScriptEffectStart

	set rMyself to GetSelf
 
	if rMyself != Player
		player.pushactoraway rMyself 5
; I've changed this as much as I have since NPCs can't have perks, and to stop you from trying to push the player way from themselves.
	endif
end
 
begin ScriptEffectUpdate
 
	if rMyself == player && bTimerStart == 0
		;ShowWarning "Poisoned by tranquilizer!"
		set fTimerEffect to 5.0 + 20.0/99.0 * GetRandomPercent
		set bTimerstart to 1; This is to stop the script from trying to set fTimerEffect each time it runs - doing so would create a timer that doesn't run out.
	endif

	if rMyself == player
		if fTimerEffect <= 0
			ShowMessage FixerDizzyMsg
			PlaySound FXPoisonStinger
			;ApplyImageSpaceModifier BarkScorpionPoisonISFX 
			set fTimerEffect to 5.0 + 20/99.0 *GetRandomPercent
			set bTimerStart to 0; This resets the timer so it will run again after it has run out. I'm not sure if that's what you want to happen, but I figured it would be a reasonable assumption that you might.
		else
			set fTimerEffect to (fTimerEffect - GetSecondsPassed)
		endif 
	endif
end

I'm not entirely sure what your goal is with this script, so my version of it may still not function in exactly the way you want it to, but hopefully it can shed some light on what was going on and help you to get it right. :smile:

 

I think you might want to read up on a couple of scripting tutorials before attempting something like this. This is a very good site for learning: http://www.cipscis.com/fallout/tutorials/beginners.aspx - The tutorials may refer to Fallout 3, rather than New Vegas, but the games are built off of the same engine, so these tutorials are still completely valid for New Vegas. A tutorial for familiarising yourself with the GECK in general and that also handles a little bit of scripting can also be found here: http://geck.bethsoft.com/index.php?title=Bethsoft_Tutorial_Layout - Again, this tutorial refers to Fallout 3, but is still fine fro New Vegas.

Edited by Jojash
Link to comment
Share on other sites

There are quite a lot of things wrong with that script. Firstly, you have two BeginScriptEffectUpdate blocks. This takes up an unnecessary number of lines, and it a very odd thing to do.

 

Secondly, you're creating a variable within a block. This is a very bad thing to do, it can cause a number of problems. Variables should always be created before beginning a block.

 

However, technically, neither of these errors would actually stop your script from saving. What is stopping your script from saving is that you're referencing a variable that you've not created, timerEffect and also that you've not closed your first block.

 

There are also a few things in your script that, whilst not being errors, don't make much sense. Firstly:

    if myself.hasperk Stonewall != 1
        set myself to GetSelf
        player.pushactoraway myself 5
    else
        ShowMessage StonewallMessage
    endif
(...)
    if myself == player
        ;ShowWarning "Poisoned by tranquilizer!"
        set fTimerEffect to 5.0 + 20.0/99.0 * GetRandomPercent
        set bTimerstart to 1
    endif

This means that you might be trying to push the player away from themselves in your BeginScriptEffectStart block.

 

You also set "timerEffect" to "randomtime", but then you don't do anything with "randomtime" making that variable pointless.

 

Also, you don't need to set "myself" whithin each block. Setting it during the BeginScriptEffectStart block means that it will still be valid in the other blocks too.

 

Try this instead:

scn VictoryRifleKnockdownScript
ref rMyself
short bTimerStart
float fTimerEffect
 
Begin ScriptEffectStart

	set rMyself to GetSelf
 
	if rMyself != Player
		player.pushactoraway myself 5
; I've changed this as much as I have since NPCs can't have perks, and to stop you from trying to push the player way from themselves.
	endif
end
 
begin ScriptEffectUpdate
 
	if rMyself == player && bTimerStart == 0
		;ShowWarning "Poisoned by tranquilizer!"
		set fTimerEffect to 5.0 + 20.0/99.0 * GetRandomPercent
		set bTimerstart to 1; This is to stop the script from trying to set fTimerEffect each time it runs - doing so would create a timer that doesn't run out.
	endif

	if rMyself == player
		if fTimerEffect <= 0
			ShowMessage FixerDizzyMsg
			PlaySound FXPoisonStinger
			;ApplyImageSpaceModifier BarkScorpionPoisonISFX 
			set fTimerEffect to 5.0 + 20/99.0 *GetRandomPercent
			set bTimerStart to 0; This resets the timer so it will run again after it has run out. I'm not sure if that's what you want to happen, but I figured it would be a reasonable assumption that you might.
		else
			set fTimerEffect to (fTimerEffect - GetSecondsPassed)
		endif 
	endif
end

I'm not entirely sure what your goal is with this script, so my version of it may still not function in exactly the way you want it to, but hopefully it can shed some light on what was going on and help you to get it right. :smile:

 

I think you might want to read up on a couple of scripting tutorials before attempting something like this. This is a very good site for learning: http://www.cipscis.com/fallout/tutorials/beginners.aspx - The tutorials may refer to Fallout 3, rather than New Vegas, but the games are built off of the same engine, so these tutorials are still completely valid for New Vegas. A tutorial for familiarising yourself with the GECK in general and that also handles a little bit of scripting can also be found here: http://geck.bethsoft.com/index.php?title=Bethsoft_Tutorial_Layout - Again, this tutorial refers to Fallout 3, but is still fine fro New Vegas.

 

It's funny, a lot of the scripting errors or inconveniences you addressed were actually the devs work haha.

Secondly I aim to make a poison dart ammo type that uses the knockdown effect of the victory rifle then injects with cazador poison.

Thirdly, and sadly, this will still not save :(

Link to comment
Share on other sites

Thirdly, and sadly, this will still not save :sad:

 

 

My mistake, I changed your variable names to have a formatting that I prefer, and when I was editing your script I forgot to change a reference to an old variable to the new one. I've changed my original post to fix this mistake. It should save now. :)

Link to comment
Share on other sites

 

Thirdly, and sadly, this will still not save :sad:

 

 

My mistake, I changed your variable names to have a formatting that I prefer, and when I was editing your script I forgot to change a reference to an old variable to the new one. I've changed my original post to fix this mistake. It should save now. :smile:

 

Awesome, it's saved. So this should do what I'm hoping for? Knockdown then poison until certain death?

Link to comment
Share on other sites

Awesome, it's saved. So this should do what I'm hoping for? Knockdown then poison until certain death?

 

No, actually, it won't do that at all. All I've done is clean up your original script. This will knock over the actor that has the Actor Effect this is attached to, then it'll play the cazador poison noise randomly - possibly without end, depending on how you're controlling the actor effect this is attached to and display a message (in the top-left hand corner, as opposed to being a message box) saying; "You are a little woozy.".

 

For poisoning your target until they die, you'd need to add a Poison effect to your Actor Effect (I assume you've got one of these set up, to attach the script to it?).

 

If most of what I've been saying hasn't really made all that much sense to you, I strongly recommend taking a look at those tutorials.

 

Anyway, since that's your goal, I can write you a script that will do that. I'll also provide a step-by-step guide below on making an Actor Effect and applying a script to it. Apologies if you've already got all of this set up, just thought this might be helpful. :smile:

 

 

 

Scn KnockdownPoisonDartEffectScript
 
ref rSelf
 
begin ScriptEffectStart
 
    set rSelf to GetSelf
    if rSelf != Player
        Player.PushActorAway rSelf 5
    endif
end
 
begin ScriptEffectUpdate
 
    if rSelf.GetDead == 0 && rSelf.HasMagicEffect Poison == 0
        rSelf.CIOS DeathclawPoison
    endif
end

1: Locate and click on Script in the Object Window.

 

2: Underneath where it says Editor ID right-click and select "new".

 

3: Save the script I've written above.

 

4: Locate Game Effects in the Object Window, click the "+" sign next to it.

 

5: Click on Base Effects.

 

6: Underneath where it says Editor ID right-click and select "new".

 

7: In the ID box, type in a name you'll remember and that is pertinent. For example, "KnockdownPoisonDartEffectBASE".

 

8: In the Name box, type in whatever you want. Since this effect won't affect the player, you won't see the effect's name. You do need to type something in though, otherwise the effect can't be used.

 

9: In the Effect Archetype box, select Script.

 

10: in the Assoc. Item box, locate the name of the script you just saved ("KnockdownPoisonDartEffectScript")

 

11: Tick the No Magnitude, No Area\ No Duration and Self boxes.

 

12: Click on Actor Effects in the Objects Window.

 

13: Create a new Actor Effect in the same way that you created a new Base Effect.

 

14: Give it an ID and a name.

 

15: Create a new Effect

 

16: In the Effect box, find the ID of the base effect you just created. Click "OK".

 

You may also need to play around with the Type of the actor effect. The vanilla game only has abilities, so it might be worth changing yours to that type too ( in the Type box).

 

From here, it's up to you how you want to apply this effect to an enemy, you might want to add it to a projectile, or as an object enchantment for a weapon.

 

 

Edited by Jojash
Link to comment
Share on other sites

I'm not very good with scripting at all, I had a basic understanding of what was going on but I had assumed the Poison effect was part and parcel considering I was sampling the CazadorPoisonEffectScript in that, now that you've said that I'm not sure where to find a reference for an actual poison effect

Link to comment
Share on other sites

  • Recently Browsing   0 members

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