Small Script problem

Post » Mon Nov 19, 2012 8:13 pm

Hi!
I have a small problem with this script, attached to some NPC
Scriptname a2rTownGuardsScript extends ActorEvent OnPackageStart(Package akNewPackage)  Debug.Messagebox("StartingPackage")  Debug.Messagebox("Name of akNewPackage is"+ AkNewPackage + "And the name of ours " + PatrolPackage )  if(akNewPackage ==PatrolPackage)	 Debug.Messagebox("Hello, World!")	;SomeStuff  endifendEventPackage Property PatrolPackage  Auto

Script should start if Actor is starting a new package, and then determine if this started package is the same as PatrolPackage, and then do some stuff.
I've set the PatrolPackage property to a specific Package in the Edit Properties window.
Unfortunately, script wasn't working, so i added messageboxes and this is what i get.

Event works, i get "StartingPackage", and then "Name of akNewPackage is[Package <(0202EA42)>] And the name of ours None"
Of course, the None is problem. Why script can't see PatrolPackage property properly?
User avatar
Harinder Ghag
 
Posts: 3405
Joined: Wed Jan 17, 2007 11:26 am

Post » Mon Nov 19, 2012 2:06 pm

Very very cursory inspection but try this
Change
if(akNewPackage ==PatrolPackage)
To
if(akNewPackage == PatrolPackage)
Make sure there is a space after the 2nd equals (=) sign.
User avatar
saharen beauty
 
Posts: 3456
Joined: Wed Nov 22, 2006 12:54 am

Post » Mon Nov 19, 2012 10:00 am

Check the property again. After you are sure it's set to you what you, "Ok" your way out of the open dialogs and save. I can't tell you how many times I've made a property change, then forgotten to save it before reopening the scripting window and been very confused by the results.
User avatar
Kristian Perez
 
Posts: 3365
Joined: Thu Aug 23, 2007 3:03 am

Post » Mon Nov 19, 2012 7:20 am

Check the property again. After you are sure it's set to you what you, "Ok" your way out of the open dialogs and save. I can't tell you how many times I've made a property change, then forgotten to save it before reopening the scripting window and being very confused by the results.
Ah yes, make sure to fill your property in the editor window.
Also I would suggest declaring your property's before any Event Blocks. You've got yours down the bottom, it should be one of the first things written in your script.
User avatar
Christine
 
Posts: 3442
Joined: Thu Dec 14, 2006 12:52 am

Post » Mon Nov 19, 2012 8:51 am

Is there any reason why PatrolPackage is below the events? It might have an effect.
User avatar
xxLindsAffec
 
Posts: 3604
Joined: Sun Jan 14, 2007 10:39 pm

Post » Mon Nov 19, 2012 2:14 pm

Changed it, patrolpackage is on top, and still there is no effect. For some strange reason, PatrolPackage variable is constantly empty. Maybe you know some other way to use this variable. I just simply right click on script name -> Edit Properties -> add property -> Select Type: Package, write name -> ok -> select this property from the list -> edit value -> and select name of my package from the list "Pick Object" -> Ok What am i Doing wrong?
User avatar
RObert loVes MOmmy
 
Posts: 3432
Joined: Fri Dec 08, 2006 10:12 am

Post » Mon Nov 19, 2012 4:21 pm

Make sure there is a space after the 2nd equals (=) sign.
This does not matter. Put a space or do not put one, the result will be the same. ^^
User avatar
Chrissie Pillinger
 
Posts: 3464
Joined: Fri Jun 16, 2006 3:26 am


Return to V - Skyrim