|
2 registered members (Quad, VoroneTZ),
3,544
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
How to create Paths with WED
#236346
11/13/08 18:26
11/13/08 18:26
|
Joined: May 2006
Posts: 53 Puerto Rico
monchito
OP
Junior Member
|
OP
Junior Member
Joined: May 2006
Posts: 53
Puerto Rico
|
Hi: i want to know is a tutorial is available for the path creation in WED. How do i select one edge, edit etc. Every time i try a bunch of edges are created non intentionally on the wrong nodes. I know, i know...more practice.  and a good tutorial.  How do i create programatically?... if possible, like 'create path node' or something.I know the coords that i want, how do i insert the nodes with my coords. Actually i load the positions into an array and read the position as the entity walk, scan the area while walking, attack if near player and return to the next node. At the last node, reverse the path. If another entity in same path, adjust pan...let it pass...etc It works ok but i want to use the path in WED. Any help is welcome
|
|
|
Re: How to create Paths with WED
[Re: monchito]
#237307
11/19/08 15:30
11/19/08 15:30
|
Joined: Sep 2008
Posts: 9
Staakman
Newbie
|
Newbie
Joined: Sep 2008
Posts: 9
|
Current Code: /////////////////////////////////////////////////////////////// #define false 0 #define true 1
///////////////////// // local variables // /////////////////////
var CurrentNode = 1; /* CurrentNode */ //current node var NodeSkills[6]; /* NodeSkills */ //to store node skills var NodeArray[100]; /* NodeArray */ //array for target nodes var NodeAI = 0; /* NodeAI */ //índice for target nodes var NodeAC = 0; /* NodeAC */ //counter for target nodes var NodeAmount = 0; /* NodeAmount */ //number of nodes var NodeCounter = 0; /* NodeCounter */ //counter for general use var Nodelabels[100]; /* Nodelabels */ //array for node labels var NodeTI = 0; /* NodeTI */ //índice for node labels var NodeOrder[100]; /* NodeOrder */ //path order var NodeOI = 0; /* NodeOI */ //índice for path order var Fila[100]; /* Fila */ //FIFO array var FilaI = 0; /* FilaI */ //índice for FIFO var FilaC = 0; /* FilaC */ //counter for FIFO var Edges = 0; /* Edges */ //number of edges
function busca_limpa() //Empty all variables { NodeCounter = 0; while (NodeCounter <= NodeAmount) { Fila[NodeCounter] = 0; Nodelabels[NodeCounter] = NodeAmount; NodeOrder[NodeCounter] = 0; NodeCounter += 1; } FilaI = 0; FilaC = 0; NodeCounter = 0; NodeTI = 0; NodeOI = 0; }
function busca_largura(v) //label node v with 1 and put on the FIFO { Edges = 1; while (Edges != 0) { CurrentNode = path_nextnode(my,v,Edges); if (CurrentNode == 0) { Edges = 0; } else { if (Nodelabels[CurrentNode] > Nodelabels[v]) { Nodelabels[CurrentNode] = Nodelabels[v] + 1; FilaC += 1; Fila[FilaC] = CurrentNode; } Edges += 1; } } }
function busca_ordena() //feed an array with the order of the nodes that will be covered. { NodeAI = random(NodeAC); // int(random(NodeAC)); NodeOI = Nodelabels[NodeArray[NodeAI]]; NodeOrder[NodeOI] = NodeArray[NodeAI]; while (NodeOI > 1) { Edges = 1; CurrentNode = 1; while (CurrentNode != 0) { CurrentNode = path_nextnode(my,NodeOrder[NodeOI],Edges); if (CurrentNode != 0 && (Nodelabels[CurrentNode] < NodeOI)) { NodeOI -= 1; NodeOrder[NodeOI] = CurrentNode; CurrentNode = 0; } Edges +=1; } } NodeOI = 1; CurrentNode = NodeOrder[NodeOI]; }
function busca(w) //Set all nodes not marked and set all nodes with infinity value { busca_limpa(); Fila[FilaI] = w; Nodelabels[w] = 1; while (Fila[FilaI] != 0) { busca_largura(Fila[FilaI]); FilaI += 1; } busca_ordena(); }
function busca_alvo(tipo) //function search the path entity and verifies which nodes is of a specific type (type = tipo) { NodeCounter = 0; NodeAI = 0; while (NodeCounter < 100) { NodeArray[NodeCounter] = 0; NodeCounter += 1; } NodeCounter = 1; while (NodeCounter <= NodeAmount) { path_getnode(my,NodeCounter,vector,NodeSkills); //path_nodeskills(my,NodeCounter,NodeSkills); if(NodeSkills[0] == tipo) { NodeArray[NodeAI] = NodeCounter; NodeAI +=1; } NodeCounter += 1; } NodeAC = NodeAI; NodeAI = 0; NodeCounter = 0; } /////////////////////////////////////////////////////////////// But how do I use this?!? How do I use this peace of code to let an object follow a path in A7 with Lite-C? (doesn't give any bugs yet).
Last edited by Staakman; 11/19/08 15:32.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|