Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > Star Wolves

Star Wolves 3D space RPG with deep strategy and tactical elements

View Poll Results: What should I Prioritize on?
Basebuilding! 1 25.00%
Balancing! 0 0%
The Mod Manager! 0 0%
Asteroid ore-dropping! 0 0%
Intensive Bugfixing! 3 75.00%
Voters: 4. You may not vote on this poll

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #22  
Old 08-22-2016, 12:44 PM
nocalora29's Avatar
nocalora29 nocalora29 is offline
¯\_ ͯ‿ ͯ_/¯
 
Join Date: Dec 2011
Posts: 518
Default

Thanks for the hint, im going to look into it

And I don't really plan to stop the development of this mod until im Finished, the main thing im working on right now is basically the Path-finding for the CPU-Players, I have found a way to do that, but that would require me to write 120x120 paths from systems to systems, since I will never write that amount of code by hand I am currently writing a additional program with VB.NET to automatically index all systems in Star wolves and using an algorithm to create lua code which represent table's with the shortest way to a possible system

like so:
{"_AI_IN_THIS_SYSTEM", "AI_NEEDS_TO_GO_TO_THIS_SYSTEM", {"Shortest way from Neighbor of THIS_SYSTEM to AI_TARGET_SYSTEM"}};

Im struggling to do that tbh, but I won't give up!.

-----------------------------------------------
Also, I tweaked the "Repair" function at the maintance stations, so you won't immediatley have 100% HP, instead you will have to wait a certain amount of time until your HP Completely recharges, increments are at 10% of total Hull HP each 0.1s

BUT like with all of my "Plugins" it is completely customizable, see the "InitTeamScript" Section.

I named it ASRS:
Code:
--      /\          /\\ \\  /\\/\\       /\\/\\\\\\\  /\\      /\\\\\\\\
--     /\ \\      /\\    /\\/\\/\ /\\   /\\\/\\    /\\/\\      /\\      
--    /\  /\\      /\\      /\\/\\ /\\ / /\\/\\    /\\/\\      /\\      
--   /\\   /\\       /\\    /\\/\\  /\\  /\\/\\\\\\\  /\\      /\\\\\\  
--  /\\\\\\ /\\         /\\ /\\/\\   /\  /\\/\\       /\\      /\\      
-- /\\       /\\  /\\    /\\/\\/\\       /\\/\\       /\\      /\\      
--/\\         /\\   /\\ \\  /\\/\\       /\\/\\       /\\\\\\\\/\\\\\\\\
--                                 -  =   V E R S I O N   1 . 1   =  -                              
--/\\\\\\\    /\\\\\\\\/\\\\\\\        /\       /\\/\\\\\\\      /\\ \\   /\\\ /\\\\\\      /\       /\\\ /\\\\\\/\\    /\\\\     /\\\     /\\
--/\\    /\\  /\\      /\\    /\\     /\ \\     /\\/\\    /\\  /\\    /\\      /\\         /\ \\          /\\    /\\  /\\    /\\  /\ /\\   /\\
--/\\    /\\  /\\      /\\    /\\    /\  /\\    /\\/\\    /\\   /\\      	   /\\        /\  /\\         /\\    /\\/\\        /\\/\\ /\\  /\\
--/\ /\\      /\\\\\\  /\\\\\\\     /\\   /\\   /\\/\ /\\         /\\          /\\       /\\   /\\        /\\    /\\/\\        /\\/\\  /\\ /\\
--/\\  /\\    /\\      /\\         /\\\\\\ /\\  /\\/\\  /\\          /\\       /\\      /\\\\\\ /\\       /\\    /\\/\\        /\\/\\   /\ /\\
--/\\    /\\  /\\      /\\        /\\       /\\ /\\/\\    /\\  /\\    /\\      /\\     /\\       /\\      /\\    /\\  /\\     /\\ /\\    /\ \\
--/\\      /\\/\\\\\\\\/\\       /\\         /\\/\\/\\      /\\  /\\ \\        /\\    /\\         /\\     /\\    /\\    /\\\\     /\\      /\\
--                                                                                                                                        
--  /\\ \\      /\\   /\\\\\\\    /\\/\\\\\\\  /\\\ /\\\\\\
--/\\    /\\ /\\   /\\/\\    /\\  /\\/\\    /\\     /\\    
-- /\\      /\\       /\\    /\\  /\\/\\    /\\     /\\    
--   /\\    /\\       /\ /\\      /\\/\\\\\\\       /\\    
--      /\\ /\\       /\\  /\\    /\\/\\            /\\    
--/\\    /\\ /\\   /\\/\\    /\\  /\\/\\            /\\    
--  /\\ \\     /\\\\  /\\      /\\/\\/\\            /\\    
--Author: Nocalora29

--Replaces:
--Data\Scripts\Include\DockStation.script -> DialogR_fin()

--This Plugin disables the INSTANT 100% HP Recovery from Repair Stations
--Instead of magically repairing your hull to 100% in a sec, this Plugin -
--will Repair your Mothership over time, but only if your mothership isn't moving.
Default_ASRS_Name = "ASRS";
Default_ASRS_Error_InProg = "ASRS: Repair allready in Progress!";
Default_ASRS_Error_MoveDetect = "ASRS: Repair Cancelled!, you need to stand still!";
Default_ASRS_Fin = "ASRS: Successfully Repaired!";

__ASRS_InProgress = FALSE;
function _ASRS_RepairMS_Init()
	local AllowASRS = GetQuestLabel("__ASRS@Config_Allow");
	if (AllowASRS=="True") then
		_ASRS_RepairMS();
	else
		local N=GetPlayerCredits();
		if (N>=1000) then
			RepairBase();
			SubPlayerCredits(1000);
			OutputToScreenLog("#UI_TradeStationOkRepair",7);
		else	
			OutputToScreenLog("#UI_TradeStationNotRepair",7);
		end;
	end;

end;

function _ASRS_RepairMS()
	if (__ASRS_InProgress==FALSE) then
		__ASRS_InProgress = TRUE;
		local _ASRS_Allow = GetQuestLabel("");
		local PCash = GetPlayerCredits();
		local RepCost=1000;
		local _PCarc = GetPlayerMotherShip();
		local _PMSMaxHP = _PCarc:GetMaxHP();

		if (PCash>=RepCost) then
			SubPlayerCredits(RepCost);
			--Begin Repair Process
			local MSPos = _PCarc:GetPosition();
			setglobal("_ASRS_MSPos", MSPos);
			
			_ASRS_RepairMS_2(_PMSMaxHP);
		else	
			OutputToScreenLog("#UI_TradeStationNotRepair",7);

		end;
	else
		OutputToScreenLog(Default_ASRS_Error_InProg,7);
	end;
end;

__ASRS_MS_CompleteP = 0;
__ASRS_MS_MaxSpeed = 0;
__ASRS_MS_MaxSteeringPower = 0;
__ASRS_ILShowTime = 0.4;
__ASRS_OutOfSphere = FALSE;
function _ASRS_RepairMS_2(_PMSMaxHP)
	setglobal("_ASRS_PMSMaxHP", _PMSMaxHP);
	local RepDelay = tonumber(GetQuestLabel("__ASRS@Config_RepairDelay"));
	local RepAmount = tonumber(GetQuestLabel("__ASRS@Config_RepairAmount"));
	local UsePerc = GetQuestLabel("__ASRS@Config_UsePercentageRepair");
	local Perc = tonumber(GetQuestLabel("__ASRS@Config_Percentage"));
	local Req_StandStill = GetQuestLabel("__ASRS@Config_Require_StandStill");
	local DisDrives	= GetQuestLabel("__ASRS@Config_DisableDrive");
	local CRadius = tonumber(GetQuestLabel("__ASRS@Config_StandStill_Radius"));
	local _PCarc = GetPlayerMotherShip();
	local _PCurHP = _PCarc:GetCurHP();
	local PercRAND = GetQuestLabel("__ASRS@Config_PercRAND");
	local PercRANDMin = tonumber(GetQuestLabel("__ASRS@Config_PercRAND_Min"));
	local PercRANDMax = tonumber(GetQuestLabel("__ASRS@Config_PercRAND_Max"));

	--Options
	-- // Disable Drives
	if (DisDrives=="True") then
		__ASRS_MS_MaxSpeed = _PCarc:GetMaxSpeed();
		__ASRS_MS_MaxSteeringPower = _PCarc:GetSteeringPower();
		_PCarc:SetMaxSpeed(0);
		_PCarc:SetSteeringPower(0);
	end;
	--Repair
	if (Req_StandStill=="False") then
		--Does not need to stand still
		if (UsePerc=="False") then
			--Value Repair
			if (_PMSMaxHP >= _PCurHP) then
				_PCarc:SetHP(_PCurHP + RepAmount);
				Timer_Seq(RepDelay, _ASRS_RepairMS_Loop);
			end;
		else
			--Percentage Repair
			if (_PMSMaxHP >= _PCurHP) then
				local PercVal = 0;
				if (PercRAND=="False") then 
					PercVal = ((_PMSMaxHP / 100) * Perc); 
				else 
					PercVal = ((_PMSMaxHP / 100) * random(PercRANDMin, PercRANDMax)); 
				end;
				_PCarc:SetHP(_PCurHP + PercVal);
				
				__ASRS_MS_CompleteP = (_PMSMaxHP / _PCurHP) * 100
				OutputToScreenLog("ASRS: "..format("%.2f", __ASRS_MS_CompleteP).."% Completed", RepDelay+__ASRS_ILShowTime);
				
				Timer_Seq(RepDelay, _ASRS_RepairMS_Loop);
			end;
		end;
	else
		--Does need to stand still
		--_ASRS_OutsideRange_Trigger = CreateTrigger();
		--_ASRS_OutsideRange_Trigger:AttachEvent(_EVENT_INSIDEVOLUME);
		--_ASRS_OutsideRange_Trigger:SetObject(_PCarc);
		--_ASRS_OutsideRange_Trigger:SetVolume(_PCarc:GetPosition(), CRadius);
		--_ASRS_OutsideRange_Trigger:AttachCondition(TrueCondition);
		--_ASRS_OutsideRange_Trigger:AttachAction(_ASRS_RepairMS_LeaveRadius);
		--_ASRS_OutsideRange_Trigger:Activate();
		_ASRS_OutsideRange_Trigger = NewTrigger("outside", TrueCondition, _ASRS_RepairMS_LeaveRadius, _PCarc, _PCarc:GetPosition(), CRadius, FALSE);
		_ASRS_OutsideRange_Trigger:Activate();
		
		if (__ASRS_OutOfSphere==FALSE) then
			if (UsePerc=="False") then
				--Value Repair
				if (_PMSMaxHP >= _PCurHP) then
					_PCarc:SetHP(_PCurHP + RepAmount);
					Timer_Seq(RepDelay, _ASRS_RepairMS_Loop);
				end;
			else
				--Percentage Repair
				if (_PMSMaxHP >= _PCurHP) then
					local PercVal = 0;
					if (PercRAND=="False") then 
						PercVal = ((_PMSMaxHP / 100) * Perc); 
					else 
						PercVal = ((_PMSMaxHP / 100) * random(PercRANDMin, PercRANDMax)); 
					end;
					_PCarc:SetHP(_PCurHP + PercVal);
					
					__ASRS_MS_CompleteP = (_PCurHP / _PMSMaxHP) * 100
					OutputToScreenLog("ASRS: "..format("%.2f", __ASRS_MS_CompleteP).."% Completed", RepDelay+__ASRS_ILShowTime);
				
					Timer_Seq(RepDelay, _ASRS_RepairMS_Loop);
				end;
			end;
		else
			--Movement Detected
			OutputToScreenLog(Default_ASRS_Error_MoveDetect,7);
			__ASRS_InProgress = FALSE;
			__ASRS_OutOfSphere = FALSE;
			_ASRS_OutsideRange_Trigger:Delete();
		end;
	end;
	--Finish
	if (_PCurHP>=_PMSMaxHP) then 
		__ASRS_InProgress = FALSE;
		__ASRS_OutOfSphere = FALSE;
		_ASRS_OutsideRange_Trigger:Delete();
		
		_PCarc:SetHP(_PMSMaxHP); 
		OutputToScreenLog(Default_ASRS_Fin,7);
		
		--Options
		-- // Enable Drives
		if (DisDrives=="True") then
			_PCarc:SetMaxSpeed(__ASRS_MS_MaxSpeed);
			_PCarc:SetSteeringPower(__ASRS_MS_MaxSteeringPower);
		end;
		
	end;
end;

function _ASRS_RepairMS_LeaveRadius()
	__ASRS_OutOfSphere = TRUE;
end;

function _ASRS_RepairMS_Loop()
	local _PMSMaxHP = getglobal("_ASRS_PMSMaxHP");
	_ASRS_RepairMS_2(_PMSMaxHP);
end;
You could in theory allready use this, only be sure to load it by any system.lst and Place Replace this COMPLETE Function in scripts\dockstation.script
Code:
function DialogR_fin0()

end;
with
Code:
function DialogR_fin0()
-- > @Plugins\ASRS.lua
	_ASRS_RepairMS_Init();
end;
-InitTeamScript-
Code:
	SetQuestLabel("__ASRS@Config_Allow", 				"True");		-- ASRS Plugin - Boolean - Allow ASRS? [True = Use ASRS, False = Use Vanilla Repair System]
	SetQuestLabel("__ASRS@Config_RepairDelay", 			0.1);			-- ASRS Plugin - Repair Rate (Seconds)
	SetQuestLabel("__ASRS@Config_RepairAmount", 		100);			-- ASRS Plugin - Repair amount per RepairDelay
	SetQuestLabel("__ASRS@Config_UsePercentageRepair",  "True");		-- ASRS Plugin - Repair depending on Percentage of Max HP
	SetQuestLabel("__ASRS@Config_Percentage",			3);				-- ASRS Plugin - Percentage Value
	SetQuestLabel("__ASRS@Config_PercRAND",				"True");		-- ASRS Plugin - Eanble Random Repair Percentage
	SetQuestLabel("__ASRS@Config_PercRAND_Min",			3);				-- ASRS Plugin - Random Percentage Min
	SetQuestLabel("__ASRS@Config_PercRAND_Max",			7);				-- ASRS Plugin - Random Percentage Max
	SetQuestLabel("__ASRS@Config_DisableDrive",			"False");		-- ASRS Plugin - Disable Mothership Drives (No Movement Possible until Completion)
	SetQuestLabel("__ASRS@Config_Require_StandStill", 	"True");		-- ASRS Plugin - Require - Standing Still (Mothership)
	SetQuestLabel("__ASRS@Config_StandStill_Radius",	5);			    -- ASRS Plugin - Max Range before Cancel of Repair
Just paste the above code ANYWHERE in the InitTeamScript file
If anyone feels like it, feel free to install it and tell me how it feels like.

-System.lst- Section
IF you use Expansion Mod: use the plugins\system.lst and write it in there, also place the file you created with the code at top of this post and you're good to go.
IF you use the vanilla game: use the scripts\system.lst and write in in there also, watch out that you place the file where you have pointed at it in the system.lst

=This works for a vanilla game and a modded game=
__________________
Discord: Nocalora#6847 | SW3.Expansion Thread | SWX.MouseMovementFix | SWX.TUVMark+Src (.tuv editing Tool) | SWX.SLOTMark+Src (.ini Slots editing Tool)

Last edited by nocalora29; 08-22-2016 at 05:02 PM.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:51 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.