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

Reply
 
Thread Tools Display Modes
  #1  
Old 08-03-2010, 04:42 PM
Aleksandar Aleksandar is offline
Registered Member
 
Join Date: Aug 2010
Posts: 10
Default

Quote:
Originally Posted by Trucidation View Post
Haha, edited while edited. Thanks, looks like I got it.

Hmm, it looks like { exp cost, { pre-req1, pre-req2, ... }, { choose one of these1, choose one of these2 }.

The third {} appears to be used only by the gun specialisations (choose HC / AC / Laser). I wonder if we can put other perks in here as well. E.g. choose between Criticals_1 or Hard_to_Kill.
Put it here for reference. Also, proposing a fix to the CanAddProperty function below
Code:
function CanAddProperty-Shark(pilot, property)

	if property == nil then
			return 0;
	else
		local nPrereqs = getn(property[2]);
		local nDenials = getn(property[3]);
		local prop_ = property[2];
		local deny_ = property[3];-
	
		local prereqsMet = FALSE;
		local deniesMet = FALSE;
		local i = 1;
	
		if(nPrereqs > 0) then
			if(pilot:HasProperty(prop_[1])) then 
				prereqsMet = TRUE;
				i = i+1;
			elseif
				return FALSE; --no prereq met
			end;

	-- Retrieved the first prereq flag. Collate with others and return

			while ((i <= nPrereqs) and (prereqsMet ~= FALSE)) do
				prereqsMet = prereqsMet and (pilot:HasProperty(prop_[i]));
			end;
		end;
	
	--Prereqs calculated, check for denies

		if(nDenials > 0) then
		--restart the counter
			i = 1;
			while ((i < nDenials) and (deniesMet ~= TRUE)) do
				deniesMet = deniesMet or (pilot:HasProperty(prop_[i]));
			end;
		end;

	--Denies calculated; return prereqsMet && !deniesMet
	
	return (prereqsMet and (not deniesMet));

	end; --property not nil
end; --eof
Feel free to correct my syntax errors, I'm still new at this language... spent about 10 mins viewing the game's scripts and I'm already making improvements... I need to get a grasp on language constructors and keywords. So far I've noticed I can do for, foreach and while - quite enough to build up anything more serious if there's a need. The lists help too, so if a need arises for a HashMap, I'll hash one out (hehe) for you.

Btw, I'm Aleksandar, a math/IT/AI graduate. Not much of a Touhou fan, but I adore bullethell shmups.

Last edited by Aleksandar; 08-03-2010 at 04:53 PM.
Reply With Quote
  #2  
Old 08-03-2010, 11:10 PM
Trucidation
Guest
 
Posts: n/a
Default

I don't know LUA so I can't comment on that (really ought to look it up but things just keep happening...) - how do you tell the game to use new functions you add? I'm guessing you just add calls from other scripts?

Not much of a technical guy, I'm just a 2-bit musician
Reply With Quote
  #3  
Old 08-03-2010, 11:48 PM
Goblin Wizard Goblin Wizard is offline
Approved Member
 
Join Date: Oct 2008
Posts: 508
Default

@Aleksandar - nice to see an educated programmer here. I like poking through the scripts but it's just a hobby.
btw if I understand correctly - your script does the same as original only in other way. AFAIK CanAddProperty function is base function called from the exe so you shouldn't change it's name.
Reply With Quote
  #4  
Old 08-04-2010, 12:43 AM
Aleksandar Aleksandar is offline
Registered Member
 
Join Date: Aug 2010
Posts: 10
Default

Quote:
Originally Posted by Goblin Wizard View Post
@Aleksandar - nice to see an educated programmer here. I like poking through the scripts but it's just a hobby.
btw if I understand correctly - your script does the same as original only in other way. AFAIK CanAddProperty function is base function called from the exe so you shouldn't change it's name.
In a somewhat better and cleaner way. I understand that they never planned on having more than 3 prereqs and/or denials, but really - hardcoding to check only for one, two or three arguments is really lame. If you put in four denials the script would just return FALSE without checking anything. Mine evaluates the first one and collates (uses all the solutions so far in calculating the next one) all the others, either until it runs out of arguments or one of the prereqs hits FALSE. Then same (but inverse) applies for Denials (i just call them that way) after which the prereqsMet and !deniesMet vars are anded.

This way I can have as many prereqs and denies as I want and I'm not limited only to the first three. I believe these kind of bad coding practices are the root of all the limitations, such as having only 6 pilots and that crap.
Reply With Quote
  #5  
Old 08-04-2010, 04:09 AM
Trucidation
Guest
 
Posts: n/a
Default

Yea, like how they hardcoded missile launch sfx to a single file instead of allowing us to use the work_sound tag (which are in the damn xml definitions ffs...), how adding sound to missile flight causes the game to CTD when it impacts (probably something unfinished there), not to mention the inconsistencies in the xmls, that kind of thing.
Reply With Quote
Reply

Thread Tools
Display Modes

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:32 PM.


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