Jump to content

Need help: What is wrong with this script?


Guest Messenjah

Recommended Posts

Guest Messenjah

Ok, so I am again banging my head on my desk lol. Basically, I need a backup dancer as a fill-in for when the other dancers are not on stage, since I don't have 6 voice actors for all 6 shifts. Since the game does not update an npc or it's scripts that frequently without something else pushing it, I need a script that forces the AI to do what I need it to do precisely and then also to enable the npc.

 

The idea, is that I also have a script that disables the npc on the other end via a trigger that they walk into. When the walk into it, it checks the state, then disables the npc and sets them to StateVar 3. When the correct gamehour hits, they should re-enable and commence their AI packages.

 

The problem, is that I have them initially disabled and they will NOT EVER enable. I have even removed the trigger completely and tested the npc by itself to see if it ever enables and it doesn't. I've also tried moving the enable portion of the block to where I define my StateVar's. :P

 

 

Any idea on what I'm doing wrong?

 

scn AWEBackupDancerSCRIPT

int StateVar
int OldState
short Start
short Stop

begin GameMode

If (GameHour >= 0) && (GameHour < 4) && (StateVar != 1) ;Stop
Set StateVar to 1
Elseif (GameHour >= 4) && (GameHour < 8) && (StateVar != 2) ;Start
Set StateVar to 2
If GetDisabled
	enable
endif
		MoveTo AWEBackupDanceREF
Elseif (GameHour >= 8) && (GameHour < 12) && (StateVar != 1) ;Stop
Set StateVar to 1
Elseif (GameHOur >= 12) && (GameHour < 16) && (StateVar != 2) ;Start
Set StateVar to 2
If GetDisabled
	enable
endif
		MoveTo AWEBackupDanceREF
Elseif (GameHour >= 16) && (GameHour < 20) && (StateVar != 1) ;Stop
Set StateVar to 1
Elseif (GameHour >= 20) && (GameHour < 24) && (StateVar != 2) ;Start
Set StateVar to 2
If GetDisabled
	enable
endif
		MoveTo AWEBackupDanceREF
endif

If StateVar == OldState
Return
Endif

If StateVar == 1 ;Stop
	Set Stop to 1
	Set Start to 0
	evp
Elseif StateVar == 2 ;Start
	Set Start to 1
	Set Stop to 0
	evp
Endif

Set StateVar to OldState

End

Link to comment
Share on other sites

Guest Messenjah

Ok, so I disabled the initially disabled flag and it is now enabled. I can manually enable and disable the dancer, however I've noticed something odd...

 

 

The npc keeps restarting it's AI package.... basically, it tries to take a step forward and then resets and starts over so it looks like it is stuttering forward wherever it walks. However, this script works on all other npc's with the exception that I do not have repeating stages..... do I have a loop somehow in setting my AI packages? If I put my trigger back, it just enables and disables repeatedly.

Link to comment
Share on other sites

Guest Messenjah

Ok, just to update, I just fixed the AI problem. Got one of the variables backwards, which caused a nasty loop.

 

Now back to contending with the enable/disable problem. At least a working AI will help me figure out what is going on a lot better.

Link to comment
Share on other sites

Remark it as disabled, and us prid to select it in the console and try to call enable on your NPC. If you can't there's something wrong with the NPC, probably either an enable parent or a flag in the script attached to a disable command that not's setting/unsetting properly.
Link to comment
Share on other sites

Guest Messenjah

Actually, I seemed to have just fixed it. Seems that the loop actually caused the problem. :\

 

I actually tried the enable parent through console earlier and it worked both ways that way. Just couldn't get the scripts to enable/disable it. I think the loop screwed it all up as well because it kept resetting the variables, even though the npc appeared to know where to go, they kept stuttering slowly forward like they kept changing their mind about what they were supposed to do. It also must have been confusing the enable variables somehow.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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