Page 1 of 1

Coding problems

Posted: Sat Aug 07, 2010 3:19 pm
by Darma
Hey, I'm not really a coder but I can understand when I see some codes but when I want to make something new... I usually get some error.

Can anyone help me with this:

Code: Select all

//======================================================================
// Trigger to give a aug to the player for DXDL_Training - Darma Labs Inc. 2010 - 2012
//======================================================================
class AddAugTrigger extends Trigger;

var travel AugmentationManager AugmentationSystem;

function AddAug(class<Augmentation> WantedAug)
{
	local Augmentation anAug;

	if (AugmentationSystem != None)
	{
		anAug = AugmentationSystem.GivePlayerAugmentation(WantedAug);

		if (anAug == None)
			ClientMessage(GetItemName(String(WantedAug)) $ " is not a valid augmentation!");
	}
}

function Touch(Actor toucher)
{
AddAug(toucher,WantedAug); // I think it's this the problem
}

defaultproperties
{
}
My error is "C:\DeusEx\TrainingSystem\Classes\AddAugTrigger.uc(23) : Error, Call to 'AddAug': type mismatch in parameter 1"

But I don't think it's the only error in my file :/

Re: Coding problems

Posted: Sun Aug 08, 2010 8:06 pm
by EER
The function AddAug takes one argument, you pass two, which is unlikely to be correct.

The error says 'type mismatch in parameter 1', this suggests that the parameter you pass is of a different type than the one the function expects. Given that you pass an Actor as first parameter, and the function is defined to receive "class<Augmentation>" I would expect that to cause your error.

Re: Coding problems

Posted: Mon Aug 09, 2010 12:25 am
by ~DJ~
Well I gave him my code.. at ZxC forums. Which is working..

Re: Coding problems

Posted: Mon Aug 09, 2010 12:02 pm
by EER
So I guess that means the problem of the TS has been resolved? In that case: @TS: nvm for now, but please edit your post if your issue has been resolved.

Re: Coding problems

Posted: Wed Aug 11, 2010 11:51 am
by Darma
Yeah, it's solved but I got disconnected theses days because my cat broked my router :/
Thanks DJ for the code :D