Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name: Password:
Ambiera Forum > CopperCube > Programming and Scripting
How do I get access to array from a different function?
Author Text

Registered User
2022-04-24 20:35:02

So, recently I was working on some sort of pathfinding. Turns out, after (mostly) a single day of having no life, I was able to do this! Sure, it uses the scene nodes as a path points (I have no idea how to call these), but hell, I think it is insane that I've managed to do this. Now I have to do everything else for my AI, since I only made a pathfinding. But here's the problem: to generate a path, behavior uses a single function. It looks kinda like that:
PathFind (Pos, PlrPos, this.Folder); // this part lies in a prototype.onAnimate function, calling the function named as "PathFind"

function PathFind (Pos, PlrPos, Folder) // this one is a standart function

And the problem is that I don't know how do I take the resulting array (which contains the coordinates of points) from this function to the behavior. Things like "this.Path" didn't really worked. How do I get access to it then?

Registered User
2022-04-24 21:53:38

Your function probably returns path..
so you can acces it maybe something like this..
(function return value will be mypath variable now)

if you call it like this:
PathFind (Pos, PlrPos, this.Folder);
then you dont store return value anywhere.
if you call it so:
mypath=PathFind (Pos, PlrPos, this.Folder);
then its stored in mypath variable.
But it all depends what and how is your function build-- there is many ways how to do it.

Registered User
2022-04-25 07:32:13

Oh, that actually works, sven! Thank you very much for help.

2022-04-26 17:24:08

Dekon_17, Coppercube doesn't have pathfinding node.

Dekon_17, you are a genius to do pathfinding in Coppercube.

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Internation?l" (you are not logged in)




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Copyright© 2020 Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact