Jump to content

Flowgraph and functions arguments


Marcousik
 Share

Go to solution Solved by Rick,

Recommended Posts

I found this function in the FPSPlayer.lua


--Increase health
function Script:ReceiveHealth(healthPoints)--in

    --Increase health
    self.health = self.health + healthPoints;

    --Health can not be more then maximum health
    if self.health > self.maxHealth then
        self.health = self.maxHealth
    end
    
    --Call Health received output
    self.component:CallOutputs("HealthReceived")
end

 

I can call this function through the flowgraph using the output Function (example calling the function self:Heal(10) ) of another script but it returns an error about the argument "healthPoints" as nil value, whatever I give as argument.

function Script:Heal(healthPoints)--out
    self.component:CallOutputs("Healing")
end

What am I doing wrong ? thx for help

 

 

 

Link to comment
Share on other sites

  • Solution

Notice how the function has --in at the end. That tell the editor it can be called. When --in functions exist with parameters you need a function that has --args and returns a value (I believe is the name) and then that'll show up and you can drag that function to the dot that should show up in the flowgraph on the line of the ReceiveHealth() function. So dots show up on that line and they act as argument placeholders (1 for each argument). When you drag a --args function to that line, that function will be called and the returning value will act as the argument value.

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...