Archived copy of warcraft-source.com, the Warcraft: Source (WCS) forum (2007–2011), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2010-03-30 (original capture). Home · Forum · All archived topics · Downloads

Author Topic: Help with race  (Read 134 times)

Offline Kamilot

  • Level 0 Beginner
  • Posts: 3
Help with race
« on: September 12, 2009, 01:27:15 PM »
Help, please. I am trying to create my first race and have some mistakes what i don't khow. Can anybody look through the code and find out mistakes.
Code: [Select]
import es
import random
import playerlib

import wcs
from wcs import wcs

#INFO
#info.name = 'Perfect Killer'
#info.author = '|^|Kamilot|^|'

#RACEINFO
raceName = 'Perfect Killer'
race     = wcs.Race(raceName)
allowed_weapons = ('knife','c4')
race.registerWeaponRestriction('allow only',allowed_weapons)

#SKILLINFO
race.registerSkill('Ideal Strike',5,2,'He knows where to aim')
race.registerSkill('Stealth Assasin',6,2,'Nobody will see you before attack')
race.registerSkill("Hit'n'Run",5,2,'Get out of the dead body')
race.registerUltimate('Special Gadgets',8,4,2,'Make your enemies clips empty')


def player_spawn(ev):
    #global p
    #p=0
    userid = int(ev['userid'])
    wcs.Command(userid).Health(40)
    invisible = wcs.GetLevel(userid,raceName,'Stealth Assasin')
    if invisible:
        wcs.Command(userid).Color(alpha=255-40*invisible)
        wcs.Command(userid).Delayed(0.1,es.tell(userid,'Invisibility set'))
   

def speed(userid,sp):
    wcs.Command(userid).Delayed(12,wcs.Command(userid).Speed(sp))
    es.tell(userid,'Your invisibility and speed are normal again')
    #global p
    #p = 0

def player_hurt(ev):
    #global p
    userid = int(ev['userid'])
    attacker = int(ev['attacker'])
    wcs.Command(attacker).Color(alpha=255)
    invisible = wcs.GetLevel(attacker,raceName,'Stealth Assasin')
    speed =wcs.GetLevel(attacker,raceName,"Hit'n'Run")
    #if p==0:
    if invisible:
        wcs.Command(attacker).Fade(255-40*invisible,12)
    if speed:
        wcs.Command(attacker).Speed(1+speed*0.2)
        speed(attacker,sp)
    level = wcs.GetLevel(attacker,raceName,'Ideal Strike')
    if level:
        wcs.Command(userid).Damage(10*level,4,attacker)
        wcs.Effect().Misc4(userid, 3, 1)
    #p = 1

def player_ultimate_on(ev):
    userid = int(ev['userid'])
    team = int(es.getplayerteam(userid))
    if team == 2:
        filter = '#t'
    elif team == 3:
        filter = '#c'
    k = wcs.Command(userid).ViewCone(filter,150,600,unclip,k)
    es.tell(userid,'#green','You have made clips of %s enemies you were looking at empty'%k)

def unclip(userid,target,k):
    level = wcs.GetLevel(userid,raceName,'Special Gadgets')
    if k<=level:
        wcs.Command(target).Clip(0,1)
        wcs.Command(target).Clip(0,2)
        k=k+1
    return k
Here is text from server console
[spoiler]Traceback (most recent call last):
  File "d:\steam\steam\steamapps\musaali\source dedicated server\cstrike\addons\eventscripts\es.py", line 211, in tick
    x()
  File "d:\steam\steam\steamapps\musaali\source dedicated server\cstrike\addons\eventscripts\_libs\python\gamethread.py", line 173, in tick
    _executenode(first)
  File "d:\steam\steam\steamapps\musaali\source dedicated server\cstrike\addons\eventscripts\_libs\python\gamethread.py", line 155, in _executenode
    function(*a, **kw)
TypeError: object of type 'NoneType' is not callable[/spoiler]
 

Offline <---Texno--->

  • Level 7 Expert
  • *****
  • Posts: 1004
  • < Need Help ? >
    • Zero-Asylum !
Re: Help with race
« Reply #1 on: September 12, 2009, 02:07:26 PM »
what happends when you use it.
or can't you use it ?

Offline Kamilot

  • Level 0 Beginner
  • Posts: 3
Re: Help with race
« Reply #2 on: September 12, 2009, 02:15:31 PM »
The message from console is shown when i take it.
and as far as i can understand player_spawn work normal, player_hurt doesn't work and ultimate_on doesn't work either

And maybe that will help when i enter the server with that race chosen i resieve the message "invisibility set" though that must be shown only at spawn

P.S before that problem I had another one in my player_hurt p==0 it said that variable was used earlier than assigned after that I wrote global p in every loop where i had p and get this error. But then I deleted them again i didn't get that problem again and still has this one
« Last Edit: September 12, 2009, 02:53:23 PM by Kamilot »

Offline Kamilot

  • Level 0 Beginner
  • Posts: 3
Re: Help with race
« Reply #3 on: September 12, 2009, 06:34:25 PM »
ok, I solved the problem but i still don't understand why it writes "invisibility set" when i only enter the server