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

Author Topic: Updated Icon system  (Read 6648 times)

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Updated Icon system
« on: Mar 15, 13, 06:10:23 PM »

Medium Scripting

This Icon system uses pick up and put down instead of drag and drop. It uses a simpler method by creating slots with Icons already in them, but invisible. When the Icon is picked up, we make a MovePanel and add it to the mouse. When we place the Icon, we remove it from the mouse and set the texture into the Icon in the slot, then make it visible.

Here, with left click, we can pick up icons that were placed on the hotbar, place them in another slot, swap them with one already there, or just delete the one in place with right click.

In the DOM, create a new (client side) class
name = TMP_Icon
archtype = guicontrol
add a parent to the class, GUIMovePanel

click open script

In new script TMP_Icon

Code: [Select]
// items that go in the slots

// set pointer to item on mouse
public function getHeldIcon() as NodeRef of Class TMP_Icon
  movIcon as NodeRef of Class TMP_Icon = FindGUIControlByName(None, "cinematics.icon")
  return movIcon
.

// grab the item
public function grabItem(over as NodeRef of Class GUIControl)
  var movIcon = getHeldIcon()
  var mouse = GetMousePosition()

  if movIcon <> None
    destroynode(movIcon)
  .
  movIcon = CreateNodeFromPrototype("TMP_Icon")
  movIcon.build = true
  movIcon.name = "icon"
  movIcon.layer = "cinematics"
  movIcon.size = over.size
  movIcon.texture = over.texture
  movIcon.tooltip = over.tooltip
  movIcon.position.x = mouse.x
  movIcon.position.y = mouse.y
  movIcon.defaultStatePresentation = over.defaultStatePresentation
  movIcon.hoverStatePresentation = over.hoverStatePresentation

  DragNDrop:StartDragging(movIcon)
  MakeHud()
.

// grab the item and remove from slot
public function pullOutItem(over as NodeRef of Class GUIControl)
  grabItem(over)
  over.visible = false                         // make it not seen
  MakeHud()
.

// put item here - turn on the picture
// over = slot
public function putItemHere(over as NodeRef of Class GUIControl)
  var movIcon = getHeldIcon()
  Icon as NodeRef of Class TMP_Icon = FindGuiControlByName(over, "IconPic")

  if Icon <> None
    Icon.visible = true                         // make it seen
    Icon.tooltip = movIcon.tooltip
    Icon.texture = movIcon.texture
    Icon.defaultStatePresentation = movIcon.defaultStatePresentation
    Icon.hoverStatePresentation = movIcon.hoverStatePresentation

    destroynode(movIcon)  // remove held Icon
    RemoveHud()
  .
.

// exchange the held Icon for the current in place
// over = IconPic
public function SwapItem(over as NodeRef of Class TMP_Icon)
  var movIcon = getHeldIcon()
  temp as NodeRef of Class TMP_Icon = createNodeFromPrototype("TMP_Icon")

  if movIcon <> None        // no swap if not holding Icon
   // save our current Icon
    temp.tooltip = over.tooltip
    temp.texture = over.texture
    temp.defaultStatePresentation = over.defaultStatePresentation
    temp.hoverStatePresentation = over.hoverStatePresentation

    //set in new Icon
    over.tooltip = movIcon.tooltip
    over.texture = movIcon.texture
    over.defaultStatePresentation = movIcon.defaultStatePresentation
    over.hoverStatePresentation = movIcon.hoverStatePresentation

    // set saved in mouse
    movIcon.tooltip = temp.tooltip
    movIcon.texture = temp.texture
    movIcon.defaultStatePresentation = temp.defaultStatePresentation
    movIcon.hoverStatePresentation = temp.hoverStatePresentation
  .
  destroynode(temp)  // remove temp node
.

// make hud when picking up item
public function MakeHud()
  hud as NodeRef of Class GUIControl = FindGUIControlByName(None, "default.TMP_hud")
  if hud = None
    hud = CreateNodeFromPrototype("TMP_hud")
    hud.build = true
  .
.

// remove the hud after dropping item
public function RemoveHud()
  hud as NodeRef of Class GUIControl = FindGUIControlByName(None, "default.TMP_hud")
  if hud <> None
    destroynode(hud)
  .
.

//========================================================
In the DOM, create a new (client side) class
name = TMP_IconSlot
archtype = guicontrol

add a parent to the class, GUIPanel

//========================================================
In the DOM, create a new (client side) class
name = TMP_Iconpanel
archtype = guicontrol
add a parent to the class, _GUIBaseWindow

click open script

In new script TMP_Iconpanel

Code: [Select]
// panel to put the slots on
shared function Start()
  var win = getIconWindowClass()
  if win <> None
    DestroyNode( win )
  .
  win = CreateNodeFromPrototype("TMP_Iconpanel")
  win.build = true
  win.owner = 0
  win.layer = "game"
  CenterWindow(win)

  DrawIcons(win)
.

// center the given window on screen
// can add to MiscUtils script for all to use
public function CenterWindow(win as NodeRef of Class GUIControl)
  screen as Vector3 = GetViewPortSize()
  win.position.x = (screen.x - win.size.x) / 2
  win.position.y = (screen.y - win.size.y) / 2
.

// get main window class for variables
public function getIconWindowClass() as NodeRef of Class TMP_Iconpanel
  win as NodeRef of Class TMP_Iconpanel = FindGuiControlByName(None,"game.TMP_Iconpanel")
  return win
.

// grab and drop Icons
method onMouseClick(args references Class GUIMouseEvent)
  over as NodeRef of Class GUIControl = GetGUIControlUnderMouse()

  if args.leftButton      // place/grab item with left click  ===================================
    if over <> None
      when over.name
        is "Icon"
          TMP_IconClassMethods:grabItem(over)
        .
      .
    .
  .
.

// draw the current set of buttons
function DrawIcons(win references NodeRef of Class GUIControl)
  IconName as List of String
  IconList as String = getIconName()
  SplitBy(IconList, "/", IconName)

  posX as Integer = 10
  posY as Integer = 30

  loop i from 1 to 20
    setupIconSlot(win, i, posX, posY, IconName[i])

    // example spacing
    posX += 50
    if posX >= 250
      posX = 10
      posY += 50
    .
  .
.

// set up some simple icon names
function getIconName() as String
  data as String = "Icon 1/Icon 2/Icon 3/Icon 4/Icon 5/Icon 6/Icon 7/Icon 8/Icon 9/Icon 10/" \
                 + "Icon 11/Icon 12/Icon 13/Icon 14/Icon 15/Icon 16/Icon 17/Icon 18/Icon 19/Icon 20/"
  return data
.

// draw 1 slot at position X,Y with name
function setupIconSlot(win references NodeRef of Class GUIControl, val as String, posX as Integer, posY as Integer, Iconname as String)
  slot as NodeRef of Class TMP_IconSlot
  Icon as NodeRef of Class TMP_Icon

  // add a slot with place for pic
  slot = createNodeFromPrototype("TMP_IconSlot")     // default slot
  slot.build = true
  slot.name = "slot"+val
  slot.position.x = posX
  slot.position.y = posY
  add back slot to win.children

  // add some pics to show
  myX as Integer = stoi(val) *96    // GUI sheet pic spacing
  myY as Integer = 0
  if myX >= 960
    myX -= 960
    myY = 128
  .

  // create a place to put pics
  Icon = FindGuiControlByName(slot, "IconPic")     // skill
  Icon.name = "Icon"
  Icon.tooltip = Iconname
  Icon.visible = true
  Icon.defaultStatePresentation.position.x = myX
  Icon.defaultStatePresentation.position.y = myY
  Icon.hoverStatePresentation.position.x = myX
  Icon.hoverStatePresentation.position.y = myY
.

//========================================================
In the DOM, create a new (client side) class
name = TMP_Hotbar
archtype = guicontrol
add a parent to the class, _GUIBaseWindow

click open script

In new script TMP_Hotbar

Code: [Select]
// init all options
public function Start(addedNode as NodeRef of Class E_playerCharacter)
  var win = getHotBarClass()
  if win != None
    destroynode(win)
  .
  win = CreateNodeFromPrototype("TMP_HotBar")
  win.build = true
  win.layer = "game"
.

// get hotbar window class for variables
public function getHotBarClass() as NodeRef of Class TMP_HotBar
  win as NodeRef of Class TMP_HotBar = FindGuiControlByName(None,"game.TMP_HotBar")
  return win
.

// check which ability used
method onMouseClick(args references Class GUIMouseEvent)
  over as NodeRef of Class GUIControl = GetGUIControlUnderMouse()
  name as String = SubString(over.name,1,4)

  if args.leftButton
    when name
      is "Slot"           // place icon in slot
        TMP_IconClassMethods:putItemHere(over)
      .
    .
    when over.name
      is "IconPic"       // swap icon with held icon
        var movIcon = TMP_IconClassMethods:getHeldIcon()
        if movIcon = None
          TMP_IconClassMethods:pullOutItem(over)
        else
          TMP_IconClassMethods:SwapItem(over)
        .
      .
    .
  .
  // check for removing Icon from hotbar
  if args.rightButton
    when over.name
      is "IconPic"
        over.visible = false
      .
    .
  .
.

//========================================================
Create new XML script TMP_Hotbar

Code: [Select]
<createControlType class='TMP_Hotbar' type='TMP_Hotbar' description='' treePath='' name="TMP_Hotbar" dockMode="BOTTOM" textureFilter="false" allowMove="false" resizeable="ALL" scrollable="VERTICAL">
  <size x="1035" y="100"/>
  <maximumSize x="2048" y="2048"/>
  <defaultStatePresentation>
    <color a="0"/>
  </defaultStatePresentation>
  <hoverStatePresentation>
    <color a="0"/>
  </hoverStatePresentation>
  <selectedHoverStatePresentation>
    <color r="0" g="0" b="0" a="0"/>
    <size x="0" y="0"/>
  </selectedHoverStatePresentation>
  <_panel name="Picpanel" texture="\GUI\ccs_elements_v2.dds">
    <size x="500" y="100"/>
    <defaultStatePresentation>
      <position x="1388" y="355"/>
      <size x="532" y="108"/>
    </defaultStatePresentation>
    <hoverStatePresentation>
      <position x="1388" y="355"/>
      <size x="532" y="108"/>
    </hoverStatePresentation>
    <autoCenter horizontal="true"/>
  </_panel>
  <_panel name="SlotPanel">
    <size x="500" y="100"/>
    <defaultStatePresentation>
      <color a="0"/>
    </defaultStatePresentation>
    <hoverStatePresentation>
      <color a="0"/>
    </hoverStatePresentation>
    <autoCenter horizontal="true"/>
    <TMP_IconSlot name="Slot1">
      <position x="47" y="25"/>
      <set name='TMP_Hotbar.SlotPanel.Slot1.IconPic' attribute='visible' value="false"/>
    </TMP_IconSlot>
    <TMP_IconSlot name="Slot2">
      <position x="92" y="25"/>
      <set name="TMP_Hotbar.SlotPanel.Slot2.IconPic">
        <position x="3" y="3"/>
        <set name='TMP_Hotbar.SlotPanel.Slot2.IconPic' attribute='visible' value="false"/>
        <autoCenter horizontal="false" vertical="false"/>
      </set>
    </TMP_IconSlot>
    <TMP_IconSlot name="Slot3">
      <position x="137" y="25"/>
      <set name="TMP_Hotbar.SlotPanel.Slot3.IconPic">
        <position x="3" y="3"/>
        <set name='TMP_Hotbar.SlotPanel.Slot3.IconPic' attribute='visible' value="false"/>
        <autoCenter horizontal="false" vertical="false"/>
      </set>
    </TMP_IconSlot>
    <TMP_IconSlot name="Slot4">
      <position x="182" y="25"/>
      <set name="TMP_Hotbar.SlotPanel.Slot4.IconPic">
        <position x="3" y="3"/>
        <set name='TMP_Hotbar.SlotPanel.Slot4.IconPic' attribute='visible' value="false"/>
        <autoCenter horizontal="false" vertical="false"/>
      </set>
    </TMP_IconSlot>
    <TMP_IconSlot name="Slot5">
      <position x="227" y="25"/>
      <set name="TMP_Hotbar.SlotPanel.Slot5.IconPic">
        <position x="3" y="3"/>
        <set name='TMP_Hotbar.SlotPanel.Slot5.IconPic' attribute='visible' value="false"/>
        <autoCenter horizontal="false" vertical="false"/>
      </set>
    </TMP_IconSlot>
    <TMP_IconSlot name="Slot6">
      <position x="272" y="25"/>
      <set name="TMP_Hotbar.SlotPanel.Slot6.IconPic">
        <position x="3" y="3"/>
        <set name='TMP_Hotbar.SlotPanel.Slot6.IconPic' attribute='visible' value="false"/>
        <autoCenter horizontal="false" vertical="false"/>
      </set>
    </TMP_IconSlot>
    <TMP_IconSlot name="Slot7">
      <position x="317" y="25"/>
      <set name="TMP_Hotbar.SlotPanel.Slot7.IconPic">
        <position x="3" y="3"/>
        <set name='TMP_Hotbar.SlotPanel.Slot7.IconPic' attribute='visible' value="false"/>
        <autoCenter horizontal="false" vertical="false"/>
      </set>
    </TMP_IconSlot>
    <TMP_IconSlot name="Slot8">
      <position x="362" y="25"/>
      <set name="TMP_Hotbar.SlotPanel.Slot8.IconPic">
        <position x="3" y="3"/>
        <set name='TMP_Hotbar.SlotPanel.Slot8.IconPic' attribute='visible' value="false"/>
        <autoCenter horizontal="false" vertical="false"/>
      </set>
    </TMP_IconSlot>
    <TMP_IconSlot name="Slot9">
      <position x="407" y="25"/>
      <set name="TMP_Hotbar.SlotPanel.Slot9.IconPic">
        <position x="3" y="3"/>
        <set name='TMP_Hotbar.SlotPanel.Slot9.IconPic' attribute='visible' value="false"/>
        <autoCenter horizontal="false" vertical="false"/>
      </set>
    </TMP_IconSlot>
  </_panel>
</createControlType>

//========================================================
Create new XML script TMP_hud

Code: [Select]
<createControlType inheritFrom='_panel' type='TMP_hud' description='' treePath='CleanEngine' name="TMP_hud" dockMode="FILL">
  <size x="1035" y="715"/>
  <defaultStatePresentation>
    <color r="0" g="0" a="0.100000001"/>
  </defaultStatePresentation>
</createControlType>

//========================================================
Create new XML script TMP_Icon

Code: [Select]
<createControlType class='TMP_Icon' type='TMP_Icon' description='' treePath='' name="TMP_Icon" texture="\GUI\tempIventoryIcons.dds" isInert="false">
  <size x="40" y="40"/>
  <defaultStatePresentation>
    <size x="96" y="125"/>
  </defaultStatePresentation>
</createControlType>

//========================================================
Create new XML script TMP_Iconpanel

Code: [Select]
<createControlType class='TMP_Iconpanel' type='TMP_Iconpanel' description='' treePath='CleanEngine' name="TMP_Iconpanel" resizeable="ALL" scrollable="VERTICAL">
  <size x="270" y="250"/>
  <defaultStatePresentation>
    <color r="0" g="0" b="0" a="0.5"/>
  </defaultStatePresentation>
  <_label name="title" text="Icons" displayfont="LARGETEXT" justification="CENTER">
    <defaultStatePresentation>
      <color r="1" g="0" b="0"/>
    </defaultStatePresentation>
    <autoCenter horizontal="true"/>
  </_label>
</createControlType>

//========================================================
Create new XML script TMP_IconSlot

Code: [Select]
<createControlType class='TMP_IconSlot' type='TMP_IconSlot' description='' treePath='' name="TMP_IconSlot" textureFilter="false">
  <size x="45" y="45"/>
  <maximumSize x="2048" y="2048"/>
  <defaultStatePresentation>
    <color a="0"/>
  </defaultStatePresentation>
  <hoverStatePresentation>
    <color a="0"/>
  </hoverStatePresentation>
  <selectedHoverStatePresentation>
    <color r="0" g="0" b="0" a="0"/>
    <size x="0" y="0"/>
  </selectedHoverStatePresentation>
  <TMP_Icon name="IconPic" texture="\GUI\ability_icons_2_v2.dds">
    <defaultStatePresentation>
      <size y="96"/>
    </defaultStatePresentation>
    <hoverStatePresentation>
      <size x="96" y="96"/>
    </hoverStatePresentation>
    <autoCenter horizontal="true" vertical="true"/>
  </TMP_Icon>
  <_panel name="Picpanel" dockMode="FILL" texture="\GUI\ccs_elements_v2.dds">
    <size x="45" y="45"/>
    <defaultStatePresentation>
      <position x="999" y="672"/>
      <size x="138" y="142"/>
    </defaultStatePresentation>
    <hoverStatePresentation>
      <position x="999" y="672"/>
      <size x="138" y="142"/>
    </hoverStatePresentation>
  </_panel>
</createControlType>

//========================================================
In (client side) script E_PlayerAccountClassMethods under the chatwindow

Code: [Select]
        TMP_IconpanelClassMethods:Start()
        TMP_HotbarClassMethods:Start(addedNode)
« Last Edit: Jul 26, 14, 01:09:52 AM by Thazager »
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: DragNDrop Icon system
« Reply #1 on: Mar 15, 13, 06:32:14 PM »

Thanks for taking the time to do this tutorial.
Logged

AlderonGames

  • World Owners
  • ****
  • Posts: 20
    • View Profile
Re: DragNDrop Icon system
« Reply #2 on: Mar 15, 13, 08:20:14 PM »

Was looking for a tutorial like this.

Thanks.
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: DragNDrop Icon system
« Reply #3 on: Mar 16, 13, 04:06:15 AM »

I think I have everything setup correctly but when I try to drag an icon onto the newly created ability bar (Testpanel) nothing happens.

When I do the action of dragging and dropping the console says
Quote
05:07:06: SCRIPT:[TMP_IconClassMethods]:panel TMP_Testpanel
05:07:06: SCRIPT:[TMP_IconClassMethods]:found nothing
05:07:07: SCRIPT:[TMP_IconClassMethods]:panel TMP_Testpanel
05:07:07: SCRIPT:[TMP_IconClassMethods]:found nothing

Do i need to change the abilities to ones that I actually have or did I miss a step?

Thanks!
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: DragNDrop Icon system
« Reply #4 on: Mar 16, 13, 04:26:08 PM »

panel TMP_Testpanel is the main panel. Dropping the Icon on that spot will not allow the drop. The mouse needs to be inside the space to drop it on. It should say panel1 or one of the other panels to allow the drop to happen. Check to see that the smaller panels on TEMP_Testpanel are in place and named correctly. I found that if they have capitol letters and the function is looking for small letters, it wont find them.
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: DragNDrop Icon system
« Reply #5 on: Mar 16, 13, 04:53:07 PM »

They seem to be named correctly.

"edit"

I found a error that i'm getting.
Quote
!ERROR!System:The GUIControl type TMP_Iconpanel is self-referential. To fix this, modify its XML and remove all child controls that use this control type.
!ERROR!System:GUIXMLChomper::ChompControlNode: Unknown node name: TMP_Iconpanel
!ERROR!System:GUIXMLChomper::ChompControlChildren Failed to chomp "TMP_Iconpanel" due to an earlier error.

« Last Edit: Mar 16, 13, 05:14:21 PM by Viper155 »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: DragNDrop Icon system
« Reply #6 on: Mar 16, 13, 07:12:42 PM »

Here are the 2 GUIs that are created. If that does not fix it, check the DOM for all 3 classes. In the TMP_Iconpanel, the prototype you made earlier, the TMP_Icon is added to it. GUIs can have other GUIs in them.

TMP_Testpanel

Code: [Select]
<createControlType inheritFrom='_movePanel' class='TMP_Testpanel' type='TMP_Testpanel' description='' treePath='CleanEngine' name="TMP_Testpanel" texture="\GUI\ability_bar_pets_v2.dds" allowTitlebar="false" allowCloseButton="false" allowDragging="false" resizeable="NONE" scrollable="NONE" allowHelpButton="false" allowMinimizeButton="false">
  <position x="150" y="500"/>
  <size x="470" y="80"/>
  <defaultStatePresentation>
    <color a="1"/>
    <position x="24" y="94"/>
    <size x="470" y="80"/>
  </defaultStatePresentation>
  <TMP_panel name="panel1"/>
  <TMP_panel name="panel2">
    <position x="82"/>
  </TMP_panel>
  <TMP_panel name="panel3">
    <position x="160"/>
  </TMP_panel>
  <TMP_panel name="panel4">
    <position x="240"/>
  </TMP_panel>
  <TMP_panel name="panel5">
    <position x="316"/>
  </TMP_panel>
  <TMP_panel name="panel6">
    <position x="394"/>
  </TMP_panel>
</createControlType>


TMP_Iconpanel

Code: [Select]
<createControlType inheritFrom='_movePanel' class='TMP_Iconpanel' type='TMP_Iconpanel' description='' treePath='CleanEngine' name="TMP_Iconpanel" allowTitlebar="false" allowCloseButton="false" allowDragging="false" resizeable="ALL" scrollable="VERTICAL" allowHelpButton="false" allowMinimizeButton="false">
  <position x="300" y="200"/>
  <size x="170" y="150"/>
  <defaultStatePresentation>
    <color r="0" g="0" b="0" a="0.5"/>
  </defaultStatePresentation>
  <TMP_Icon name="Icon" tooltip="Spell">
    <position x="115" y="30"/>
    <size x="50" y="50"/>
    <defaultStatePresentation>
      <position x="216"/>
    </defaultStatePresentation>
  </TMP_Icon>
  <TMP_Icon name="Icon" tooltip="Shield">
    <position x="60" y="30"/>
    <size x="50" y="50"/>
    <defaultStatePresentation>
      <position x="144"/>
    </defaultStatePresentation>
  </TMP_Icon>
  <TMP_Icon name="Icon" tooltip="Attack">
    <position x="5" y="30"/>
    <size x="50" y="50"/>
  </TMP_Icon>
  <_label name="title" text="Icon List" displayfont="LARGETEXT" justification="CENTER">
    <position x="35"/>
    <defaultStatePresentation>
      <color r="1" g="0" b="0"/>
    </defaultStatePresentation>
  </_label>
</createControlType>
« Last Edit: Mar 16, 13, 07:15:08 PM by Thazager »
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: DragNDrop Icon system
« Reply #7 on: Mar 16, 13, 10:17:48 PM »

I just started completely over and i'm still getting the same issue :(
« Last Edit: Mar 16, 13, 11:03:42 PM by Viper155 »
Logged

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: DragNDrop Icon system
« Reply #8 on: Mar 17, 13, 04:27:00 AM »

You pasted the error you are receiving from the "Error" tab. Can you please post the errors you are getting in the "Script Errors" tab and "Console" tab.

Be sure to clear both of those before attempting to drag any icons. Then paste both logs right after you have recreated the problem.
« Last Edit: Mar 17, 13, 04:28:32 AM by nocake »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: DragNDrop Icon system
« Reply #9 on: Mar 17, 13, 04:37:44 AM »

I found the error, and fixed the above tutorial. Thanks for helping find it.
« Last Edit: Mar 17, 13, 04:49:24 AM by Thazager »
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: DragNDrop Icon system
« Reply #10 on: Mar 17, 13, 05:50:47 PM »

Thank you!
Logged

TheVoid

  • World Owners
  • ****
  • Posts: 3
    • View Profile
    • Hiotts.com
Re: DragNDrop Icon system
« Reply #11 on: Mar 22, 13, 05:13:49 PM »

Wow!  Thanks for your time, and the Tutorial works perfect.  I am just lost on how to assign individuality to the icons
and once they reach the TestPanel how to target them.

            Thanks again for your time.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: DragNDrop Icon system
« Reply #12 on: Mar 22, 13, 08:09:58 PM »

One way would be looking at the texture and matching it with list from which you could find which Icon you had. Another way could be by checking the tooltip area and having different values in there.
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

TheVoid

  • World Owners
  • ****
  • Posts: 3
    • View Profile
    • Hiotts.com
Re: DragNDrop Icon system
« Reply #13 on: Mar 24, 13, 11:40:50 AM »

Yes Thanks again!  I think I have it working the way I need it.

I changed TMP_Icon and added.

//movIcon.tooltip = me.tooltip
//Icon.tooltip = movIcon.tooltip


and changed the add Icon to slot
//Icon.ignoreMouseEvents = false

On the TMP_Testpanel  I changed the Remove onMouseDown to

//when target.parent.name


and added

//method onMouseClick(args references Class GUIMouseEvent)
 //target as NodeRef of Class GUIControl = args.source
 
  //  if args.leftButton
  //   when target.tooltip
     
  //   is "Attack"
 //       println("Ability1: Weapon Strike")
 //       SendCommand("/ability use abWeaponStrike")
//      .
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: DragNDrop Icon system
« Reply #14 on: Apr 07, 13, 06:18:26 PM »

Thanks TheVoid, that was helpful. 

How would I get it to save the ability icons a user has dropped onto the test panel/ability bar each time they log back in?

Thanks!
Logged
Pages: [1] 2