Jump to content

Script compiler not recognizing ObjectReference, and any autocomplete definition library for notepad++?


Deleted57015472User

Recommended Posts

Hello, so I'm getting back into modding for the first time in.. like 10 or 11 years. I'm 22. Yeah.

So I'm having a very dumb issue, on my first very rough script (designed to generate targets for wander packages at a set distance from the spawn point in each cardinal direction)..

It doesn't seem to recognize ObjectReference as a class, or perhaps it's rejecting me setting up an array of them, I'm unsure.

 

lemme posts the codes:

Scriptname zzzDPDrifterManagementSystem

	{The system in charge of spawning and assigning drifters
	to locations, aswell as acting as a liason for the existing colony management system}

GlobalVariable	MaximumDrifters;
int ScavengeDistance = 4056;
ObjectReference SpawnPoint;
Static Spawners;
ObjectReference[] ScavengePoints = new ObjectReference[4];
ObjectReference[] GuardPoints = new ObjectReference[12];
Actor[] ActorArray = new Actor[MaximumDrifters];
bool initialized = false;

Event OnActivate(ObjectReference akActionRef)
   if akActionRef == Game.GetPlayer()
		if initialized == false
			int tick = 0;
			while (tick < 4)
				int x = 0;
				int y = 0;
				if tick == 0
				x = 1;
				y = 1;
				endif
				if tick == 1
				x = 1;
				y = -1;
				endif
				if tick == 2
				x = -1;
				y = -1;
				endif
				if tick ==3
				x = -1;
				y = 1;
				endif
				
			ScavengePoints[tick] = spawnpoint.placeatme(Spawners);
			ScavengePoints[tick].MoveTo(SpawnPoint, Spawnpoint.GetPositionX() + (ScavengeDistance*x), SpawnPoint.GetPositionY() + (ScavengeDistance*y));
			
			Game.GetPlayer().MoveTo(SpawnPoint, Spawnpoint.GetPositionX() + (ScavengeDistance*x), SpawnPoint.GetPositionY() + (ScavengeDistance*y));
			Utility.Wait(6.0)
			tick++;	
				
			endwhile
			
			Game.GetPlayer().MoveTo(SpawnPoint);
			Debug.MessageBox("Cardinal Scavenge Points Configured at distance "+"ScavengeDistance");
			initialized = true;
		endif
      
   endif
EndEvent

and the errors:

Compiling "zzzDPDrifterManagementSystem.psc"...
E:\Games\steamapps\common\Fallout 4\Data\Scripts\Source\User\zzzDPDrifterManagementSystem.psc(10,35): no viable alternative at input 'new'
E:\Games\steamapps\common\Fallout 4\Data\Scripts\Source\User\zzzDPDrifterManagementSystem.psc(10,54): required (...)+ loop did not match anything at input '['
E:\Games\steamapps\common\Fallout 4\Data\Scripts\Source\User\zzzDPDrifterManagementSystem.psc(10,18): Unknown user flag objectreference
No output generated for zzzDPDrifterManagementSystem.psc, compilation failed.

While I'm at it, is there a resource for a definition of functions library to add autocomplete to notepad++? The.. often very unhelpful wiki only has such for skyrim. Pardon if my terminology is off, I'm basically just an idiot who passed a basic java course years ago and am going off that for experience.

 

Edit: Please ignore the functions moving the player, that is just me screwing around with it for debugging purposes and to get a more visual sense of the distances involved.

Edited by Guest
Link to comment
Share on other sites

While I may not know Fallout coding directly, I do know a number of languages maybe this will help.

 

When setting up a type for a variable you just need the type, no bracket required to start, so see if these line fixes help:

 

ObjectReference ScavengePoints = new ObjectReference[4];

ObjectReference GuardPoints = new ObjectReference[12];

Actor ActorArray = new Actor[MaximumDrifters];

 

They are from the start of your script. Also if switch case options are available, that can cut down some of the work in that while loop, though failing that an if then else pattern should speed things up, rather than going through all options.

 

Example:

switch (tick)

{

case 0:

What to do

break;

case 1:

what to do

break;

case 2:

what to do

break;

case 3:

what to do

break;

}

 

then resume work.

 

A for loop may also work.

for(tick=0;tick<4;tick++)

{

Set x and y as needed

Do spawning and moving

}

You will not need to add to the tick as that is handled by the end of the for statement (start value, condition, counter).

 

If then else example:

If tick == 0

What to do

Else

If tick == 1

What to do

Else

If tick == 2

What to do

Else

If tick == 3

What to do

End if

 

The above will go through the if's until it gets to the right one, but will stop hunting once the condition is found (tick is the expected value).

 

A C or C++ class can be a big help and there are free tutorials out there. I'm also assuming someone has made a resource of all the functions, variables, and loop types available.

 

Hopefully this is of some aid to you.

Link to comment
Share on other sites

While I may not know Fallout coding directly, I do know a number of languages maybe this will help.

 

 

 

Thank you, I was never taught about breaks and I can definitely see that being a much more efficient system than the if statements. Always good to learn something new (and realize for statements are still in papyrus)

 

Unfortunately, the arrays are still having trouble initialize, perhaps they are not arrayable, and need to be manually done (yuck).

Link to comment
Share on other sites

Of those three lines try changing to () on the ends instead of brackets, those are for getting to the individual pieces (ex. New Array items=new Tools(5); then to access 5th, items[4], as array goes 0 to 4 for the five). Adjust my example accordingly, as I haven't looked into nodding Fallout 4, just dealt with some mods I made but never released for Dark Forces 2 Jedi Knight and the addon missions in Mysteries of the Sith, though I was looking into the original Unreal Engine with the original Deus Ex (good game, worth some of your time as it is what brought about the later Deus Ex's like Mankind Divided).
Link to comment
Share on other sites

  • Recently Browsing   0 members

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