Page 2 of 2

Posted: Wed May 13, 2015 12:54 pm
by juse is bastard
Is there now any difference between "skill" and "passive"?

Posted: Thu May 14, 2015 8:26 am
by Mahi
Passives are always enabled, and they cannot be leveled using skill points.
Skills are enabled only when a player has spent his hero's skill points on them.
So the only difference is that you need to (and you can) level skills with skill points, whereas passives are enabled already on level 0 and they're not affected by your hero's level unless you explicitly define so.

Edit: We have our own forum stoo, although it's still missing quite a lot. Questions like this can be posted there to avoid this topic from flooding: http://www.hero-wars.com/

Posted: Fri May 15, 2015 12:37 am
by SpreadKiller
Thanks, And i've updated and now its spamming this in console, It shows the Menu once and thats all, You wont get EXP or anything :S.

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File '..\addons\source-python\packages\source-python\events\listener.py', line
 93, in fire_game_event
    callback(game_event)
  File '..\addons\source-python\plugins\hw\player.py', line 40, in player_discon
nect
    save_player_data(player)
  File '..\addons\source-python\plugins\hw\database.py', line 65, in save_player
_data
    (player.steamid, player.gold, player.hero.cid)

AttributeError: 'NoneType' object has no attribute 'cid'

Posted: Fri May 15, 2015 2:38 pm
by Mahi
SpreadKiller wrote:Thanks, And i've updated and now its spamming this in console, It shows the Menu once and thats all, You wont get EXP or anything :S.

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File '..\addons\source-python\packages\source-python\events\listener.py', line
 93, in fire_game_event
    callback(game_event)
  File '..\addons\source-python\plugins\hw\player.py', line 40, in player_discon
nect
    save_player_data(player)
  File '..\addons\source-python\plugins\hw\database.py', line 65, in save_player
_data
    (player.steamid, player.gold, player.hero.cid)

AttributeError: 'NoneType' object has no attribute 'cid'
This shouldn't really happen, my best quess is you're still using the database from an old version of Hero-Wars. Try deleting hw.db from your \addons\source-python\plugins\hw folder and then try again.

EDIT: Also, please, all non Source.Python related issues to our forums at http://www.hero-wars.com/. Let's keep this topic on Source.Python stuff :)

Re: Hero Wars (Alpha)

Posted: Mon Sep 05, 2016 10:35 pm
by Doldol
Sad to see this die, site + repo down. Is the source still available somewhere?

Re: Hero Wars (Alpha)

Posted: Tue Sep 06, 2016 8:15 am
by Predz
Hey Doldol, the project hasn't gone far. Me and Mahi have collaborated to work on a more community driven plugin called Warcraft Source. I have a beta server running it atm, which I have been working on for the last week. The current git for the plugin is here: https://github.com/Mahi/Warcraft-SP

I personally have a large amount of extensions for the plugin to add new events, new experience gains, and other features. The IP to the server I am currently beta testing on is: playfort.eu:27019

The heroes on this server are far beyond the capabilities of the old Warcraft Source, and so I feel this is a massive step forward. Here is an example hero:

Syntax: Select all

from ..entities import Hero
from ..entities import Skill, callback

from effects.base import TempEntity
from engines.precache import Model
from entities.entity import Entity
from filters.players import PlayerIter
from listeners.tick import Delay, TickRepeat
from messages import SayText2

from random import randint
from time import time

class Orc(Hero):
'Battle-scorned orcs are known to be brutal in combat.'

max_level = 40
required_level = 0


@Orc.skill
class Critical_Strike(Skill):
'You are able to hit vital points, causing major damage.'

max_level = 8

laser = Model('sprites/lgtning.vmt')

@callback('player_spawn', 'player_upgrade_skill')
def _on_spawn_start_repeat(self, player, **eargs):
self._can_crit = True
self._counter = 0

self._repeat = TickRepeat(self._on_game_tick)
self._repeat.start(0.1, 0)

@callback('player_death')
def _on_death_stop_repeat(self, victim, **eargs):
if hasattr(self, '_repeat'):
self._repeat.stop()

@callback('player_pre_attack')
def _on_player_pre_attack(self, attacker, victim, info, **eargs):
if self._can_crit:
info.damage *= 1 + 0.2 * self.level
SayText2(
'+ \x04Critical strike \x05on \x0a{} \x05caused \x02vital damage!'.format(
victim.name)
).send(attacker.index)

self._can_crit = False
self._counter = 0

def _on_game_tick(self):
self._counter += 1
if self._counter == 60 - (self.level * 2):
self._can_crit = True

@Orc.skill
class Earthgrab_Totem(Skill):
'Root your enemies to the ground.'

laser = Model('sprites/lgtning.vmt')

max_level = 8

@callback('player_pre_attack')
def _on_player_pre_attack(self, attacker, victim, **eargs):
if randint(1, 100) <= 16 + self.level and not victim.stuck:
victim.stuck = True
Delay(1.5, victim.__setattr__, 'stuck', False)

SayText2('~ \x04Rooted \x0a{} \x01to the ground.'.format(victim.name)
).send(attacker.index)

@Orc.skill
class Reincarnation(Skill):
'Upon death, the shamans will ressurect you in your old location.'

max_level = 8

@callback('player_pre_victim')
def _on_pre_death_obtain_weapons(self, victim, **eargs):
self._weapons = [Entity(index).class_name for index in victim.weapon_indexes(
not_filters='knife')
]

@callback('player_death')
def _on_death_respawn(self, victim, **eargs):
if randint(1, 100) <= 25 + self.level:
Delay(0.5, victim.respawn)
for index in victim.weapon_indexes(not_filters='knife'):
entity = Entity(index)
Delay(0.7, victim.drop_weapon, entity.pointer, None, None)
for weapon in self._weapons:
Delay(1.2, victim.give_named_item, weapon)

SayText2('~ \x0cRespawning \x04in \x011 \x04second.').send(victim.index)


@Orc.skill
class Chain_Lightning(Skill):
'You channel a lightning rod which ricochets from player to player.'

max_level = 8
laser = Model('sprites/lgtning.vmt')

beam = TempEntity('BeamPoints', alpha=255, red=255, green=200, blue=200,
life_time=1.0, start_width=7, end_width=7, frame_rate=255)

def _find_closest_player(self, player, team, length=99999, exclusions=[]):
_target = None
for target in PlayerIter(not_filters=team):
_distance = player.origin.get_distance(target.origin)
if _distance < length and not target in exclusions:
_target = target
length = _distance
return _target

def _find_chain_players(self, player, length, count):
_last_target = player
team = ['t', 'ct'][player.team-2]
_targets = []
while count > 0:
if not _last_target:
break
_target = self._find_closest_player(_last_target, team, length, _targets)
_targets.append(_target)
_last_target = _target
count -= 1
return _targets

@callback('player_spawn', 'player_upgrade_skill')
def _on_player_spawn_reset(self, player, **eargs):
self._cooldown = False
self._delay = Delay(4, self.__setattr__, '_cooldown', True)

@callback('player_ultimate')
def _on_player_ultimate(self, player, **eargs):
if self._cooldown:
last_target = player
targets = self._find_chain_players(player, 500, 3)

if targets[0] == None:
SayText2('~ \x04Chain Lightning \x01found no enemies!').send(player.index)
return

for target in targets:
if not target:
continue
target.take_damage(20+4*self.level, attacker_index=player.index)
self.beam.start_point = last_target.origin
self.beam.end_point = target.origin
self.beam.model = self.beam.halo = self.laser
self.beam.create()
last_target = target

SayText2('~ \x04Chain Lightning \x02hit enemies!').send(player.index)
self._cooldown = False
self._delay = Delay(15, self.__setattr__, '_cooldown', True)
else:
SayText2('~ \x04Chain Lightning \x01is on \x05cooldown for {} seconds.'.format(
int(self._delay.exec_time-time()))
).send(player.index)


The critical strike skill is set on a recharge as you can see from the TickRepeat. So that players dont just get lucky and possibly hit 3 or 4 crits in a row. Now you can use this to be more skilled, and delay your shots to specifically get the crit you wanted. I personally play this hero with only deagle :D

Earthgrab Totem is designed to give this hero a counter to other heroes with a lot of speed. So I added a small root to give it that. This also checks that the player isn't currently rooted, meaning for no double roots, etc. Just a bit for the healthiness of the hero in game.

I am sure I could improve on the optimisation of the ultimate, however it is clean and chains from player to player nicely. If any of you have more optimised ways of coding it, I would love suggestions :)

I have coded a few really complex heroes, however would like to keep them to my server for the meantime. :smile: I have created a hero which can create portals through walls on the map. Sorta like Bard from League of Legends.

Re: Hero Wars (Alpha)

Posted: Tue Sep 06, 2016 10:04 am
by L'In20Cible
A bit off topic but, you could highly optimize by globalizing your TempEntity instance and simply update its location before the create() call. You could also place it in your class, for example:

Syntax: Select all

@Orc.skill
class Chain_Lightning(Skill):
'You channel a lightning rod which ricochets from player to player.'

max_level = 8
laser = Model('sprites/lgtning.vmt')

beam = TempEntity('BeamPoints', alpha=255, red=255, green=200, blue=200,
life_time=1.0, start_width=7, end_width=7, frame_rate=255)

@callback('player_ultimate')
def _on_player_ultimate(self, player, **eargs):
...

self.beam.start_point = last_target.origin
self.beam.end_point = target.origin

# This can't be globalized, since the precache tables are freed every
# map change.
self.model = self.halo = self.laser

self.beam.create()


You could be surprized timing the difference. I would always recommend to globalize your TempEntity instances and reuse them updating what was unknown at loading time upon creation.

Also, I modified to use the non _index attributes, TempEntity accepts Model/Decal instances directly. Could also do the same for red/green/blue/alpha, they could be replaced using "color" attribute set to a Color instance.

Re: Hero Wars (Alpha)

Posted: Tue Sep 06, 2016 10:35 am
by Predz
Thanks, too used to using the old temp_entities object we had access too. Still adjusting to the new way. Have adjusted it already. :)

Re: Hero Wars (Alpha)

Posted: Tue Sep 06, 2016 10:52 am
by L'In20Cible
temp_entities, ITempEntsSystem singleton, was wrapping the global CBaseTempEntity instances so you had to set all values before creation. The TempEntity class, is basically allocating a new object which copy the global one (mainly for its dispatch table) allowing you to change values without affecting any other instances - this seemed the best approach to me. As for the wrapped types, you can find them in the data files. For example, BeamPoints is wrapping color, model and halo internally setting the correct values based on the given instance.

Re: Hero Wars (Alpha)

Posted: Tue Sep 06, 2016 1:42 pm
by Mahi
Also Doldol, and anyone else still interested in this project, my military service will end in eight days and while I'm quite likely going to spend the first week or so mostly with my friends and family, I will be back on the project (hopefully other projects and even SP too) in no time! It's been long 9 months, but you should be hearing a lot more of me from now on :)

Re: Hero Wars (Alpha)

Posted: Tue Sep 06, 2016 3:53 pm
by Predz
Pleased to see you back Mahi :cool:

Re: Hero Wars (Alpha)

Posted: Tue Sep 06, 2016 5:36 pm
by Mahi
Still a few days to go, but thanks! :)

Re: Hero Wars (Alpha)

Posted: Thu Sep 08, 2016 6:08 am
by Doldol
That sounds great Mahi & Predz :)

Re: Hero Wars (Alpha)

Posted: Mon Jul 17, 2017 6:53 pm
by rafau94
I assume project is dead since your repo is down ?

Re: Hero Wars (Alpha)

Posted: Mon Jul 17, 2017 7:50 pm
by iPlayer
rafau94 wrote:I assume project is dead since your repo is down ?

I believe it's reincarnated as Warcraft-SP

Re: Hero Wars (Alpha)

Posted: Mon Jul 17, 2017 8:40 pm
by rafau94
iPlayer wrote:
rafau94 wrote:I assume project is dead since your repo is down ?

I believe it's reincarnated as Warcraft-SP

Ah,ok, thanks :)