View Single Post
  #8  
Old 08-03-2010, 03: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 03:53 PM.
Reply With Quote