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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Tarra2012

Pages: 1 ... 6 7 [8]
106
As so often i dont know if its ment to be that way, but a solution to the "conflict" is to glom the IconContainer Class codewise to the slot. Why this works? I cant say, but now there seems no method conflict.

Instead of trying to set the class = ItemIconContainer in the Prototype TestInvPanel you can Glom the class to the slot. This way you have a slotnode that is a GUIControl and has abilities of ItemIconContainer.

>>

method CharacterInventory_CreateSlot(slotNumber as Integer) as NodeRef of Class ItemIconContainer
  slot as NodeRef of Class GUIControl
  slot = CreateNodeFromPrototype("TestInvPanel")
  glomClass("ItemIconContainer", slot)
  slot.build = true
  slot.name = "slot" + slotNumber
  return slot
.

107
Whatever i tried, its impossible to create a node out of a prototype with both parent classes :/

_GUIIconContainer  and GUIPanel

The Prototype TestInvPanel is defined as::
<createControlType inheritFrom='_panel' type='TestInvPanel' description='Just a temporary inv panel' treePath='CleanEngine' name="TestInvPanel" texture="\GUI\inventory_v3.dds">
  <position x="162.500015259" y="225.000030518"/>
  <size x="63.750007629" y="63.750007629"/>
  <defaultStatePresentation>
    <position x="512.129821777" y="910.518493652"/>
    <size x="99.410667419" y="102.589332581"/>
  </defaultStatePresentation>
</createControlType>


The new created Class which i try to use in the Prototype is::
ItemIconContainer
Parent: _GUIIconContainer



The method that tries to create slots::

method CharacterInventory_CreateSlot(slotNumber as Integer) as NodeRef of Class ItemIconContainer
  slot as NodeRef of Class GUIControl
  slot = CreateNodeFromPrototype("TestInvPanel")
  slot.build = true
  slot.name = "slot" + slotNumber
  return slot
.


The mainloop to initialize Slots::

method CharacterInventory_InitializeSlots()
  slots as Integer = 3
  var container = me.Flow()
  clear container.children destroy
 
  slot as NodeRef of Class GUIControl
  loop i from 1 to slots
    slot = me.CharacterInventory_CreateSlot(i)
    println("created slot id="+i+ " nodeid="+slot)
    add back slot to container.children
  .
.


Sorry to reask: But isnt there a tiny clean example that shows which prototypes, classes are needed for a minimum solution that uses ICONContainer and the ITEMSYSTEM? I guess its what 80%+ of developers need to set up a inventory. (doesnt matter how exactly they will intend to use it later)

 



108
I cant create a class that has both parents _GUIIconContainer  and _GUIPanel as method conflicts arise, when i try to do so.


The problem is that the prototype 'TestInvPanel' from the tutorial is defined as
>>
>> <createControlType inheritFrom='_panel' type='TestInvPanel' description='Just a temporary inv panel' >> treePath='CleanEngine' name="TestInvPanel" texture="\GUI\inventory_v3.dds">


How should i adjust the Prototype? I like it to inherit from the parent class _GUIIconContainer as well. Or to adjust it in any way, that it will recieve the _GUIIconContainer Methods.


Otherwise my created node will never have the abilities and methods of the GUIIconContainer.

Now:  slot = CreateNodeFromPrototype("TestInvPanel")   

Goal:  slot = CreateNodeFromPrototype("HJCharacterInventorySlot")
          Not using 1:1 HJCharacterInventorySlot but recieving a node with _GUIIConContainer abilities



Subproblem:
I have trouble accessing the mentioned Prototype in the Reference World. I cant send /sp commands via console.
The repository browser doesnt show anything. Is that intended? Even not readonly?

109
@Jerome90

>> slot._PutIconInContainer(icon)
This is the core line i am searching. The connection between a slot and the icon inside!
What i ve done is partly from the tutorial (pressing I for inventory and rendering empty slots in a panel)
and partly assembling lines from HJ and modifying.

>>method HJCharacterInventory_CreateSlot(slotNumber as Integer) as NodeRef of Class inventoryIconContainer
You gave the hint, that a certain parentclass needs to be set.
The mentioned _CreateSlot Methods shows, that the returned object is "NodeRef of Class inventoryIconContainer"

So a slot is actually an _GUIIconContainer too, due to the choosen class hierachy.
inventoryItemcontainer->ItemIconContainer->... ->_GUIIconContainer

And from what i guess, in the end i need to use a Method that comes with a _GUIIconContainer for the connection? I will try to modify my script and report back.


@cseibert:
I simply call the equip function of the item. If you set the right decoraters in the specs and choose a valid bone of a character, the model of Item will be rendered. I will look up the line i am using if you like to see.






110
Thanks a lot for that example!

For the GUI problem with 2d Icons i am stuck at rendering an icon to a slot.
Here is the example of the function i call for each item.

How do i connect the slot (GUIControl) with the icon (_GUIIcon) ?
I am searching a method like slot.setIcon()?


method PlaceIconInInventorySlot(item as NodeRef of Class _Item, offset as Integer,itemname as String)

  flow as NodeRef of Class GUIFlowLayoutContainer = me.Flow()
  slot as NodeRef of Class GUIControl
  slot = FindGUIControlByName(flow, "slot" + offset)
 
  icon as NodeRef of Class _GUIIcon = CreateNodeFromClass( "_GUIIcon")
  icon._SetupIcon()
  icon._SetIconAppearanceToDefault()
  icon._SetIconSubject(item)
  icon.scale = 1.0
 
  mysize as Class xy
  mysize.x=32
  mysize.y=32
  mylist as List of String
  add back "/character/character_sample/maps/hair.dds" to mylist

  if icon._SetIconTexture(mylist,mysize,1) == true
    println("Created Icon Texture")
  .

// How to get the Icon rendered/attached to the slot?

.

111
>> When you say "keeping track of instances", do you mean instances of items generated by $_ITEMSYSTEM._CreateItemFromSpecKey()?

Exactly. As i understood, the Itemsystem provides persistent storing and basic features. But everytime you login a character, you will have to loop through all Items in an container and somehow decide, which one is equipped or is stored in a bag. Why? Because of course you have to handle those items differently.
   
1) One solution: Create different containers for a character.
   
    Example Containers: bag, equipped, quest
    All items in bag can be visualized in a "inventory" as 2d icon.  (no idea how to do that)
    All items in equipped can be visualized as 3d geometry on character (functions successfully tested)
    All items in quest can be registered as "quest advancements"  (not concerned about this atm)
   
2)  Another solution: Store mutable data with an item
     E.g.: is equipped Y/N ,  is activated Y/N , is questitem for questid XY
     How to accomplish this? Anyone got a small example how to store a flag with an item. And how to read this flag after instancing the item via "$_ITEMSYSTEM._CreateItemFromSpecKey()"


In short:
 How to visualize items in a 2d manner (normal inventory, 3d geometry is done via functions)
 How to store mutable data and read it after creating an instance?


   

112
Sounds very simple the way you did. So no need for new prototype and all the work?
Anyway, i encounter more challenges and maybe someone can point me into right direction.


1) I have deep trouble creating / keeping track of the instances (generated from the item specs)

How is the a) instanciation and b) visualization calls meant to be?
On Startup enter a server script and start to instanciate "items" and their "decorators"?
Anyone got an example how that works with the ITEMSYSTEM? Do i need to add manually any associations between item/itemappearance/player_character?


2) If the instances from the specs are created. How do i keep track of them?
I need to call methods on them like requestequip(), dovisualize() or just access variables like "isequipped". Where are the instances registered? Is it in the ITEMSYSTEM or do i need to manage them on my own ?


I am happy for any recommandations. For now I am able to read out spec fields on client and on server for the existing items. But i am somehow stuck on how the handling of the instances / visualization are meant to be.

With manually creating "ItemAppearance" objects i could enforce some rendering in the world. But this seems just not right.




113
Scripting & Programming / Questions implementing new Item_System
« on: Dec 10, 12, 02:38:49 AM »
Hello together,

as a new developer with some years of background in other languages i start to dive into HSL.
Its a nice language, as far as i can tell and i managed to follow successfully tutorials for gui/replication.

Now i am stuck while trying to activate the new "itemsystem". I have questions when trying to follow the listed points in the tutorial http://hewiki.heroengine.com/wiki/Item_System:
 
    1. Create a new class in the server and client DOM that will be used as the Player Character class.
    2. Add as parent classes _PlayerCharacter and _ItemContainerOwner.
    3. Create a prototype from the new Player Character class that was just created.
    4. Override HE_CSSUseCharacterPrototype in the class methods script of a new or existing class. It should return (as a reference) a noderef of the prototype that was previously created and return true.
    5. Using the System Node Configuration GUI add to the server Character Selection System the class which contains the override of HE_CSSUseCharacterPrototype.
    6. Log out and return to the character selection screen. Create a new character which will now be able to own Item Containers and Items.


Point 1: Ok, in my case called EO_Playercharacter
Point 2: OK, parent classes done and in server/client dom existing
Point 3: Create the prototype only on server side? I just created em on both client/Server.
             The only difference for creating is the forward or backward slash, correct? (\ = serverside prototype)
            \CPFC EO_PlayerCharacter, EO_PlayerCharacterPrototype; description="MY PlayerCharacter Prototype"

Point 4: HE_CSSUseCharacterPrototype
In which classMethods Script shall i override the function? I am confused, as the method "HE_CSSUseCharacterPrototype" is existing e.g. in Serverside E_CharacterSelectionSystem

Point  5: Same question. Which is the class that should hold the override "HE_CSSUseCharacterPrototype"? Cause this class should be glomed to the SystemNode. Is it  EO_PlayerCharacter  Or E_CharacterSelectionSystem or another new created?




Edited: Found a solution.

Point 3: Prototype only on server side needed.

Point 4: Changed the existing server script "E_CharacterSelectionSystem"
As the function is already here to get the CharacterPrototype
Orig:   proto = GetPrototype( "_E_CharacterPrototype" )
New:   proto = GetPrototype( "EO_PlayerCharacterPrototype" )

Point 5: Solved with Point4. Let the EO_PlayerCharacter empty.


But an additional problem appeared in client side script Input_Movement:
I needed to change the line that retrieves GetMYCharacter().
Has that happend to anyone else?

Orig:   acct as NodeRef of Class E_playerAccount = GetAccountID()
           char as NodeRef of Class E_playerCharacter = acct.GetMyCharacter()

New:  acct as NodeRef of Class E_playerAccount = GetAccountID()
          char as NodeRef of Class EO_PlayerCharacter = acct.GetMyCharacter()





Pages: 1 ... 6 7 [8]