I am unsure if this will work....

Topics regarding Scripting with Reality Factory
Post Reply
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

I am unsure if this will work....

Post by Jay » Wed Sep 24, 2008 4:30 pm

Once again i am asking if something is possible with simkin.... i have this piece of code:

Code: Select all

	REALMODIFY		[0]
	TEMP_ABILITY	[0]
	
	ABILITY
	{
		NAME		[NULL]
		MANACOST	[0]
		ACTIVE		[false]
		ALWAYS		[false]
		MODIFYFORM	[NULL]
		MODIFYTYPE	[NULL]
		CASTONSELF	[false]
		CASTTIME	[0]
		EXTRACODE	[NULL]
		
		Use[ (char,target)
		{
			if(not ACTIVE)
			{
				if(not ALWAYS)
				{
					return 0;
				}
			}
			if(CASTONSELF)
			{
				target=StringCopy(char);
			}
			REALMODIFY=@MODIFYFORM;
			ModifyAttribute(MODIFYTYPE,REALMODIFY,target);
			if(not EXTRACODE="NULL")
			{
				@EXTRACODE;
			}
			ACITVE=false;
		} ]
		
		FillAttributes[ (name,mcost,mod,modt,castself,ctime,code,alw)
		{
			NAME=StringCopy(name);
			MANACOST=StringCopy(mcost);
			ACTIVE=false;
			MODIFYFORM=StringCopy(mod);
			MODIFYTYPE=StringCopy(modt);
			CASTONSELF=StringCopy(castself);
			CASTTIME=StringCopy(ctime);
			EXTRACODE=StringCopy(code);
			ALWAYS=StringCopy(alw);
		} ]
	}
	
	ABILITIES
	{
        0       [NULL]
        1       ["Concentration",10,"0","concentrate",true,1.0,"ActivateAbilities()",true]
        2       ["Parry",5,"1","parry",true,0.5,"if(HaveMastery(char,"Parry") ActivateAbility("CounterAttack")",false]
        3       ["Deflect",5,"1","deflect",true,0.5,"NULL",false]
        4       ["Avoid",5,"1+HaveMastery(char,"Avoid")+HaveMastery(char,"Onehanded")","autoblock",true,0.5,"NULL",false]
        5       ["Block",5,"3","autoblock",true,0.5,"NULL",false]
	}
	
	CreateAbility[ (nr)
	{
		TEMP_ABILITY=ABILITY;
		TEMP_ABILITY.FillAttributes(@ABILITIES[nr]);
		ABILITIES[nr]=TEMP_ABILITY;
	} ]
	
	CreateAllAbilites[ ()
	{
		for i=0 to ABILITIES.numChildren
		{
			CreateAbility(i);
		}
	} ]
What it should do is to take the object 'ABILITY' as a base object for all ABILITY-objects. Then i have a function which casts a member of ABILITIES to the ABILITY-Object-Type by copying the ABILITY-base-object and filling it with the help of the former string which was the member of ABILITIES. Then i copy the new object into the the old array member. I also use indirection to make the abilities have extra effects... Is this all possible?
Everyone can see the difficult, but only the wise can see the simple.
-----

Post Reply