Help Again-Zombie 2


I RE-MADE the game. It works better now. But now it just has problems with attacking. Something about 3 parameters passed and 4 expected.

Also the zombies don't de-spawn after their killed. They don't attack either.

Again, Pixie's tutorial/game. (link)


you've got a Function (or a Command... or a Delegate+Script Attribute) that requires 4 inputs/Values (Arguments/Parameters) for the Function's scripting, whereas, you only inputted 3 Values.

(A Function does NOT have to have Arguments/Parameters NOR a RETURN_TYPE, they're both optional. All combinations of Functions: no Argument/Parameter no Return_Type, yes Argument/Parameter no Return_Type, no Argument/Parameter yes Return_Type, and lastly, yes Argument/Parameter yes Return_Type)

for example:

<game name="example">
  <attr name="sum_integer_attribute" type="int">0</attr>
  <attr name="start" type="script">
    // using/calling a Function:
    // NAME_OF_FUNCTION (Argument_1, Argument_2, etc more or less Arguments) // Arguments match up with their Parameters by position, so 'Argument_1' (25) will match up with my 'input_integer_value_1_parameter'
    game.sum_integer_attribute = addition_of_two_numbers_function (25) // <---- Arguments are the Values (either as direct Values, or as VARIABLES - which are storing your Values) inside of the Function's parenthesis, which are the inputs to be used for your Function's scripting
    msg ("The sum is: " + game.sum_integer_attribute)

// The Function than takes and puts those Arguments (your input values: arguments) into temporary/local VARIABLES for the Function's scripting which are called: 'Parameters', which in this example, I've named/labeled them as: 'input_integer_value_1_parameter' and 'input_integer_value_2_parameter'
// also, the, type="NAME_OF_ATTRIBUTE_TYPE_,_AKA_:_(string, int, double, boolean, etc)", in the Function's header/signature, is the 'Return_Type'
<function name="addition_of_two_numbers_function" parameters="input_integer_value_1_parameter, input_integer_value_2_parameter" type="int">
  return (input_integer_value_1_parameter + input_integer_value_2_parameter)

// ouput:
// ERROR: 2 required input integer values for your Function's use/call:
// addition_of_two_numbers_function (25)
// addition_of_two_numbers_function (25, YOUR_MISSING_NEEDED_INPUT_INTEGER_VALUE)

// NO Error fix:
// addition_of_two_numbers_function (25, 75) // 'Argument_1' (25) matches up with my 'input_integer_value_1_parameter' and 'Argument_2' (75) matches up with my 'input_integer_value_2_parameter' 
// result: 
// The sum is: 100

Log in to post a reply.