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

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

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
(solved) spec system info?
« on: Apr 14, 16, 12:08:38 AM »

I have a basic spec system for a skill set up. It loads and saves the values of the spec, I can see the data when opening the spec for the skill. However, I am not exactly sure how to load the saved values into the code to use them. Here is a little I have in place, but the values are all 0.

$EO_GAMEPLAY_PT = prototype of EO_GAMEPLAY

EO_GAMEPLAY = class with lists attached
field EO_temp_Abilities = lookuplist indexed by string of class EO_Skill

EO_Skill = class with several fields
field EO_SkillCooldown = timeinterval    // shows as 0

server side code

Code: [Select]
// shows 0 value
shared function GetAbilityCooldown() as TimeInterval
  val as String = $EO_GAMEPLAY_PT.EO_temp_Abilities["abassaultblast"].EO_SkillCooldown
  $CHAT.ChatArea("game", "cooldown AB "+val)
  return val
.

// errors during ability use
shared function GetAbilityCooldown() as TimeInterval
  return $EO_GAMEPLAY_PT.EO_temp_Abilities["abassaultblast"].EO_SkillCooldown
.


« Last Edit: Apr 14, 16, 09:34:20 PM by Thazager »
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: spec system info?
« Reply #1 on: Apr 14, 16, 07:54:31 AM »

is that client or server side you're working with?

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: spec system info?
« Reply #2 on: Apr 14, 16, 11:39:30 AM »

Its actually in both client and server scripts, with the same classes and fields on both client and server also. I used the old classes and fields and added the EO_temp_Abilities made the same way as EO_Abilities in place. It points to EO_Skill, where the other points to EO_AB.
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: spec system info?
« Reply #3 on: Apr 14, 16, 12:11:04 PM »

Okay, i may be misunderstanding you but here is how you would access spec data once a spec is created.

On the server side, you search for the spec using the spec oracle.

So, SERVER: (this is how i would grab info from an ITEM spec, works the same for any other)

oracle as NodeRef of Class ItemSpecOracle = $SPECORACLEUTILS._GetOracleFromType( "itemspecoracle")
spec as NodeRef of Class itemSpec = oracle.GetSpecByKey( itemSpecID )
 
to get info from the spec, you would then just do:
var blah = spec.theFieldOrMethodIwantToAccess

replace "itemspecoracle" with the name of your spec oracle for that item/ability type.


On the client, its a bit more complicated as you have to Load the spec before accessing it.

first, you want to load the spec:

This should be done from a class methods script
if you havent already, in the Client Dom editor add ObsListener as a parent class to the
class for the script you're working with.


Next, in the class script your working with, add both of the following:


//This would be called first , from where ever you like.

function or method LoadSpecForBlah(blah as noderef etc) or you could have no parameter at all
   $SPECORACLEUTILS._GetSpecOracleByClass("ClassOfMySpecOracle")
   //the ClassOfMySpecOracle would be such as "AbilitySpecOracle" or "itemspecoracle" etc
   oracle.requestSpecByKey(aSpecKeyHere, me)
   //me refers to this script as a callback once its loaded, if you want it to call back to another
   //script, say for a particular GUI etc, you could pass that in as a parameter and replace
   //ME with another scriptref/name

.

Next you need the following Method named as is, to listen for the spec callback

IF you chose to change the call back script above to something other than ME
then this method would go in THAT script instead, make sure to add ObsListener
as a parent class of THAT script instead of this one if this is the case.


method EventRaised( obs as NodeRef of Class ObsSubject, data as NodeRef )
 
  spec as NodeRef of Class ItemSpec = data
  //replace ItemSpec with your spec class such as AbilitySpec etc
  //At this point the spec is now loaded and you can access its information
  if spec != none
     WhatIWant as type = spec.MethodOrFunction or spec.theFieldIWant
  .
 
  RemoveAssociation( obs, "obsSubjectToListenerAssoc", me )
.


if that doesn't make sense, let me know
« Last Edit: Apr 14, 16, 12:16:11 PM by ToY-Krun »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: spec system info?
« Reply #4 on: Apr 14, 16, 09:34:04 PM »

Thanks. I have the server side added, and ability works ok. Will work on client side when needed.
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #5 on: Apr 14, 16, 09:36:44 PM »

good deal, i wasnt sure if that was the info you were looking for or not.

if you take a look at the commands/functions available through the $specOracleUtils: theres alot there that you can probably make use of.  Pretty good list of tools for specs.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #6 on: Apr 14, 16, 09:40:06 PM »

Curious, and of those functions that can actually setup a script? ( create new script, add needed functions, make changes according to spec data)
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #7 on: Apr 14, 16, 10:03:33 PM »

sadly no, however you could create any number of class nodes , glom on others if need be, and set that node up based on the info from a spec.

for example, a spec cannot be changed in a production world, however, any node created from the spec, can be changed dynamically, have more classes glommed on etc.  So while you cant create a script, you can make use of any number of class scripts / utility scripts, based on any added classes you stack onto the node created from a spec (a spec derived object).  To make the node persist, simply associate it with something, such as an npc, or the areas NPCROOT, or the rootnode of the area itself..  for an ability, associate the ability node, created from spec, to an npc or player. it can then be altered on the go as needed.  any additional classes glommed on, gives you access to the scripts involved with that class, as well as the abilityclass.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #8 on: Apr 18, 16, 08:38:08 PM »

Adding in the client side currently.

What does oracle refer to here?

 oracle.requestSpecByKey(aSpecKeyHere, me)    //<-- undefined identifier

I'm guessing it is:

  oracle as NodeRef of Class ItemSpecOracle = $SPECORACLEUTILS._GetOracleFromType( "itemspecoracle")

like the server side?

_______________________________________________________________________________________

I added ObsListener as parent to EO_Skill class. I did not seem to think ObsListener was there:

SCRIPT ERROR: Exception ConversionException: Node id [9223372076148021573] does not have class ObsListener
Time:04/18/2016 20:55:37
Call trace:
  Script SpecOracleClassMethods line 9 me[id=1000012590 class=EO_Skill]
  Script EO_SkillClassMethods line 7 me[9223372076148021573]
  Script E_AbilityBarClassMethods line 121 me[9223372076148021573]
« Last Edit: Apr 18, 16, 09:08:21 PM by Thazager »
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #9 on: Apr 18, 16, 09:01:24 PM »

var oracle =  $SPECORACLEUTILS._GetSpecOracleByClass("ClassOfMySpecOracle")

My bad, i cut it off.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #10 on: Apr 18, 16, 09:10:45 PM »

changed.

The ObsListener might need to be set someplace else?
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #11 on: Apr 18, 16, 09:12:49 PM »

put it on whatever class you added the callback to ("EventRaised").

Generally a GUI Control type class.

Thazager

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

changed.

Ok, moved it to the gui skill that shows as an icon on screen and added to the slots in the ability bar. When the skill is clicked, I just print out that it was called, showing the name of the skill used.

I logged out and back in to remake the gui with the new parent class added, still getting the same error.  Do I need to exit game and back also?  will try that...

still same error.

Ok, just noticed this:

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

does it need to be ObsSubject or ObjListener ?  ... Guess not.
« Last Edit: Apr 18, 16, 09:46:40 PM by Thazager »
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: (solved) spec system info?
« Reply #13 on: Apr 18, 16, 09:51:59 PM »

ObsSubject.  Data will be your loaded spec.

The following line:
 oracle.requestSpecByKey(aSpecKeyHere, me)

what did you use in place of "me" ?
Whatever class script it is, that class doesnt have the obsListener parent on it.

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: (solved) spec system info?
« Reply #14 on: Apr 18, 16, 09:55:56 PM »

I left it as "me" presently. I set it on TMP_Skill

Implements the fields and methods necessary for listeners of the observer pattern.  AbstractClass, concrete listeners will be of classes that inherit this class as a parent.

Shows up in the parent classes, and on ObsListener - TMP_Skill shows up in the references.

Could it be because there is more than 1 icon made? (1 each skill) that : Node id [9223372076148021573] did not have it?
« Last Edit: Apr 18, 16, 10:13:56 PM by Thazager »
Logged
Pages: [1] 2 3