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 2009-11-12 (original capture). Home · Forum · All archived topics · Downloads
Warcraft-Source.com - WCS mod for CSS
November 12, 2009, 08:23:51 PM *
Welcome, Guest. Please login or register.
Login with username, password and session length
News: Remember to check on the FAQ before start posting.
It may save you time and effort.
Google  
  Home   Forum   Help Search Login Register   *
Pages: [1]   Go Down
  Print  
This topic has not yet been rated! You have not rated this topic. Select a rating:
Author Topic: Get Race Name?  (Read 83 times)
Loaded
Level 2 Apprentice
**
Offline Offline

Posts: 54



« on: August 18, 2009, 02:32:19 AM »

For races that need the use of the event weapon_fire or such I always did the code like this:

Code:
event weapon_fire
{
es_keygetvalue wcs_race WCSuserdata event_var(userid) race
if (server_var(Wcs_race) = "15") do

   {
   es est_setclipammo event_var(userid) 1 0;
   es es_xdelayed 4 est_setammo event_var(userid) 1 1;
   {
}

That code forces the player to have 1 shot then after a delay of 4 they get another bullet. It works perfectly however if I ever change the race's number to say 16 for whatever reason I also have to remember to change this script. Could someone tell me how/if I can run this script but instead of checking the race number check the race's name?

Oh BTW this script is for a race named Artillery.
Logged
xpxdoo
Level 0 Beginner

Offline Offline

United States United States

Posts: 11



« Reply #1 on: August 18, 2009, 04:02:30 AM »

I believe you can only get the race name after getting the race number. So it would just be simpler to just check for the number and remember to change it if you move the race.
Logged
Loaded
Level 2 Apprentice
**
Offline Offline

Posts: 54



« Reply #2 on: August 18, 2009, 04:24:52 AM »

Lame but alright thanks
Logged
HOLLIDAY
<Race Maker>
Watchdogs
Level 7 Expert
*****
Offline Offline

Posts: 2279



WWW
Wc3_HOLLIDAY_Wc3
wc3hollidaywc3

myServer 8.2.0.222:27015
(Warning: click connects through Steam)
« Reply #3 on: August 18, 2009, 09:07:28 AM »

instead of checking for the race number or race name you can set a new value in WCSuserdata in player_spawn_cmd that works the same way


Code
GeSHi (eventscripts):
"player_spawn_cmd"     "es_delayed 1 es_keysetvalue WCSuserdata event_var(userid) one_shot 1"

then in your script..

Code
GeSHi (eventscripts):
event weapon_fire
{
 es_keygetvalue wcs_tmp WCSuserdata event_var(userid) one_shot
 if (server_var(wcs_tmp) = 1) do
 {
     es est_setclipammo event_var(userid) 1 0
     es_delayed 4 est_setammo event_var(userid) 1 1
 }
}
 
//then set the value to 0 for when the player changes race
 
event player_spawn
{
 es_keysetvalue WCSuserdata event_var(userid) one_shot 0
}
Logged

Loaded
Level 2 Apprentice
**
Offline Offline

Posts: 54



« Reply #4 on: August 18, 2009, 09:48:05 AM »

Cool that works perfectly thanks!!

I had a hunch that holliday was going to come to my rescue lol
Logged
Jitters
Level 1 Trained Beginner
*
Offline Offline

United States United States

Posts: 20





myServer 66.150.214.229:27015
(Warning: click connects through Steam)
« Reply #5 on: November 10, 2009, 07:10:22 AM »

THREAD REVIVAL

I'm working on a sound script that is probably 50-70% functional currently.  I was thinking the same thing about getting the race number until I came across this thread Smiley

My situation is a couple different races use the wcs_ulti_roots block.
Code
GeSHi (eventscripts):
block wcs_ulti_roots
{
wcs_debuglog wcs_ulti_roots start
 es_xset wcs_team_target 0
 es_getplayerteam wcs_team server_var(wcs_userid)
 // check teams (T=2, CT=3)
 if (server_var(wcs_team) = 2) do
 {
   es_xset wcs_team_target 3
   es_xset wcs_team_targetn "#c!d"
 }
 if (server_var(wcs_team) = 3) do
 {
   es_xset wcs_team_target 2
   es_xset wcs_team_targetn "#t!d"
 }
 if (server_var(wcs_team_target) != "0") do
 {
   es_xset wcs_pcount 0
   es_getlivingplayercount wcs_pcount server_var(wcs_team_target)
   if (server_var(wcs_pcount) > 0) do
   {
     es est_Fade server_var(wcs_userid) 0 1 1 10 55 5 200
     es_xset wcs_wall "1"
     alias wcs_run_ulti_roots1 "es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid);es_getplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es_xmath wcs_z1 + 50;es_xmath wcs_z2 + 50;es est_getwallbetween wcs_wall server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2);if (server_var(wcs_wall) = 0) then wcs_run_ulti_roots2"
     alias wcs_run_ulti_roots2 "es_xset wcs_immunity 0;es_keygetvalue wcs_immunity WCSuserdata server_var(wcs_targetid) ulti_immunity;if (server_var(wcs_immunity) = 0) then wcs_run_ulti_roots3;if (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng_ulti_immunity_a);if (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng_ulti_immunity_v)"
     alias wcs_run_ulti_roots3 "es_xmath wcs_counter + 1;es est_Freeze server_var(wcs_targetid) 1;es_delayed server_var(wcs_freezetime) wcs_removefx freeze server_var(wcs_targetid);if (server_var(wcs_graphicfx) = 1) then est_effect 3 #a 0 sprites/lgtning.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 10 10 0 255 0 255"
     es_xset wcs_counter 0
     es est_Near wcs_targetid server_var(wcs_team_targetn) server_var(wcs_radius) server_var(wcs_userid) "es_exists ex userid server_var(wcs_targetid);if (server_var(ex) = 1) then wcs_run_ulti_roots1"
     if (server_var(wcs_counter) > 0) do
     {
       wcs_getlanguage "wcs_lng" "wcs_lng_entangleroots"
       esnq est_csay server_var(wcs_userid) server_var(wcs_lng) : server_var(wcs_counter)
     }
     es_xelse do
     {
       es_xset wcs_ultinotexec 1
     }
   }
   es_xelse do
   {
     es_xset wcs_ultinotexec 1
   }
 }
 wcs_getlanguage "wcs_lng" "wcs_lng_entanglefailed"
 if (server_var(wcs_ultinotexec) = 1) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng)
wcs_debuglog wcs_ulti_roots end
}

The two races I'm trying to use it with are Night Elves and Keeper of the Grove.  I already have a block of code in another basic script (warcraftsound) I wrote last night...
keeperroots
Code
GeSHi (eventscripts):
es est_playplayer server_var(wcs_userid) wcs/wc3/KeeperoftheGrove/KeeperRootsSource.mp3
es est_playplayer server_var(wcs_targetid) wcs/wc3/KeeperoftheGrove/KeeperRootsTarget.mp3
 

and nightelvesroots
Code
GeSHi (eventscripts):
es est_playplayer server_var(wcs_userid) wcs/wc3/NightElves/NightElvesRootsStart.mp3
es_delayed 5 est_playplayer server_var(wcs_userid) wcs/wc3/NightElves/NightElvesRootsEnd.mp3
 

So my main question is how I would get each sound to play depending on the race being used.  I'm also not positive all the user variables are correct (Keeper has a source & target, Nighte Elves just has the source).  I'd like to be able to have the delay for Night Elves' roots equal to the time that's set in the skill setting, but I'm not sure how to do that.
Logged

Yiyas
Level 7 Expert
*****
Offline Offline

United Kingdom

Posts: 197


The name's Bugger. De-Bugger.



no1yiyas
no1yiyas
« Reply #6 on: November 11, 2009, 01:39:01 AM »

Well if you check the race of the player this will return the # of the race as stated in the es_wcsraces.txt file and then depending on the race# tell it what to do.
aka
---
Code:
es_keygetvalue wcs_race WCSuserdata server_var(wcs_userid) race
es_keygetvalue wcs_name WCSraces server_var(wcs_race) name
// this would return its name if you actually want that but can easily cause some bugs.
if (server_var(wcs_race) = 5) do
  {
  es est_playplayer server_var(wcs_userid) wcs/wc3/KeeperoftheGrove/KeeperRootsSource.mp3
  }
---
where in racefile it'd be
---
Code:
"5"
{
"Name" "Keeper of the Grove"
etc
}
---
This can also be used on stuff like chain lightning where you want different races to have different effects.

The duration of the freeze wcs_freezetime and to make the most out of this I would convert
---
Code:
      alias wcs_run_ulti_roots1 "es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid);es_getplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es_xmath wcs_z1 + 50;es_xmath wcs_z2 + 50;es est_getwallbetween wcs_wall server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2);if (server_var(wcs_wall) = 0) then wcs_run_ulti_roots2"
      alias wcs_run_ulti_roots2 "es_xset wcs_immunity 0;es_keygetvalue wcs_immunity WCSuserdata server_var(wcs_targetid) ulti_immunity;if (server_var(wcs_immunity) = 0) then wcs_run_ulti_roots3;if (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng_ulti_immunity_a);if (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng_ulti_immunity_v)"
      alias wcs_run_ulti_roots3 "es_xmath wcs_counter + 1;es est_Freeze server_var(wcs_targetid) 1;es_delayed server_var(wcs_freezetime) wcs_removefx freeze server_var(wcs_targetid);if (server_var(wcs_graphicfx) = 1) then est_effect 3 #a 0 sprites/lgtning.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 10 10 0 255 0 255"
---
into a block, which is not only faster, but also easier to edit. This way you could add in the "es est_playplayer server_var(wcs_targetid) wcs/wc3/KeeperoftheGrove/KeeperRootsTarget.mp3" into that block alone, so on each player the sound is played.

If you want to try that yourself go ahead but I have already done that and added in your keeper of the grove stuff too:
---
Code:
block wcs_ulti_entangle
{
es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid)
es_getplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid)
es_xmath wcs_z1 + 50
es_xmath wcs_z2 + 50
es_xset wcs_wall 1
es est_getwallbetween wcs_wall server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2)
ifx false(wcs_wall) do
  {
  es_xset wcs_immunity 0
  es_keygetvalue wcs_immunity WCSuserdata server_var(wcs_targetid) ulti_immunity
  ifx false(wcs_immunity) do
    {
    es_xmath wcs_counter + 1
    es est_Freeze server_var(wcs_targetid) 1
    es_delayed server_var(wcs_freezetime) est_freeze server_var(wcs_targetid) 0
    es est_effect 3 #a 0 sprites/lgtning.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 10 10 0 255 0 255"
// custom race commands, no need to get wcs_race again as it is gathered in previous block
    // keeper of the grove sounds
    ifx parse("wcs_race == 5") do
      {
      es est_playplayer server_var(wcs_targetid) wcs/wc3/KeeperoftheGrove/KeeperRootsTarget.mp3
      }
    }
  es_xelse do
    {
    es_tell server_var(wcs_userid) #multi server_var(wcs_lng_ulti_immunity_a)
    es_tell server_var(wcs_targetid) #multi server_var(wcs_lng_ulti_immunity_v)"
    }
  }
}
---

How to make it communicate with the block? just change
---
Code:
es est_Near wcs_targetid server_var(wcs_team_targetn) server_var(wcs_radius) server_var(wcs_userid) "es_exists ex userid server_var(wcs_targetid);if (server_var(ex) = 1) then wcs_run_ulti_roots1"
---
to
---
Code:
es est_Near wcs_targetid server_var(wcs_team_targetn) server_var(wcs_radius) server_var(wcs_userid) "es_exists ex userid server_var(wcs_targetid);if (server_var(ex) = 1) then es_xdoblock wcs/wcsultimates/wcs_ulti_entangle"
---
where you name the block containing all the stuff as "wcs_ulti_entangle"

I wouldn't reccomend doing it by name as you can alter the name and forget and break a lot of things while the # of the race is unlikely to ever change. And sorry that it looks like a lot of work but its just editing three things really Tongue
« Last Edit: November 11, 2009, 12:41:40 PM by Yiyas » Logged

Volunterrors
Level 2 Apprentice
**
Offline Offline

United States United States

Posts: 56



WWW

myServer 8.12.71.26:27015
(Warning: click connects through Steam)
« Reply #7 on: November 11, 2009, 04:51:25 PM »

The best thing to do is just make a new roots block. Change the name and make the changes you want no checking for the race number or anything.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Last 7 Shouts:
Today at 06:29:35 PM
nahh, i only get F...
and i'm gonna change the language Smiley
Today at 05:43:28 PM
how am I owned if I didn't mention how many people I have killed, I am not going to talk about that...
Today at 05:22:17 PM
I could help you with german xD
Today at 05:21:55 PM
Hehe
Today at 12:23:29 PM
Draw class atm...
then i'm gonna have german
Today at 12:23:16 PM
I'm still at school and it still sucks ass !
Today at 12:21:40 PM
haha. -.-
Recent
[Today at 08:22:44 PM]

[Today at 08:02:51 PM]

[Today at 06:38:57 PM]

[Today at 06:24:46 PM]

[Today at 06:18:00 PM]

[Today at 05:34:59 PM]

[Today at 05:31:45 PM]

[Today at 05:28:28 PM]

[Today at 04:13:49 PM]

[Today at 03:03:24 PM]
Theme switch

Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.373 seconds with 22 queries.