HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.
Pages: 1 [2] 3

Author Topic: (solved) spec system info?  (Read 6020 times)

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #15 on: Apr 18, 16, 10:19:44 PM »

okay, and where is  oracle.requestSpecByKey(aSpecKeyHere, me)  being called from?
What class script in other words?

Also is it being called from a function or method?

I misled you a bit in my explanation of the code.

If you call this from a function, then "me" is whatever called that function.
Like if you call it from script X then me references the Node represented by Script X rather than
TMP_Skill.

for example I call that from a method within my ExpandedInfoPanel class script for a tool tip GUI that pops up, so "me" references the expanded infoPanel node, and it has the obsListener class on it and receives the spec call back , then populates itself via the spec info.  If called from a function you may need to point to the GUI control that has the EventRaised method by doing a "FindGUIControlByName()" then replace "me" with that.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #16 on: Apr 19, 16, 12:06:15 AM »

Heh, your mesg just now showed for me.

Yep, that was the error, called "me" in a function. I set function instead of method because I was trying to think of how to call the method from script.

oracle as node of class EO_Skill = ??
oracle.LoadSpecForSkill(speckey)
//================================================

Looked up some info. In common with some other scripts I checked out were the methods:  _OnReplicationNodeAdded() shared function _OnReplicationFieldUpdated() method _OnReplicationGroupAdded()  and method _OnReplicationNodeRelease()

this section of code:

var oracle = me.getMySpecOracle()
  oracle.requestSpecByKey( me.getMySpecKey(), me )


was in a _OnReplicationGroupAdded() instead of LoadSpecForSkill(SpecKey as ID). And they did have :

 method EventRaised( obs as NodeRef of Class ObsSubject, data as NodeRef )

I found an example using ObsListener. The archtype was data. The class was _chatchannel. The script was _chatchannelclassmethods.

the script:

Code: [Select]
//==================================================================================================
//
//  _ChatChannel is the base abstract class for all necessary Chat Channels. Client noderefs are
//  replicated from the server and notify their associated logical chat channels when a field has
//  changed.
//
// Copyright (c) 2011, Idea Fabrik Plc
//==================================================================================================
//-------------------------------------------------------------------------------
// As each node is added by replication, a callback is made to the primary node notifying it that a new node
// has arrived with its initial set data.
method _OnReplicationNodeAdded(addedNode as NodeRef)
 
.
//-------------------------------------------------------------------------------
//Called when all of the nodes that are part of the replication group have been added.  At this point, all nodes are present
//with those of their fields marked "Initial Set" set to the replicated values
method _OnReplicationGroupAdded() 
  // request the spec so we can identify the logicalchannel identifier
  var oracle = me.getMySpecOracle()
  oracle.requestSpecByKey( me.getMySpecKey(), me )
.

//-------------------------------------------------------------------------------
//Return a noderef to the _LogicalChatChannel associated with this _ChatChannel
method _GetMyLogicalChatChannel() as NodeRef of Class _LogicalChatChannel
 
  logical_chat_channel as NodeRef of Class _LogicalChatChannel
  //if the _logicalChatChannelReference has already been set, return it
  if me._logicalChatChannelReference != None
    logical_chat_channel = me._logicalChatChannelReference
  .
 
  //if it has not been set yet, consult the _logicalChatChannelMap on the system node
  //and set the _logicalChatChannelReference so this operation will be faster next time
  if logical_chat_channel == None
    logical_chat_channel = $CHAT._GetLogicalChatChannel(me._logicalChatChannelIdentifier)
    me._logicalChatChannelReference = logical_chat_channel
    AddAssociation(logical_chat_channel, "logical_chat_channel_association", me )
  .
 
  return logical_chat_channel
.
//-------------------------------------------------------------------------------
// Called when fields whose Client Callback propery was set to YES are updated
shared function _OnReplicationFieldUpdated(update_node as NodeRef, update_field as String)
 
.
//-------------------------------------------------------------------------------
//Tell the logical channel to unsubscribe itself from this channels replicaiton events
method _OnReplicationNodeRelease(releasedNode as NodeRef) as Boolean
  logical_channel as NodeRef of Class _LogicalChatChannel = me._GetMyLogicalChatChannel()
  logical_channel._UnsubscribeFromChatChannel(me)
 
  return true
.
//-------------------------------------------------------------------------------
// Only important there are fields that are reference frame adjusted for seamless world as a part of this class, which there are not
method _OnReplicationGroupRehomed(oldArea as ID, oldInstance as ID, oldOffset as Vector3, newArea as ID, newInstance as ID, newOffset as Vector3)
.
//-------------------------------------------------------------------------------
//SpecOracle method
method getMySpecOracle() as NodeRef of Class SpecOracle
  return $SPECORACLEUTILS._GetSpecOracleByClass( "_ChatChannelSpecOracle" ) 
.
//Receives the corresponding _ChatChannel spec from the server and subscribes
//the channel to the appropriate logical channel based on the logicalChannelIdentifier
//field within the spec
method EventRaised( obs as NodeRef of Class ObsSubject, data as NodeRef )
  where data is kindof _ChatChannelSpec
    if me._logicalChatChannelIdentifier = ""
      me._logicalChatChannelIdentifier = data._logicalChatChannelIdentifier
    .
   
    logical_channel as NodeRef of Class _LogicalChatChannel = me._GetMyLogicalChatChannel()
    logical_channel._chatChannelUniqueIdentifier = me._chatChannelUniqueIdentifier
   
    // TODO: we probably do not need the display name anymore
    //set the logical channel display name
//    logical_channel._chatChannelDisplayName = me._chatChannelDisplayName
   
    //tell it to listen to replication events
    logical_channel._SubscribeToChatChannel( me )
  .
.
« Last Edit: Apr 19, 16, 12:11:24 AM by Thazager »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #17 on: Apr 19, 16, 12:32:04 AM »

new error, this node now seems like the character node?  [9223372076148021573]

add methods to same script that calls them - E_AbilityBarClassMethods

Code: [Select]
00:26:45: ERROR:System:SCRIPT ERROR: The method LOADSPECFORSKILL was not found on any of the classes on the node [id=9223372076148021573 class=E_playerAccount,HBNode,CharacterNode,_ACCControllerOwner].
Time:04/19/2016 00:26:41
Call trace:
  Script E_AbilityBarClassMethods line 121 me[9223372076148021573]
  Script E_AbilityBarClassMethods line 90 me[9223372076148021573]
  Script Input_Command line 33 me[9223372076148021573]
starting method/function ONCMDSTOP
starting me[id=9223372076148021573 class=E_playerAccount,HBNode,CharacterNode,_ACCControllerOwner]
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #18 on: Apr 19, 16, 12:47:14 AM »

Hey Thaz, can you post the function or method that contains line 121 of the E_AbilityBarClassMethods on your end?

Yeah that does look like the player account node, but looks like its getting closer.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #19 on: Apr 19, 16, 12:48:56 AM »

lines 120-121

        key as ID = 1
        me.LoadSpecForSkill(key)
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #20 on: Apr 19, 16, 12:58:37 AM »

yeah starting from onCMDStop() its passing the client id through to line 121, where "me" again is referencing the calling node, the accountID.

Try this,

at line 121 insert the following:

gui as noderef of class E_AbilityBar = FindGUIControlByName(0, "E_AbilityBar")
if gui != None
   key as ID = 1
   gui.LoadSpecForSkill(key)
.

instead of what is currently on line 121.
You could also use something like the following:
gui as noderef of class E_AbilityBar = GetGUIControlUnderMouse()
or
gui as noderef of class E_AbilityBar = GetGUIControlUnderMouse().rootParent

this assuming that LoadSpecForSkill() is inside the E_AbilityBar script

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #21 on: Apr 19, 16, 01:10:53 AM »

Ok, its loading the spec, I saw the print mesg in it. But the event is not yet being called.

// load
  println("LoadSpecForSkill  "+SpecKey)

// event
     name as String = spec.displayName
     println("which ability "+name)
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #22 on: Apr 19, 16, 01:23:29 AM »

okay, make sure EventRaised is in the E_AbilityBar class script, and the ObsListener class is a parent added to E_AbilityBar Class.

as far as I recall it should already have obsListener as a parent, not sure.

you might also need to specify the class of the spec like this:

where data is kindof AbilitySpec //(or whatever spec class)
   name as string = data.displayName
   //etc
.

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #23 on: Apr 19, 16, 01:25:08 AM »

oh and also.. try this, if you used the gui pointer that i described,
try a println to see what the name of "gui" is just to make sure that it is the E_AbilityBar.

where gui is kindof GUIControl
   println(gui.name)
.
« Last Edit: Apr 19, 16, 01:28:40 AM by ToY-Krun »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #24 on: Apr 19, 16, 01:37:54 AM »

yep, name is E_AbilityBar
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #25 on: Apr 19, 16, 01:41:35 AM »

Okay good. so to that point you're golden.

now, if you've got the EventRaised() method in that script and ObsListener as a parent,
and it still doesn't return the spec, its possible theres a problem with the spec itself.

Do you have other specs you could try?  Check the repo in the ScriptData folder and make sure the spec exists in there.
Its possible the spec didnt save correctly for whatever reason.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #26 on: Apr 19, 16, 01:53:44 AM »

yep, shows in the repo.

<nodeWClasses><classes><class>EO_SkillSpec</class></classes><marshalData><node id='9223372098971086929'>
<f name='displayName'>Assault Blast</f>
<f name='SpecKey'>1</f>
<f name='DisplayDescription'>Fires a powerful shot at the target, dealing (#) weapon damage and generating threat.</f>
<f name='_specIsDeleted'>false</f>
<f name='EO_skillIconID'>75</f>
<f name='EO_skillunlock'>none</f>
<f name='EO_skillunlockRank'>0</f>
<f name='EO_SkillReqLevel'>1</f>
<f name='EO_SkillCostType'>Mech</f>
<f name='EO_SkillType'>Attack</f>
<f name='EO_SkillCost'><e>10</e><e>15</e><e>20</e><e>25</e><e>30</e><e>35</e></f>
<f name='EO_SkillLarp'>false</f>
<f name='EO_SkillCooldown'>0:00:01.000</f>
<f name='EO_SkillDuration'>0:00:00.000</f>
<f name='EO_SkillHotbar'>true</f>
<f name='EO_SkillGroup'>Tanking</f>
<f name='EO_SkillUpgrade'><e>0</e><e>40</e><e>80</e><e>160</e><e>320</e><e>640</e></f>
<f name='EO_SkillDescVal1'><e>100</e><e>200</e><e>300</e><e>400</e><e>500</e><e>600</e></f>
<f name='EO_SkillDescVal2'><e>0</e><e>0</e><e>0</e><e>0</e><e>0</e><e>0</e></f>
<f name='EO_SkillDescVal3'><e>0</e><e>0</e><e>0</e><e>0</e><e>0</e><e>0</e></f>
<f name='EO_SkillRank'>3</f>
<f name='EO_SkillRange'>3</f>
</node></marshalData></nodeWClasses>
« Last Edit: Apr 19, 16, 02:00:01 AM by Thazager »
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #27 on: Apr 19, 16, 04:46:16 AM »

hrm, check to see if any of the parent classes of E_AbilityBar also use EventRaised..

The spec could be getting returned to another class altogether.. 
E_AbilityBar itself isnt being used as a parent class of another class is it?
if so, see if those classes implement the EventRaised method.  that could be where its going to.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #28 on: Apr 19, 16, 12:24:52 PM »

It has parents of GUIpanel and ObsListener.
None have used EventRaised.
Its not a parent for another class.
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #29 on: Apr 19, 16, 03:17:36 PM »

odd.  try doing the following, just out of curiosity, see what classes are showing to be on "gui", assuming you are still using "gui" to call the following:

gui.LoadSpecForSkill(key)


Try this println just to see if any other classes are getting glommed on somewhere:

foreach c in GetClassesOnNode(gui)
  println(c)
.
Pages: 1 [2] 3