Jump to content

Scripting Problems


AgraveldTor

Recommended Posts

As many may know, i am working on Wasteland Defence.

I am looking for advice, guidance, a miracle on a script.

 

Now about the script. I am trying to work on the stationary guards within wasteland defence. Everyone knows they are buggy and can cause CTD's.

I think i may have figured out the problem, i have narrowed it to the stationary guard script itself, but when i try to save my work on the script, i cant.

 

I have tried it in Geck, Geckpu, NVSE loader and all three with admin privilages. Nothing.

Heres the script. This is from the V1.7 Alt file on the mod page. it is suppose to be the stable version of the script.

 

 

scn aaaSettlementStationaryGuardScriptv1.7Alt

SHORT	Button
SHORT	Active
SHORT	recalled
SHORT	rearmed
SHORT	healed
SHORT	count
SHORT	doonce
FLOAT	posx
FLOAT	posy
FLOAT	posz

begin onload

if doonce == 0
	Set posx to GetPos x
	Set posy to GetPos y
	Set posz to GetPos z
	Set doonce to 1
endif

end

begin onactivate

if getdead == 1
	if IsActionRef player == 0
		RemoveAllItems ScavengerTruckRef 0
		disable
		markfordelete
	else
		ShowMessage aaaSettlementBodyControl
		Set Active to 1
	endif
else
	Activate
endif

end

begin gamemode

if aaaSettlementFortRaid.healguards == 1 && healed == 0
ResetHealth
Set aaaSettlementFortRaid.recalltimer to 5
Set healed to 1
endif

if aaaSettlementFortRaid.rearmguards == 1 && rearmed == 0

if GetItemCount Ammo308 > 0
	Set count to GetItemCount Ammo308
	RemoveItem Ammo308 count
endif
if GetItemCount WeapSniperRifle > 0
	Set count to GetItemCount WeapSniperRifle
	RemoveItem WeapSniperRifle count
	AddItem WithAmmoSniperRifleLoot 1
endif

if GetItemCount Ammo5mm > 0
	Set count to GetItemCount Ammo5mm
	RemoveItem Ammo5mm count
endif
if GetItemCount WeapNVAssaultCarbine > 0
	Set count to GetItemCount WeapNVAssaultCarbine
	RemoveItem WeapNVAssaultCarbine count
	AddItem WithAmmoNVAssaultCarbineLoot 1
endif

AddItem LootGrenadeFrag10 1

Set aaaSettlementFortRaid.recalltimer to 5
Set rearmed to 1

endif

if healed == 1 && aaaSettlementFortRaid.recalltimer == 0
Set aaaSettlementFortRaid.healguards to 0
Set healed to 0
endif

if rearmed == 1 && aaaSettlementFortRaid.recalltimer == 0
Set aaaSettlementFortRaid.rearmguards to 0
Set rearmed to 0
endif

if Active == 1

Set Button to GetButtonPressed

if Button == 0 
	Activate
	Set Active to 0
elseif Button == 1
	disable
	markfordelete
	Set Active to 0
elseif Button == 2
	Set Active to 0
endif

endif

end

begin onCombatEnd
if isincombat == 0
	SetPos x posx
	SetPos y posy
	SetPos z posz
endif
end

begin onDeath

Set aaaSettlementDaysCounter.citizencount to aaaSettlementDaysCounter.citizencount - 1
Set aaaSettlementDaysCounter.guardcount to aaaSettlementDaysCounter.guardcount - 1

if GetCauseOfDeath == -1
	disable
	markfordelete
endif

end

 

 

 

I dont know what to do. Without being able to save scripts, my work on wasteland defence is at a stand still.

If you can help me with this i will be greatful. Hell i'll even stick your name in the credits when i upload.

 

If you would like to look at the other scripts from the other versions here they are:

 

 

scn aaaSettlementStationaryGuardScriptV1.7Orig

SHORT	Button
SHORT	Active
REF		thismarker
SHORT	Timer
SHORT	recalled
SHORT	rearmed
SHORT	healed
SHORT	count
SHORT	doonce

begin onload

if isFormValid == 1 && doonce == 0
	
	if thismarker == 0 && aaaSettlementMainLogic.newguardmarker != 0
		Set thismarker to aaaSettlementMainLogic.newguardmarker
		Set aaaSettlementMainLogic.newguardmarker to 0
	endif
	
	Set doonce to 1
endif

end

begin onactivate

if getdead == 1
	if IsActionRef player == 0
		RemoveAllItems ScavengerTruckRef 0
		disable
		markfordelete
	else
		ShowMessage aaaSettlementBodyControl
		Set Active to 1
	endif
else
	Activate
endif

end

begin gamemode

if aaaSettlementFortRaid.healguards == 1 && healed == 0
ResetHealth
Set aaaSettlementFortRaid.recalltimer to 5
Set healed to 1
endif

if aaaSettlementFortRaid.rearmguards == 1 && rearmed == 0

if GetItemCount Ammo308 > 0
	Set count to GetItemCount Ammo308
	RemoveItem Ammo308 count
endif
if GetItemCount WeapSniperRifle > 0
	Set count to GetItemCount WeapSniperRifle
	RemoveItem WeapSniperRifle count
	AddItem WithAmmoSniperRifleLoot 1
endif

if GetItemCount Ammo5mm > 0
	Set count to GetItemCount Ammo5mm
	RemoveItem Ammo5mm count
endif
if GetItemCount WeapNVAssaultCarbine > 0
	Set count to GetItemCount WeapNVAssaultCarbine
	RemoveItem WeapNVAssaultCarbine count
	AddItem WithAmmoNVAssaultCarbineLoot 1
endif

AddItem LootGrenadeFrag10 1

Set aaaSettlementFortRaid.recalltimer to 5
Set rearmed to 1

endif

if healed == 1 && aaaSettlementFortRaid.recalltimer == 0
Set aaaSettlementFortRaid.healguards to 0
Set healed to 0
endif

if rearmed == 1 && aaaSettlementFortRaid.recalltimer == 0
Set aaaSettlementFortRaid.rearmguards to 0
Set rearmed to 0
endif

if aaaSettlementFortRaid.resetguards == 1 && recalled == 0
if isFormValid == 1 && thismarker.isFormValid == 1
	if thismarker
		thismarker.disable
		thismarker.markfordelete
	endif
endif
kill
disable
markfordelete
Set aaaSettlementFortRaid.recalltimer to 5
Set recalled to 1
endif

if Active == 1

Set Button to GetButtonPressed

if Button == 0 
	Activate
	Set Active to 0
elseif Button == 1
	disable
	markfordelete
	Set Active to 0
elseif Button == 2
	Set Active to 0
endif

endif

if getdead == 0

	if isFormValid == 1 && thismarker.isFormValid == 1 && thismarker

		if isFormValid == 1 && aaaSettlementDaysCounter.Timer == 0 && (GetInSameCell player || Player.GetInSameCell WaterWellRef || Player.GetInSameCell RaidAlarmRef || Player.GetInSameCell PatrolMarkerARef || Player.GetInSameCell PatrolMarkerBRef || Player.GetInSameCell PatrolMarkerCRef || Player.GetInSameCell PatrolMarkerDRef)
			if thismarker.isFormValid == 1 && thismarker
				if getdead == 0 && isincombat == 0
					MoveTo thismarker
				endif
			endif
		endif

	endif

else

	if isFormValid == 1 && thismarker.isFormValid == 1
		if thismarker
			thismarker.disable
			thismarker.markfordelete
		endif
	endif

endif

end

begin onCombatEnd
if isFormValid == 1 && thismarker.isFormValid == 1
	if getdead == 0 && isincombat == 0 && thismarker
		MoveTo thismarker
	endif
endif
end

begin onDeath

if isFormValid == 1 && thismarker.isFormValid == 1
	if thismarker
		thismarker.disable
		thismarker.markfordelete
	endif
endif

Set aaaSettlementDaysCounter.citizencount to aaaSettlementDaysCounter.citizencount - 1
Set aaaSettlementDaysCounter.guardcount to aaaSettlementDaysCounter.guardcount - 1

if GetCauseOfDeath == -1
	if isFormValid == 1 && thismarker.isFormValid == 1
		if thismarker
			thismarker.disable
			thismarker.markfordelete
		endif
	endif
	disable
	markfordelete
endif

end

 

 

 

 

 

scn aaaSettlementStationaryGuardScriptV1.8

SHORT	Button
SHORT	Active
REF		thismarker
SHORT	Timer
SHORT	recalled
SHORT	rearmed
SHORT	healed
SHORT	count
SHORT	doonce
FLOAT	dx
FLOAT	dy
FLOAT	dz
FLOAT	d2

begin onload

if isFormValid == 1 && doonce == 0
	
	if thismarker == 0 && aaaSettlementMainLogic.newguardmarker != 0
		Set thismarker to aaaSettlementMainLogic.newguardmarker
		Set aaaSettlementMainLogic.newguardmarker to 0
	endif
	
	Set doonce to 1
endif

end

begin onactivate

if getdead == 1
	if IsActionRef player == 0
		RemoveAllItems ScavengerTruckRef 0
		disable
		markfordelete
	else
		ShowMessage aaaSettlementBodyControl
		Set Active to 1
	endif
else
	Activate
endif

end

begin gamemode

if aaaSettlementFortRaid.healguards == 1 && healed == 0
ResetHealth
Set aaaSettlementFortRaid.recalltimer to 5
Set healed to 1
endif

if aaaSettlementFortRaid.rearmguards == 1 && rearmed == 0

if GetItemCount Ammo308 > 0
	Set count to GetItemCount Ammo308
	RemoveItem Ammo308 count
endif
if GetItemCount WeapSniperRifle > 0
	Set count to GetItemCount WeapSniperRifle
	RemoveItem WeapSniperRifle count
	AddItem WithAmmoSniperRifleLoot 1
endif

if GetItemCount Ammo5mm > 0
	Set count to GetItemCount Ammo5mm
	RemoveItem Ammo5mm count
endif
if GetItemCount WeapNVAssaultCarbine > 0
	Set count to GetItemCount WeapNVAssaultCarbine
	RemoveItem WeapNVAssaultCarbine count
	AddItem WithAmmoNVAssaultCarbineLoot 1
endif

AddItem LootGrenadeFrag10 1

Set aaaSettlementFortRaid.recalltimer to 5
Set rearmed to 1

endif

if healed == 1 && aaaSettlementFortRaid.recalltimer == 0
Set aaaSettlementFortRaid.healguards to 0
Set healed to 0
endif

if rearmed == 1 && aaaSettlementFortRaid.recalltimer == 0
Set aaaSettlementFortRaid.rearmguards to 0
Set rearmed to 0
endif

if aaaSettlementFortRaid.resetguards == 1 && recalled == 0
if isFormValid == 1 && thismarker.isFormValid == 1
	if thismarker
		thismarker.disable
		thismarker.markfordelete
	endif
endif
kill
disable
markfordelete
Set aaaSettlementFortRaid.recalltimer to 5
Set recalled to 1
endif

if Active == 1

Set Button to GetButtonPressed

if Button == 0 
	Activate
	Set Active to 0
elseif Button == 1
	disable
	markfordelete
	Set Active to 0
elseif Button == 2
	Set Active to 0
endif

endif

if getdead == 0

	if isFormValid == 1 && thismarker.isFormValid == 1 && thismarker

		set dx to getpos x
		set dx to dx - thismarker.getpos x
		set dy to getpos y
		set dy to dy - thismarker.getpos y
		set dz to getpos z
		set dz to dz - thismarker.getpos z
			
		set d2 to dx * dx + dy * dy + dz * dz
		

		if isFormValid == 1 && d2 > 4096 && (GetInSameCell player || Player.GetInSameCell WaterWellRef || Player.GetInSameCell RaidAlarmRef || Player.GetInSameCell PatrolMarkerARef || Player.GetInSameCell PatrolMarkerBRef || Player.GetInSameCell PatrolMarkerCRef || Player.GetInSameCell PatrolMarkerDRef)
			if thismarker.isFormValid == 1 && thismarker
				if getdead == 0 && isincombat == 0
					MoveTo thismarker
				endif
			endif
		endif

	endif

else

	if isFormValid == 1 && thismarker.isFormValid == 1
		if thismarker
			thismarker.disable
			thismarker.markfordelete
		endif
	endif

endif

end

begin onCombatEnd
if isFormValid == 1 && thismarker.isFormValid == 1
	if getdead == 0 && isincombat == 0 && thismarker
		MoveTo thismarker
	endif
endif
end

begin onDeath

if isFormValid == 1 && thismarker.isFormValid == 1
	if thismarker
		thismarker.disable
		thismarker.markfordelete
	endif
endif

Set aaaSettlementDaysCounter.citizencount to aaaSettlementDaysCounter.citizencount - 1
Set aaaSettlementDaysCounter.guardcount to aaaSettlementDaysCounter.guardcount - 1

if GetCauseOfDeath == -1
	if isFormValid == 1 && thismarker.isFormValid == 1
		if thismarker
			thismarker.disable
			thismarker.markfordelete
		endif
	endif
	disable
	markfordelete
endif

end

 

 

 

Agraveld Tor

Link to comment
Share on other sites

A script only needs a title to save, so comment out everything below the title and see if it saves.

 

If it doesn't save, the problem is in your title (probably that period but since it's an existing script I assume it's okay).

 

If the scripts saves with everything commented out except the title, then uncomment the variables. Save.

 

If that works, uncomment the smaller blocks. Save.

 

Do this until you find the block(s) that make the script not save. Then uncomment the begin and end parts but leave everything inside uncommented. Save. Then start uncommenting sections until you narrow it down.

 

It's the method of last resort, but from the sound of it you've tried everything else.

Edited by viennacalling
Link to comment
Share on other sites

Can anyone see a problem with this script.

 

 

 

scn aaaSettlementMainLogicScript

FLOAT	my	
FLOAT 	mx
FLOAT 	mz
FLOAT	distance	
FLOAT 	md		
FLOAT	px
FLOAT 	py
FLOAT 	pz
FLOAT	az		
FLOAT	ax	
FLOAT	activemarkerXAP
FLOAT	activemarkerYAP
FLOAT	activemarkerZAP
FLOAT	activemarkerXAPFaceing
FLOAT	activemarkerYAPFaceing
FLOAT	activemarkerZAPFaceing
FLOAT 	DeleteXP
FLOAT 	XP
SHORT	ZoomingON
SHORT	ZoomingRotatingOnOff	
SHORT	ObjectManipulation
SHORT	Stage
SHORT	DistanceX
SHORT	DistanceXTooFar
SHORT	SettlementStarted
SHORT	LockObjects
SHORT	DisplayControls
SHORT	ActivateKey
SHORT	BoundaryMarkers
SHORT	FenceControl
SHORT	RememberRotation
SHORT	PlaceOnce
SHORT	PlacementTimer
SHORT	StationaryGuardPlacement
SHORT	randomguardroll
SHORT	sguardr
SHORT	VertibirdAnimation
REF 		activemarker
REF		newguard
REF		newguardmarker
REF		currentref
REF		CurrentVertibird
REF		LastPlan

;;;;;;;;;;;;	Projects variables 

SHORT	WaterWell
SHORT	WoodenPallet
SHORT	ShackA
SHORT	ShackB
SHORT	ShackC
SHORT	MetalPallet
SHORT	WoodFence
SHORT	BoxcarWallA
SHORT	WoodStairs
SHORT	WoodGate
SHORT	BarricadeA
SHORT	BarricadeB
SHORT	MobileHome
SHORT	SuppliesStorage
SHORT	Table
SHORT	PlayerHome
SHORT	PlayerHomeDoor
SHORT	GuardTower
SHORT	MountedTurret
SHORT	Barracks
SHORT	Market
SHORT	PatrolMarkerA
SHORT	PatrolMarkerB
SHORT	PatrolMarkerC
SHORT	PatrolMarkerD
SHORT	RaidAlarm
SHORT	Bedroll
SHORT	WindmillGenerator
SHORT	StreetLight
SHORT	SolarGenerator
SHORT	StationaryGuardSniper
SHORT	StationaryGuardAR
SHORT	Armory
SHORT	LookoutTower
SHORT	Campfire
SHORT	ScavengerTruck
SHORT	VertibirdStrike
SHORT	CommArray
SHORT	WoodBeam
SHORT	SecurityCamera
SHORT	MedicTent

begin gamemode

;;;;;;;;;;;; Quest processing delay setting

if Stage == 2 && WoodFence == 0 && IsKeyPressed 46
Activemarker.moveTo DeleteMarkerRef
set DeleteXP to Activemarker.getPos x
Activemarker.setPos x DeleteXP 
Activemarker.disable
Set Activemarker to 0
Set WaterWell to 0
Set WoodenPallet to 0
Set ShackA to 0
Set ShackB to 0
Set ShackC to 0
Set MetalPallet to 0
Set WoodFence to 0
Set BoxcarWallA to 0
Set WoodStairs to 0
Set WoodGate to 0
Set BarricadeA to 0
Set BarricadeB to 0
Set MobileHome to 0
Set SuppliesStorage to 0
Set Table to 0
Set PlayerHome to 0
Set PlayerHomeDoor to 0
Set GuardTower to 0
Set MountedTurret to 0
Set Barracks to 0
Set Market to 0
Set PatrolMarkerA to 0
Set PatrolMarkerB to 0
Set PatrolMarkerC to 0
Set PatrolMarkerD to 0
Set RaidAlarm to 0
Set Bedroll to 0
Set WindmillGenerator to 0
Set StreetLight to 0
Set SolarGenerator to 0
Set StationaryGuardSniper to 0
Set StationaryGuardAR to 0
Set Armory to 0
Set LookoutTower to 0
Set Campfire to 0
Set ScavengerTruck to 0
Set VertibirdStrike to 0
Set CommArray to 0
Set WoodBeam to 0
Set SecurityCamera to 0
Set MedicTent to 0
if LastPlan
	Player.Additem LastPlan 1
endif
EnablePlayerControls
Set Stage to 7
endif


if Stage == 0 
SetQuestDelay aaaSettlementMainLogic, 0
elseif Stage == 2 
SetQuestDelay aaaSettlementMainLogic, .01
endif

if aaaSettlementDaysCounter.guardcap == 0
Set aaaSettlementDaysCounter.guardcap to 25
endif

if PlacementTimer < 0 
	Set PlacementTimer to 0
elseif PlacementTimer > 0
   	Set PlacementTimer to PlacementTimer  -  GetSecondsPassed
else 
endif

;;;;;; enabled project follows players view

if BoundaryMarkers == 0

if Stage == 2 && Activemarker.GetDistance WaterWellRef > DistanceX && SettlementStarted == 1
		ShowMessage aaaSettlementTooFar
		Set DistanceXTooFar to 1
		activemarker.sms aaaSettlementAMGlowGreen
		activemarker.pms aaaSettlementAMGlowRed
	elseif Stage == 2 && Activemarker.GetDistance WaterWellRef < DistanceX && SettlementStarted == 1
		Set DistanceXTooFar to 0
		activemarker.sms aaaSettlementAMGlowRed
		activemarker.pms aaaSettlementAMGlowGreen
endif

elseif BoundaryMarkers == 2

SHORT boundaryend
Set boundaryend to DistanceX + 3000

if Stage == 2 && Activemarker.GetDistance WaterWellRef > boundaryend && SettlementStarted == 1
		ShowMessage aaaSettlementTooFar
		Set DistanceXTooFar to 1
		activemarker.sms aaaSettlementAMGlowGreen
		activemarker.pms aaaSettlementAMGlowRed
	elseif Stage == 2 && Activemarker.GetDistance WaterWellRef < boundaryend && SettlementStarted == 1
		Set DistanceXTooFar to 0
		activemarker.sms aaaSettlementAMGlowRed
		activemarker.pms aaaSettlementAMGlowGreen
endif

else

SHORT boundarystart
SHORT boundaryend
Set boundarystart to DistanceX + 1000
Set boundaryend to DistanceX + 2000

if Stage == 2 && Activemarker.GetDistance WaterWellRef > boundarystart && Activemarker.GetDistance WaterWellRef < boundaryend && SettlementStarted == 1
		Set DistanceXTooFar to 0
		activemarker.sms aaaSettlementAMGlowRed
		activemarker.pms aaaSettlementAMGlowGreen
		ShowMessage aaaSettlementBoundaryMarkerRange
else
		Set DistanceXTooFar to 1
		activemarker.sms aaaSettlementAMGlowGreen
		activemarker.pms aaaSettlementAMGlowRed
endif

endif

if Stage == 2 && IsKeyPressed 44 && ZoomingON == 0 && ZoomingRotatingOnOff == 0 
		Set ZoomingON to 1 
		Set ZoomingRotatingOnOff to 1
	elseif Stage == 2 && IsKeyPressed 44 && ZoomingON == 1 && ZoomingRotatingOnOff == 0
		Set ZoomingON to 0
		Set ZoomingRotatingOnOff to 1
	else
endif

	if Stage == 2 && IsKeyPressed 256 && ZoomingON == 1 && ObjectManipulation == 1
		set distance to distance - 5
		Set ZoomingRotatingOnOff to 0
	elseif Stage == 2 && IsKeyPressed 256 && IsKeyPressed 21 && ZoomingON == 0 && ObjectManipulation == 1
		set activemarkerYAPFaceing to activemarkerYAPFaceing - 1
		Set ZoomingRotatingOnOff to 0
	elseif Stage == 2 && IsKeyPressed 256 && IsKeyPressed 45 && ZoomingON == 0 && ObjectManipulation == 1
		set activemarkerXAPFaceing to activemarkerXAPFaceing - 1
		Set ZoomingRotatingOnOff to 0
	elseif Stage == 2 && IsKeyPressed 256 && ZoomingON == 0 && ObjectManipulation == 1
		set activemarkerZAPFaceing to activemarkerZAPFaceing - 1
		Set ZoomingRotatingOnOff to 0
	elseif Stage == 2 && IsKeyPressed 257 && ZoomingON == 1 && ObjectManipulation == 1
		set distance to distance + 5
		Set ZoomingRotatingOnOff to 0
	elseif Stage == 2 && IsKeyPressed 257 && IsKeyPressed 21 && ZoomingON == 0 && ObjectManipulation == 1
		set activemarkerYAPFaceing to activemarkerYAPFaceing + 1
		Set ZoomingRotatingOnOff to 0
	elseif Stage == 2 && IsKeyPressed 257 && IsKeyPressed 45 && ZoomingON == 0 && ObjectManipulation == 1
		set activemarkerXAPFaceing to activemarkerXAPFaceing + 1
		Set ZoomingRotatingOnOff to 0
	elseif Stage == 2 && IsKeyPressed 257 && ZoomingON == 0 && ObjectManipulation == 1
		set activemarkerZAPFaceing to activemarkerZAPFaceing + 1
		Set ZoomingRotatingOnOff to 0
	else

endif

if Stage == 2 && activemarker != 0

	if DisplayControls == 0
		ShowMessage aaaSettlementSetupControls
	Set DisplayControls to 1
	endif

	DisablePlayerControls 0 0 1 0 0 0 1

	set py to player.getpos y
	set px to player.getpos x
	set pz to player.getpos z 
	set az to player.getangle z 
	set ax to player.getangle x
	activemarker.setangle x activemarkerXAPFaceing
	activemarker.setangle y activemarkerYAPFaceing
	activemarker.setangle z activemarkerZAPFaceing
	set mz to (sin ax) * distance
	set mz to pz - mz+80
	set mx to (sin az) * distance
	set my to (cos az) * distance
	set my to py+my
	set mx to px+mx
	Activemarker.setpos y my
	Activemarker.setpos x mx
	Activemarker.setpos z mz
	if PlacementTimer == 0
		Set PlaceOnce to 0
	endif

endif

if Stage == 2 && (StationaryGuardSniper == 1 || StationaryGuardAR == 1)
GuardPosRef.MoveTo Activemarker
endif

if Stage == 2 && VertibirdStrike == 1
VertibirdMarkerRef.MoveTo Activemarker
endif

;;;;;; project placement handling

if IsKeyPressed ActivateKey

if DistanceXTooFar == 0
	if Stage !=0
		if StationaryGuardSniper == 1 || StationaryGuardAR == 1
			if GuardPosRef.isFormValid == 1
				Set Stage to 5
			endif
		else
			Set Stage to 5
		endif
	endif
endif

endif

if Stage == 2 && WoodFence == 1 && isKeyPressed 46
 	Activemarker.moveTo DeleteMarkerRef
set DeleteXP to Activemarker.getPos x
Activemarker.setPos x DeleteXP 
Activemarker.disable
Set Activemarker to 0
Set WoodFence to 0
EnablePlayerControls
Set Stage to 7
if Player.GetItemCount aaaSettlementWoodFenceING > 1
		SHORT fencecount
		Set fencecount to Player.GetItemCount aaaSettlementWoodFenceING
		Set fencecount to fencecount - 1
		Player.RemoveItem aaaSettlementWoodFenceING fencecount
elseif Stage == 2 && BoxcarWallA == 1 && isKeyPressed 46
 		Activemarker.moveTo DeleteMarkerRef
	set DeleteXP to Activemarker.getPos x
	Activemarker.setPos x DeleteXP 
	Activemarker.disable
	Set Activemarker to 0
	Set BoxcarWallA to 0
	EnablePlayerControls
	Set Stage to 7
	if Player.GetItemCount aaaSettlementBoxcarWallAING > 1
			SHORT fencecount
			Set fencecount to Player.GetItemCount aaaSettlementBoxcarWallAING
			Set fencecount to fencecount - 1
			Player.RemoveItem aaaSettlementBoxcarWallAING fencecount
	endif
endif
Set RememberRotation to 0
endif

;;;;;; project will be placed

if Stage == 7
Activemarker.enable
Set Activemarker to 0
endif

if Stage == 5

Set Stage to 0

if WaterWell == 1
	WaterWellRef.MoveTo Activemarker
	WaterWellRef.Enable
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0		
						Set WaterWell to 0
							EnablePlayerControls
								Set Stage to 7
									PlaySound aaaSettlementConstruction
										Set SettlementStarted to 1
										aaaSettlementMapMarker.Enable
										aaaSettlementMapMarker.moveTo Player
										Set aaaSettlementMainQuest.WaterWellPlaced to 1
elseif WoodenPallet == 1
	Activemarker.PlaceAtMe aaaSettlementWoodenPallet 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set WoodenPallet to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif ShackA == 1
	Activemarker.PlaceAtMe aaaSettlementShackA 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set ShackA to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif ShackB == 1
	Activemarker.PlaceAtMe aaaSettlementShackB 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set ShackB to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif ShackC == 1
	Activemarker.PlaceAtMe aaaSettlementShackC 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set ShackC to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif MetalPallet == 1
	Activemarker.PlaceAtMe aaaSettlementMetalPallet 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set MetalPallet to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif WoodStairs == 1
	Activemarker.PlaceAtMe aaaSettlementWoodStairs 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set WoodStairs to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif WoodFence == 1
	if PlaceOnce == 0
		Activemarker.PlaceAtMe aaaSettlementWoodFence 1
			Set Stage to 2
				PlaySound aaaSettlementConstruction
					Set PlaceOnce to 1
						Set PlacementTimer to 6
elseif BoxcarWallA == 1
	if PlaceOnce == 0
		Activemarker.PlaceAtMe aaaSettlementBoxcarWallA 1
			Set Stage to 2
				PlaySound aaaSettlementConstruction
					Set PlaceOnce to 1
						Set PlacementTimer to 6
	endif
	Set Stage to 2
elseif WoodGate == 1
	Activemarker.PlaceAtMe aaaSettlementWoodGate 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set WoodGate to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif BarricadeA == 1
	Activemarker.PlaceAtMe aaaSettlementBarricadeA 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set BarricadeA to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif BarricadeB == 1
	Activemarker.PlaceAtMe aaaSettlementBarricadeB 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set BarricadeB to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif SuppliesStorage == 1
	Activemarker.PlaceAtMe aaaSettlementSuppliesStorage 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set SuppliesStorage to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
											Set aaaSettlementMainQuest.SuppliesStoragePlaced to 1
elseif MobileHome == 1
	Activemarker.PlaceAtMe aaaSettlementMobileHome 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set MobileHome to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif Table == 1
	Activemarker.PlaceAtMe aaaSettlementTable 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set Table to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif PlayerHome == 1
	Activemarker.PlaceAtMe aaaSettlementPlayerHome 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set PlayerHome to 0
								EnablePlayerControls
									Set Stage to 7
										Player.Additem aaaSettlementPlayerHomeDoorING 1 1
											PlaySound aaaSettlementConstruction
												Set aaaSettlementMainQuest.FortHQPlaced to 1
elseif PlayerHomeDoor== 1
	Activemarker.PlaceAtMe aaaSettlementPlayerHomeOutDoor 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set PlayerHomeDoor to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
											Set aaaSettlementMainQuest.FortHQDoorPlaced to 1
elseif GuardTower == 1
	Activemarker.PlaceAtMe aaaSettlementGuardTower 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set GuardTower to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif MountedTurret == 1
	Activemarker.PlaceAtMe aaaSettlementMountedTurret 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set MountedTurret to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
											if aaaSettlementDaysCounter.solargeneratorplaced == 0
												ShowMessage aaaSettlementPowerSourceRequired
											endif
elseif Barracks == 1
	Activemarker.PlaceAtMe aaaSettlementBarracks 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set Barracks to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
											Set aaaSettlementMainQuest.BarracksPlaced to 1
elseif Market == 1
	Activemarker.PlaceAtMe aaaSettlementMarket 1
		HankAndersonMRef.MoveTo Activemarker
		HankAndersonMRef.Enable
		HankAndersonPosRef.MoveTo ActiveMarker
		HankAndersonPosRef.Enable
		FLOAT angleoffset
		Set angleoffset to activemarkerZAPFaceing + 270
		HankAndersonMRef.SetAngle Z angleoffset
		HankAndersonPosRef.SetAngle Z angleoffset
		Set aaaSettlementDaysCounter.citizencount to aaaSettlementDaysCounter.citizencount + 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set Market to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
											Set aaaSettlementMainQuest.MarketPlaced to 1
elseif PatrolMarkerA == 1
	PatrolMarkerARef.MoveTo Activemarker
	PatrolMarkerARef.Enable
	Activemarker.PlaceAtMe DefaultHumanPatrolIdleMarker
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set PatrolMarkerA to 0
								EnablePlayerControls
									Set Stage to 7
										Set BoundaryMarkers to 0
											PlaySound aaaSettlementConstruction
elseif PatrolMarkerB == 1
	PatrolMarkerBRef.MoveTo Activemarker
	PatrolMarkerBRef.Enable
	Activemarker.PlaceAtMe DefaultHumanPatrolIdleMarker
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set PatrolMarkerB to 0
								EnablePlayerControls
									Set Stage to 7
										Set BoundaryMarkers to 0
											PlaySound aaaSettlementConstruction
elseif PatrolMarkerC == 1
	PatrolMarkerCRef.MoveTo Activemarker
	PatrolMarkerCRef.Enable
	Activemarker.PlaceAtMe DefaultHumanPatrolIdleMarker
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set PatrolMarkerC to 0
								EnablePlayerControls
									Set Stage to 7
										Set BoundaryMarkers to 0
											PlaySound aaaSettlementConstruction
elseif PatrolMarkerD == 1
	PatrolMarkerDRef.MoveTo Activemarker
	PatrolMarkerDRef.Enable
	Activemarker.PlaceAtMe DefaultHumanPatrolIdleMarker
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set PatrolMarkerD to 0
								EnablePlayerControls
									Set Stage to 7
										Set BoundaryMarkers to 0
											PlaySound aaaSettlementConstruction
												Set aaaSettlementMainQuest.PatrolMarkersPlaced to 1
elseif RaidAlarm == 1
	RaidAlarmRef.MoveTo Activemarker
	RaidAlarmRef.Enable
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set RaidAlarm to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif Bedroll == 1
	Activemarker.PlaceAtMe aaaSettlementBedroll 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set Bedroll to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif WindmillGenerator == 1
	Activemarker.PlaceAtMe aaaSettlementWindmill 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set WindmillGenerator to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif StreetLight == 1
	Activemarker.PlaceAtMe aaaSettlementStreetLightOff 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set StreetLight to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
											if aaaSettlementDaysCounter.solargeneratorplaced == 0
												ShowMessage aaaSettlementPowerSourceRequired
											endif
elseif SolarGenerator == 1
	SolarGeneratorRef.MoveTo Activemarker
	SolarGeneratorRef.Enable
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set SolarGenerator to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
											Set aaaSettlementDaysCounter.solargeneratorplaced to 1
elseif StationaryGuardSniper == 1
	GuardPosRef.MoveTo Activemarker
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set StationaryGuardSniper to 0
								EnablePlayerControls
									Set Stage to 7
										Set StationaryGuardPlacement to 1
										PlaySound aaaSettlementConstruction
										Set aaaSettlementDaysCounter.guardcount to aaaSettlementDaysCounter.guardcount + 1
										Set aaaSettlementDaysCounter.citizencount to aaaSettlementDaysCounter.citizencount + 1
elseif StationaryGuardAR == 1
	GuardPosRef.MoveTo Activemarker
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set StationaryGuardAR to 0
								EnablePlayerControls
									Set Stage to 7
										Set StationaryGuardPlacement to 2
										PlaySound aaaSettlementConstruction
											Set aaaSettlementDaysCounter.guardcount to aaaSettlementDaysCounter.guardcount + 1
											Set aaaSettlementDaysCounter.citizencount to aaaSettlementDaysCounter.citizencount + 1
elseif Armory == 1
	Activemarker.PlaceAtMe aaaSettlementArmory 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set Armory to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
											Set aaaSettlementDaysCounter.armoryplaced to 1
elseif LookoutTower == 1
	Activemarker.PlaceAtMe aaaSettlementLookoutTower 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set LookoutTower to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif Campfire == 1
	Activemarker.PlaceAtMe aaaSettlementCampfireOff 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set Campfire to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif ScavengerTruck == 1
	ScavengerTruckRef.MoveTo Activemarker
	ScavengerTruckRef.Enable
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set ScavengerTruck to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif VertibirdStrike == 1
	VertibirdMarkerRef.MoveTo Activemarker
	VertibirdRef.MoveTo PatrolMarkerARef 0, 0, 4320
	VertibirdRef.Enable
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set VertibirdStrike to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementFixOnThatPos
											Set BoundaryMarkers to 0
elseif CommArray == 1
	Activemarker.PlaceAtMe aaaSettlementCommArray 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set CommArray to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif WoodBeam == 1
	Activemarker.PlaceAtMe aaaSettlementWoodBeam 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set WoodBeam to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
elseif SecurityCamera == 1
	SecurityCameraRef.MoveTo Activemarker
	SecurityCameraRef.Enable
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set SecurityCamera to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
											Set aaaSettlementDaysCounter.securitycameraplaced to 1
elseif MedicTent == 1
	Activemarker.PlaceAtMe aaaSettlementMedictent 1
 			Activemarker.moveTo DeleteMarkerRef
			set DeleteXP to Activemarker.getPos x
				Activemarker.setPos x DeleteXP 
					Activemarker.disable
						Set Activemarker to 0
							Set MedicTent to 0
								EnablePlayerControls
									Set Stage to 7
										PlaySound aaaSettlementConstruction
											Set aaaSettlementDaysCounter.medictentplaced to 1
endif

endif

if StationaryGuardPlacement == 1 && Stage == 7

Set randomguardroll to GetRandomPercent

if randomguardroll < 33
	Set newguard to GuardPosRef.PlaceAtMe aaaSettlementFortGuardSSniperAAMTemplate
elseif randomguardroll < 66
	Set newguard to GuardPosRef.PlaceAtMe aaaSettlementFortGuardSSniperAF
else
	Set newguard to GuardPosRef.PlaceAtMe aaaSettlementFortGuardSSniperHM
endif

newguard.MoveTo GuardPosRef

Set newguardmarker to GuardPosRef.PlaceAtMe XMarker

Set StationaryGuardPlacement to 0

Set newguard to 0

elseif StationaryGuardPlacement == 2 && Stage == 7

Set randomguardroll to GetRandomPercent

if randomguardroll < 33
	Set newguard to GuardPosRef.PlaceAtMe aaaSettlementFortGuardSARAAMTemplate
elseif randomguardroll < 66
	Set newguard to GuardPosRef.PlaceAtMe aaaSettlementFortGuardSARAF
else
	Set newguard to GuardPosRef.PlaceAtMe aaaSettlementFortGuardSARCF
endif

newguard.MoveTo GuardPosRef

Set newguardmarker to GuardPosRef.PlaceAtMe XMarker

Set StationaryGuardPlacement to 0

Set newguard to 0

endif

	if Stage == 6
		Set XP to Activemarker.getPos x
		Activemarker.setPos x XP
		Set ActivateKey to GetControl 5
		if RememberRotation == 0
			Set activemarkerXAPFaceing to 0
			Set activemarkerYAPFaceing to 0
		endif
		Set Stage to 2
	endif

end

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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