HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [resolved] creating a persistent node  (Read 985 times)

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
[resolved] creating a persistent node
« on: Apr 25, 14, 11:31:02 PM »

I have been working on a $GUILD database, and saw that using this is recommended for making an persistent area node. Would anyone know how to set one up and access it once created?

I have tried something similar to this from a charinfo class for the character, converting to an area.
I have tried MakeANode() from the wiki.

When I used ListAllNodesAttachedToRoot() I found several nodes and each had a special use:

rootNode : 9223372075540021578
Node found: 9223372075540021579 type base_hard_association source     9223372075540021578

Node found: 9223372075658021532 type _seamlessAreaLink source          9223372075540021578
Node found: 9223372075658021532 type base_hard_association source     9223372075540021578

Node found: 9223372075658021539 type base_hard_association source     9223372075540021578
Node found: 9223372075658021539 type _AreatoNPCRootAssoc source      9223372075540021578

Node found: 9223372075658021541 type _PropAnchorAssociation source    9223372075540021578

Node found: 9223372075658021550 type _StateRootAssoc source              9223372075540021578
Node found: 9223372075658021550 type base_hard_association source      9223372075540021578

Node found: 9223372075658021553 type base_hard_association source      9223372075540021578
Node found: 9223372075658021553 type _AiAgents source                        9223372075540021578

Node found: 9223372075658021583 type AreaToGMNoteRoot source          9223372075540021578
Node found: 9223372075658021583 type base_hard_association source      9223372075540021578
« Last Edit: Apr 30, 14, 10:28:41 PM by Thazager »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: creating a persistent node
« Reply #1 on: Apr 30, 14, 10:28:28 PM »

A few easy functions I made for making the persisted node that I needed. First I made the class Guild, then made it a prototype $GUILD. Then I added the persisted node, and let the world shut down and sleep in order to see the node saving data.

IN the server script GuildClassMethods, I added these below. The first method calls the area for the $GUILD prototype as a system area. Then the second method creates the node in that area. (while these might be combined as 1 method with an If statement to check the area, I took the direct approach and just said go to that area)

Code: [Select]
// used to make the save node for Area
method MakeANode()
  call area $GUILD.GetGuildSystemAreaId() instance 0 $GUILD.MakeThisNode()
.

// used to make the save node for Area
remote method MakeThisNode()
  Guild as NodeRef of Class Guild = CreatePersistedNodeFromClass("Guild")
  AreaRoot as NodeRef of Class AreaRoot = GetRootNode()
  AddAssociation(AreaRoot, "guild_Association", Guild)   // soft association
  AddAssociation(AreaRoot, "base_hard_association", Guild)
.
Logged