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: Can't install races correctly  (Read 120 times)

Offline Mahi

  • Level 0 Beginner
  • Posts: 3
  • <3 WCS :)
Can't install races correctly
« on: February 13, 2010, 07:00:47 PM »
Hey guys, I just installed freddukes "My First Race" example race from his tutorial how to code races, I've also tried many other custom races but none of them worked, every race has this same problem, I can't spend skills and at "raceinfo" there are no available skills...


Code: [Select]
###################
# Import module
import es
import random
import gamethread

import wcs
from wcs import wcs

###################
#    PUBLISH INFO
info = es.AddonInfo()
info.name = 'My First Race'
info.author = 'Freddukes'

###################
#     RACE INFO
#
RaceName = 'first race'
# This is the name of the mod... We assign it to a global variable for easy reference
# It must be exactly the same name as the file name, including capital letters
race = wcs.Race(RaceName)
race.registerWeaponRestriction('allow only',(['knife','glock','usp']))

###################
#    SKILL INFO
# Syntax: registerSkill("skill name", <amount of levels>, <level interval>, "description")

race.registerSkill('My first skill',1,1,"A test to see if my skill works")
race.registerSkill("I am god",4,3,"Random chance to put you in god mode")

##################
#     Ultimate Info
# Syntax: registerUltimate("ultimate name", <required race level>, <max level>, <Level Interval>, "Description")

race.registerUltimate("I am ledgend",8,4,2,"Makes you turn red and everyones screen in a distance goes blury"



def player_spawn(event_var):
    userid = int(event_var['userid'])
    # This returns the integer of the userid... All events return as string, we want the userid as a number (integer)
   
    first_level = wcs.GetLevel(userid, RaceName, 'My first skill')
    # Returns the value of the level 'firstrace' and stores it in first_level
   
    if first_level:
# If first level is True, I.E a positive number
        es.tell(userid,'#green','Look, Your skill worked!'
       
    god_level = wcs.GetLevel(userid, RaceName, 'I am God')
    if god_level:
        wcs_rand = random.randint(1,5)
# gets a random number between 1 and 5

        if wcs_rand <= god_level:
            player = wcs.Command(userid)
# Register the player for a custom command skill

            player.God(30)
# Turn the player into god mode for 30 seconds



def player_ultimate(event_var):
    # Triggered whenever a user has used his ultimate and the ultimate counter is set to 0
   
    player = wcs.Command(userid)
# Register the player for a custom command skill

    player.SetCoolDown('I am ledgend',30)
# Registers the cooldown effect for 30 seconds for the I am ledgend ultimate.

    ledgend_level = wcs.GetLevel(userid, RaceName,"I am ledgend")
   
    player.Near(ledgend_level * 50, shake)
# The distance effected is the level multiplied by 50... Everyone inside this distance will now be passed through to the 'shake' function



def shake(userid, attacker):
# Attacker is the person to run the ultimate, userid is the victim who was close to him

    player = wcs.Command(userid)
# Register the player for custom comand skill

    player.Shake(5,10)
# Shake the victims screen for 5 seconds with a 'violence' of 10

    att = wcs.Command(attacker)
# register the attacker for custom command skill

    att.Color('red')
# Turn the attacker red

    gamethread.delayed(5,att.Color)
    # Reset the color of the user after 5 seconds
« Last Edit: February 13, 2010, 08:32:59 PM by Mahi »