Jump to content

Whats wrong ? ( Script )


unperfek7

Recommended Posts

I dont get it. I copied the Ahzkural Radio script and just replaced it with my NPC but he aaalllwayysss only say's "That's bad".......................when I turn the Jukebox on -> "That's bad" and he does nothing. I turn Jukebox off -> "Thats bad" and he turns it on.....but he never says thats good if I turn it on...basically it should work I dont get it waht is wrong ? I double check "GetScriptVariable" in "That's good" that its 0 and not 1 like in "That's bad".....so where is the problem ???? It looks like the script doesnt set IsOn to 0 or something..... >_> Im really pissed off right now.

 

http://www.myimg.de/?img=idontgetit187ca.jpg

Link to comment
Share on other sites

Is there a problem with posting a link to the actual image, or posting the actual script?

 

@Drayk_Cannon:

Global variables should be avoided wherever possible, as "Quest Variables" (variables declared in Quest Scripts) can usually be used instead, and using them instead of Globals will make your Mod much more organised. In this case, there is absolutely no reason why a global variable or Quest variable should be used.

 

@iPlayboy:

The first thing that I noticed when looking at your script is that you have one too many "endif" statements, probably due to your incorrect indenting. If you don't know how to indent scripts properly, here is a site that can do it for you - Script Indenter

 

The second thing that I noticed is that you have essentially repeated a section of code. This is pretty bad practice, especially when the script can be easily compressed like so:

ScriptName DanteWeissRadioScript

short IsOn

Begin OnLoad

set IsOn to 1

End

Begin OnActivate

Activate
if GetDistance DanteREF <= 500
	if IsActionRef player
		; This next line is the problem - the same line of dialogue is spoken regardless of the radio's state
		DanteREF.SayTo player DanteRadio
		if IsOn
			DanteREF.AddScriptPackage DanteActivateRadio
		endif
	elseif IsOn
		DanteREF.EvaluatePackage
	endif
endif
set IsOn to IsOn == 0

End

Note that I've slightly changed the logic so that EvaluatePackage is only called if AddScriptPackage is not called, as there is no point in calling both functions together.

 

I'm assuming that the reason why "DanteREF" is saying "That's bad" every time is because you've told it to say the same line of dialogue ("DanteRadio") in both cases. You'll want to use a different "That's good" piece of dialogue and use SayTo to force "DanteREF" to say that instead if the player turns the radio on.

 

Cipscis

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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