Jump to content

Photo

Actor Object Script Disappears on Reload


  • Please log in to reply
9 replies to this topic

#1
jaredl

jaredl

    Enthusiast

  • Members
  • PipPip
  • 101 posts

I have applied an object script to an actor which will work the first time I load a game. If I reload the game the script no longer works like it isn't there. Is there something I am missing? 



#2
Ladez

Ladez

    Old hand

  • Members
  • PipPipPip
  • 633 posts

Gee, I don't know - I haven't been gifted with clairvoyance.
 
Maybe you could share the script to let people have a look? :smile:



#3
jaredl

jaredl

    Enthusiast

  • Members
  • PipPip
  • 101 posts
scn CreatureScatter

float timer
short iConfidence
short toggle

Begin GameMode

	if toggle == 0
		set iConfidence to getav confidence
	endif

	if player.GetAnimAction == 2
	&& GetActorAggroRadiusViolated == 1
		set toggle to 1
		setav confidence 0
		startcombat player
	endif
	
	if timer < 1 && toggle == 1
		set timer to timer + GetSecondsPassed
	else
		setav confidence, iConfidence
		set toggle to 0
		set timer to 0
	endif

End

Edited by jaredl, 16 October 2014 - 08:57 AM.


#4
Fallout2AM

Fallout2AM

    Enthusiast

  • Members
  • PipPip
  • 228 posts

        setav confidence, iConfidence

 

is that a comma?

 

Also:

    if player.GetAnimAction == 2
    && GetActorAggroRadiusViolated == 1

 

I guess this is on a single line


Edited by Fallout2AM, 16 October 2014 - 11:41 AM.


#5
jaredl

jaredl

    Enthusiast

  • Members
  • PipPip
  • 101 posts

Yes that is a comma. I saw it used that way in an example script online and it seems to be the only way I can use a variable with that function.

 

The second part is not on a single line but GECK lets me save it and it does work, at least on the first load. I will try it on the same line and see if it makes a difference.



#6
Fallout2AM

Fallout2AM

    Enthusiast

  • Members
  • PipPip
  • 228 posts

Even this compile:

 

    if player.GetAnimAction == 2 && || %% GetActorAggroRadiusViolated == 1

 

I don't blindly trust the compiler



#7
jazzisparis

jazzisparis

    The baby-eating Bishop of Bath and Wells

  • Supporter
  • PipPipPipPip
  • 2,098 posts

I have applied an object script to an actor

Applied how? Is the script attached to the actor by default, or are you using the SetScript command to attach it? If the latter, then the issue you're describing is to be expected, as SetScript doesn't work properly (as of NVSE 4.5b7).



#8
jaredl

jaredl

    Enthusiast

  • Members
  • PipPip
  • 101 posts

Even this compile:

 

    if player.GetAnimAction == 2 && || %% GetActorAggroRadiusViolated == 1

 

I don't blindly trust the compiler

I went ahead and edited it into the same line but results were the same.

 

 

I have applied an object script to an actor

Applied how? Is the script attached to the actor by default, or are you using the SetScript command to attach it? If the latter, then the issue you're describing is to be expected, as SetScript doesn't work properly (as of NVSE 4.5b7).

 

The script is attached to the base actor by default. For the rest I use the template flag Use Scripts. It turns out the scripts were working on other NPCs, but I was just testing on the same ones over which lose their script after a second load. 00157B37 is the FormID of the Placed Object of one of the NPCs (FalloutNV.esm). Perhaps if someone could take a look.


Edited by jaredl, 18 October 2014 - 08:26 AM.


#9
Fallout2AM

Fallout2AM

    Enthusiast

  • Members
  • PipPip
  • 228 posts

 

Even this compile:

 

    if player.GetAnimAction == 2 && || %% GetActorAggroRadiusViolated == 1

 

I don't blindly trust the compiler

I went ahead and edited it into the same line but results were the same.

 

did you remove the comma too?

 

after that, I would printC every script line, to see what exactly is executed and what's not, and when. And I would reload an older save, before the mod, or start a new game.



#10
Ladez

Ladez

    Old hand

  • Members
  • PipPipPip
  • 633 posts

The comma is syntactically correct, but it's optional so most leave it out.






Page loaded in: 1.124 seconds