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

Author Topic: Simple mana system  (Read 18181 times)

LastJudge

  • General Accounts
  • *
  • Posts: 215
    • View Profile
Re: Simple mana system
« Reply #30 on: Nov 25, 12, 01:56:09 PM »

You can make a simple boolean to check whether the character is running or not. If it's running, subtract 10, if not, nothing happens. And after you subtract 10, check if mana is 0, if yes, set boolean for running to false.

I can provide you with some code later, but I'm not at my development machine right now.
Logged
Re: Simple mana system
« Reply #31 on: Nov 26, 12, 11:56:53 AM »

your code would be most appreciated, I am not sure where to write the function either. I attempted to code it in both server side; Input_Movement and client side; E_ACCControllerClassMethods, both giving the same error; Node variable does not specify a class that contains the field E_fatiguePoints. (my mana variable's name)
Logged

LastJudge

  • General Accounts
  • *
  • Posts: 215
    • View Profile
Re: Simple mana system
« Reply #32 on: Nov 27, 12, 05:05:39 AM »

your code would be most appreciated, I am not sure where to write the function either. I attempted to code it in both server side; Input_Movement and client side; E_ACCControllerClassMethods, both giving the same error; Node variable does not specify a class that contains the field E_fatiguePoints. (my mana variable's name)

I might have time to take a look at it during the weekend. Right now I'm very busy with some work for a client and I haven't really done much in HE during last 6 months, but I'll try to provide you with some code. :)
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1149
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Simple mana system
« Reply #33 on: Dec 17, 12, 06:02:32 AM »

I tried to do this a while back before finding this tutorial.
I mostly copied the health bar and added to the client scripts. I saw 2 steps I had not done, so got those done with this tutorial. I also added an E_regenManaTimer and set it up like the health one. Mine, however does not move.

Would that be because of the client side scripts also added in?
One thing that could be overlooked was the "set Change Callback to true". I missed that on the 1st tme, but adding it did not solve the problem.
Logged

Hobbie

  • World Owners
  • ****
  • Posts: 11
  • Master of Banjos
    • View Profile
Re: Simple mana system
« Reply #34 on: Dec 17, 12, 11:08:06 PM »

My health slider works fine.  My mana one does not.  I need to take a peek at it in the next week or so - I'll post what I find if I don't see something else up first.  Busy week up through Christmas!
Logged
Dan Hanson

Thazager

  • General Accounts
  • *
  • Posts: 1149
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Simple mana system
« Reply #35 on: Dec 21, 12, 03:15:26 PM »

Going through some of more files in search of another subject I found a section that might not have been covered. I added them in, but still the mana bar is not moving. When I target myself using tab, I notice the mana is changing, but the change does not show as you view it.

in cmdCommands on server side

under
      pc.E_hitPoints = 100
add
      pc.E_manaPoints = 100
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: Simple mana system
« Reply #36 on: Jan 06, 13, 04:00:08 AM »

Can anyone wright a quick tutorial on how to get this below the health status bar?

Thanks!
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1149
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Simple mana system
« Reply #37 on: Jan 06, 13, 04:29:16 AM »

For the GUI addition:

under HeroScript tab open GUIeditor

on the gui editor panel, double click on e_StatusBar to open the gui
on the properties panel, select e_StatusBar for adding a gui as a child
on the gui editor panel, double click on _panel to add it to the gui
on the properties panel, select _panel to change its values

" ", change name to manaPanel    hit enter
" ", set position to 6,39     hit enter
" ", set size to 160,7     hit enter
" ", set defaultStatePresentation color  to  0,0,0,1    hit enter

on the gui editor panel, double click on _panel to add it to gui as a child
on the properties panel, select _panel to change its values

" ", change the name to manaSlider    hit enter
" ", set size to 80,7     hit enter
" ", set defaultStatePresentation color  to  0,0,1,1    hit enter

top left side hit the save Icon, then the close Icon.


for diff colors set the rgb of that last field
red = 1,0,0,1
green = 0,1,0,1
blue = 0,0,1,1
yellow = 1,1,0,1
purple = 1,0,1,1
cyan = 0,1,1,1
black = 0,0,0,1
white = 1,1,1,1
« Last Edit: Jan 06, 13, 04:37:38 AM by Thazager »
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: Simple mana system
« Reply #38 on: Jan 06, 13, 05:11:42 AM »

wow Thazager, awesome!

One last thing.  Has anyone been able to get the mana to update real time as its used just like the hitpoint bar?
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1149
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Simple mana system
« Reply #39 on: Jan 06, 13, 05:44:09 AM »

yes, there are some lightweightEventRaised() functions that seem to be making the script work. I had to double check everything from the begin of tutorial to end to see if there were any additions to making it work. I basically did a search on all scripts (client and server) and added in the manaPoints where the hitpoints were. Some of the functions were a little different as they did not need a target.

Also make sure the you addeed the values to the DOM class, after declaring as fields.
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: Simple mana system
« Reply #40 on: Jan 07, 13, 01:01:05 AM »

well i was able get my targets mana bar to update but no such like with my own.

What am i missing?


I have this in there as well
Code: [Select]
is "e_hitpoints"     
      $LightweightEvents.raiseLightweightEvent(updateNode, "hpUpdated", 0)
    .
     is "e_manapoints"     
      $LightweightEvents.raiseLightweightEvent(updateNode, "mpUpdated", 0)
    .
« Last Edit: Jan 07, 13, 01:56:27 AM by Viper155 »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1149
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Simple mana system
« Reply #41 on: Jan 07, 13, 04:10:07 AM »

Places I added it in script. I also added a E_regenManaTimer with it.

client side:
script = E_nonplayerCharacterClassMethods in _OnReplicationFieldUpdated()
    is "e_manaPoints"
      $LightweightEvents.raiseLightweightEvent(updateNode, "manaUpdated", 0)
    .

script = E_playerCharacterClassMethods in _OnReplicationFieldUpdated()
    is "e_manaPoints"     
      $LightweightEvents.raiseLightweightEvent(updateNode, "manaUpdated", 0)
    .

script = E_StatusBarClassMethods in lightweightEventRaised()
    is "manaUpdated"
      char as NodeRef of Class E_CommonCharacter = subject
      if char != None
        me.SetEND(char.E_manaPoints)
      . 
    .

script = E_StatusBarClassMethods
Code: [Select]
method SetMana(ma copies Integer)
  if ma < 0
    ma = 0
  .
  manaSlider as NodeRef of Class GUIControl = FindGUIControlByName(me, "manaPanel.manaSlider")
  manaSlider.removeAnimations()
  var size = -1.0 * ma

  animationString as String = "size.x,"
  animationString = animationString + manaSlider.size.x + ","
  animationString = animationString + size +","
  animationString = animationString + .1 + ","
  animationString = animationString + 1 + ","
  animationString = animationString + "false,"
  animationString = animationString + "LINEAR," 
  animationString = animationString + "false,"
  animationString = animationString + "0,"
  animationString = animationString + "slide"
 
  GUIAnimation:addAnimation(manaSlider, "Interpolate", animationString)
.

script = E_TargetCircleClassMEthods in E_UpdateTargetCircle()
      $LightweightEvents.addLightweightEventListener(realtarget, "manaUpdated", statusbar)
      statusbar.SetMana(realtarget.E_manaPoints)


server side:
script = cmdCommands in HE_ProcessCommandInput()
      pc.E_manaPoints = 100

script = E_characterCreationSystemClassMethods in HE_CCSIsAlphaCharacter()
  char.E_manaPoints = 100

script = E_CommonCharacterClassMethods in InitCommonCharacter()
  me.E_manaPoints = 100

  if( me.E_regenManaTimer.timerState == ON )
    me.E_regenManaTimer.stop()
  .
  me.E_regenManaTimer.fireRate = 00:00:01
  me.E_regenManaTimer.start()


method AdjustManaPoints( manaDelta as Integer, ability as NodeRef of Class E_Ability )
  me.E_manaPoints = MiscUtils:Min( me.E_manaPoints + manaDelta, 100 )
.

in ApplyDeath()
  me.E_manaPoints = 0

in ApplyLife()
  me.E_manaPoints = 100

method E_regenManaTimer_tick()
  if me.IsDead()
    return
  .
  me.E_manaPoints = MiscUtils:Min( me.E_manaPoints + 10, 100 )
.

script = E_nonplayerCharacterClassMethods in InitCommonCharacter()

method AdjustManaPoints( manaDelta as Integer, ability as NodeRef of Class E_Ability )
  parentClass::AdjustManaPoints( manaDelta, ability )         //  Let the parent class handle the actual Adjust mana.
  me.E_manaPoints = MiscUtils:Min( me.E_manaPoints + manaDelta, me.E_manaPoints )
.

script = E_playerCharacterClassMethods in ProcessXPGain()
    me.E_manaPoints = 100

script = E_characterCreationSystemClassMethods in HE_CCSCharacterActivated()
  char.E_manaPoints = 100

script = skippy in HE_ProcessCommandInput() near     to "damage"
      pc.AdjustManaPoints(-5, ability)
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: Simple mana system
« Reply #42 on: Jan 07, 13, 11:33:54 PM »

Got it!!!  Thanks so much, I really appreciate it!
Logged

Lithis

  • World Owners
  • ****
  • Posts: 4
    • View Profile
Re: Simple mana system
« Reply #43 on: Feb 07, 13, 06:53:25 PM »

Can anyone give me a little help getting the mana bar on gui to update in relation to % of mana, i added

Code: [Select]
method SetMana(ma copies Integer)
  if ma < 0
    ma = 0
  .
  manaSlider as NodeRef of Class GUIControl = FindGUIControlByName(me, "manaPanel.manaSlider")
  manaSlider.removeAnimations()
  var size = -1.0 * ma

  animationString as String = "size.x,"
  animationString = animationString + manaSlider.size.x + ","
  animationString = animationString + size +","
  animationString = animationString + .1 + ","
  animationString = animationString + 1 + ","
  animationString = animationString + "false,"
  animationString = animationString + "LINEAR," 
  animationString = animationString + "false,"
  animationString = animationString + "0,"
  animationString = animationString + "slide"
 
  GUIAnimation:addAnimation(manaSlider, "Interpolate", animationString)
.

To the E_StatusBarClassMethods checked that everything is named correctly etc but the mana bar just sits at 50%.
Logged

Lithis

  • World Owners
  • ****
  • Posts: 4
    • View Profile
Re: Simple mana system
« Reply #44 on: Feb 09, 13, 12:13:33 PM »

Ive gone through every script that contains anything to do with health, hp etc and added whats needed for stamina and a mana bar. The server side all works it wont let me do stuff if mana or stamina is too low but i still cannot get the bars to update other than when i retab back to myself it updated the mana/stamina bar in target window.

Im pretty new at this but from all the different stuff ive tried im guessing all my server side code is fine its just the client side but ived checked over and over for anywhere that has anything to do with health and ive done everything people have said in this thread

Code: [Select]
script = E_nonplayerCharacterClassMethods in _OnReplicationFieldUpdated()
    is "e_manaPoints"
      $LightweightEvents.raiseLightweightEvent(updateNode, "manaUpdated", 0)
.

Code: [Select]
script = E_playerCharacterClassMethods in _OnReplicationFieldUpdated()
    is "e_manaPoints"     
      $LightweightEvents.raiseLightweightEvent(updateNode, "manaUpdated", 0)
    .

Code: [Select]
script = E_StatusBarClassMethods in lightweightEventRaised()
    is "manaUpdated"
      char as NodeRef of Class E_CommonCharacter = subject
      if char != None
        me.SetMana(char.E_manaPoints)
      . 
    .

Code: [Select]
method SetMana(ma copies Integer)
  if ma < 0
    ma = 0
  .
  manaSlider as NodeRef of Class GUIControl = FindGUIControlByName(me, "manaPanel.manaSlider")
  manaSlider.removeAnimations()
  var size = -1.0 * ma

  animationString as String = "size.x,"
  animationString = animationString + manaSlider.size.x + ","
  animationString = animationString + size +","
  animationString = animationString + .1 + ","
  animationString = animationString + 1 + ","
  animationString = animationString + "false,"
  animationString = animationString + "LINEAR," 
  animationString = animationString + "false,"
  animationString = animationString + "0,"
  animationString = animationString + "slide"
 
  GUIAnimation:addAnimation(manaSlider, "Interpolate", animationString)
.

Code: [Select]
script = E_TargetCircleClassMEthods in E_UpdateTargetCircle()
      $LightweightEvents.addLightweightEventListener(realtarget, "manaUpdated", statusbar)
      statusbar.SetMana(realtarget.E_manaPoints)

Even added

Code: [Select]
$LightweightEvents.addLightweightEventListener(addedNode, "manaUpdated", statusBar)
To the E_PlayerAccountClassMethods which had a lightevent for hp which wasnt mentioned and i just cannot find anything anywhere. Can someone please give some advice.
Logged
Pages: 1 2 [3] 4 5