Getting back into Event Scripts

. Thursday, August 28, 2008
  • Agregar a Technorati
  • Agregar a Del.icio.us
  • Agregar a DiggIt!
  • Agregar a Yahoo!
  • Agregar a Google
  • Agregar a Meneame
  • Agregar a Furl
  • Agregar a Reddit
  • Agregar a Magnolia
  • Agregar a Blinklist
  • Agregar a Blogmarks

I have been working quite a bit lately and now I finally have a chance to do what Ive been dreaming of doing, writing "mods" for counter-strike:source using event scripts. Now I'm still a bit of a novice when write code in Python but because the language is so easy to learn I know I'll overcome that. Eventscripts can be freely obtained at www.mattie.info . There are two different files that are (from what Ive learned) es.py and playerlib.py. ES.py is a set of the main Libaries that makes ES work using the Source Console commands work properly. Playerlib.py is the Libaray that allows you more interaction and customization with the Souce engine.

If you know Source server commands, using es.Blank[source script] will allow direct intergration. If you want to use python, which is how I write scripts, searching playerlib will help you out more.

I attempted to create a script that gives everyone a HE Grenade when they spawn. I used playerlib to give a grenade by using gamethread.delayed(0.1, es.server.cmd, 'es_xgive %s weapon_hegrenade' % event_var["userid"]). One thing I've learned is that if you are going to write a script don't use the give function on player spawn. The time for the server to click the script to load it passes before the tick occours. Also if you are learning one VERY valuable command is myplayer = playerlib.getPlayer(userid) you'll use that alot at first.

Untill Next Time,
-300LbCrab

1 comments:

Mattie said...

Glad you're getting back into ES. :)

If you have any tips/problems/questions for others, don't hesitate to post on our forums, too:
http://forums.mattie.info