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-10-20 (original capture). Home · Forum · All archived topics · Downloads
Warcraft-Source.com - WCS mod for CSS
October 20, 2009, 08:04:42 PM *
Welcome, Guest. Please login or register.
Login with username, password and session length
News: WCS Tournament being opened for applications!

Post here for signups!
Google  
  Home   Forum   Help Search Login Register   *
Pages: [1] 2   Go Down
  Print  
This topic has not yet been rated! You have not rated this topic. Select a rating:
Author Topic: weapon_fire  (Read 142 times)
Crazy
Level 3 Trained Apprentice
***
Offline Offline

United States United States

Posts: 64



« on: October 12, 2009, 11:58:51 PM »

Well recently I've been trying to make a skill that when a user swings his knife, he gains a certain amount of speed for a certain amount of time. This is what I have for the skill, I just don't know how to get it to work...
.

I have this coding in for the skill.

Code
GeSHi (eventscripts):
   "skill2_setting"     "0"
   "skill2_cmd"         "es es_xkeysetvalue WCSuserdata server_var(wcs_userid) knifeshit 1"
   "skill2_sfx"         "0"
This is what is in es_wcs.txt


Code:
event weapon_fire
{
es es_xkeygetvalue knifeshit WCSuserdata event_var(userid) knifeshit
if (server_var(knifeshit) = 1) do
{
if (event_var(weapon) = knife) do
{
es est_speed event_var(userID) 2.1
es_delayed 3 es est_speed event_var(userID) 1.65
}
}
}
Code
GeSHi (eventscripts):
And this is what is in player_spawn_cmd
 
 
   "preloadcmd" es_xdoblock corelib/noisy_on"
I dont see any mistakes. I'm so lost. =-(
Logged
CA AvasT
Level 7 Expert
*****
Offline Offline

Brazil Brazil

Posts: 423




doug_tiozao
« Reply #1 on: October 13, 2009, 02:40:31 AM »

well you're not getting a  value from something so remove the es key bla bla
remove corelib
in cmd for skills that uses blocks use es_xdoblock nameofyourfolder/es_yourscript
...
Block

Code:
event weapon_fire
{
if (event_var(weapon) = knife) do
    {
    es est_speed event_var(userid) your speed
    es es_xdelayed 3 est_speed event_var(userid) 1.0
    }
}

Skill
(test first) im not sure if it will work because im not at home and im at my notebook in a car travelling... If you use this skill use in player_spawn_cmd
es_xset knife_swing 0
Code:
"skillx_setting"          "es_xset knife_swing CHANCE"
"skillx_cmd"          "if (server_var(knife_swing)) = server_var(chance)) then es_xdoblock scriptfolder/es_yourscript"
"skillx_sfx"            "0"

Skill without need to test the skill
 
Code:
"skillx_setting"          "es_xset wcs_chance CHANCE"
"skillx_cmd"          "]es_xdoblock scriptfolder/es_yourscript"
"skillx_sfx"            "0"
         
   
Logged

[Oddity]TeacherCreature
Moderator
Level 7 Expert
*****
Offline Offline

United States United States

Posts: 1351



WWW
bonggged

myServer 72.5.102.44:27015
(Warning: click connects through Steam)
« Reply #2 on: October 13, 2009, 03:31:22 AM »

Avast I think his way is better he just messed up in the spawn command by using wcs_userid as a server var instead of event_var(userid)

I would do something like this:

This is the command part  player_spawn  your problem is you used wcs_userid instead of event_var(userid)

Code:
"skillx_setting"      "es_xrand wcs_random 1 5|es_xrand wcs_random 1 4|es_xrand wcs_random 1 3|es_xrand wcs_random 1 2"
"skillx_cmd"          "es es_xif (server_var(wcs_random) <= 2) then es_xkeysetvalue WCSuserdata event_var(userid) knifespeed 1"
"skillx_sfx"          "es es_xif (server_var(wcs_random) <= 2) then es_xtell event_var(userid) KNIFE SPEED ACTIVE"

Then in es_wcs.txt add this line to player_spawn otherwise after switchin races it will still work

Code:
event player_spawn
{
  es_xkeysetvalue WCSuserdata event_var(userid) knifespeed 0
}
and further down in the weapon_fire block

Code:
event weapon_fire
{
  if (event_var(weapon) = knife) do
  {
    es es_xkeygetvalue wcs_knifespeed WCSuserdata event_var(userid) knifespeed
    if (server_var(wcs_knifespeed) = 1) do
    {
      es playerset speedadd event_var(userid) 0.5
      es es_xkeysetvalue WCSuserdata event_var(userid) knifespeed 0
      es_delayed 3 playerset speedadd event_var(userid) -0.5
      es_delayed 3.3 es_xkeysetvalue WCSuserdata event_var(userid) knifespeed 1
    }
  }
}
« Last Edit: October 13, 2009, 04:07:28 AM by [Oddity]TeacherCreature » Logged

CA AvasT
Level 7 Expert
*****
Offline Offline

Brazil Brazil

Posts: 423




doug_tiozao
« Reply #3 on: October 13, 2009, 04:03:46 AM »

Heeey AvasT!!!
Fatalityyyy
Humilhatioon
Pwneeeed
Owneeed
PWZOOOR
MOOOOOOSter killed
by Oddity Freeway Driver Teacher Creature
Logged

[Oddity]TeacherCreature
Moderator
Level 7 Expert
*****
Offline Offline

United States United States

Posts: 1351



WWW
bonggged

myServer 72.5.102.44:27015
(Warning: click connects through Steam)
« Reply #4 on: October 13, 2009, 04:05:56 AM »

lol
Logged

Crazy
Level 3 Trained Apprentice
***
Offline Offline

United States United States

Posts: 64



« Reply #5 on: October 15, 2009, 12:07:39 AM »

I tried your block teachercreature and it didn't work. I think it might have something to do with the fact that you used wcs_knifespeed when you were getting the keyvalue. I'm not sure.... Is it supposed to be like that? Or is it a mistake? I hate keyvalues. -_-

Code
GeSHi (eventscripts):
event weapon_fire
{
 if (event_var(weapon) = knife) do
 {
   es_keygetvalue wcs_knifespeed WCSuserdata event_var(userid) knifespeed
   if (server_var(wcs_knifespeed) = 1) do
   {
     es est_speed event_var(userID) 2.1
     es es_xkeysetvalue WCSuserdata event_var(userid) knifespeed 0
     es_delayed 6 es est_speed event_var(userID) 1.4
     es_delayed 6.3 es_xkeysetvalue WCSuserdata event_var(userid) knifespeed 1
   }
 }
}
Logged
DisturbeD
Level 3 Trained Apprentice
***
Online Online

Germany Germany

Posts: 61



« Reply #6 on: October 15, 2009, 12:33:09 AM »

wcs_knifespeed is just a variable... u gotta declare it before you use it..
Logged
Abyss
Level 0 Beginner

Online Online

United States United States

Posts: 10


Protector


« Reply #7 on: October 15, 2009, 01:32:05 AM »

add es_xset wcs_knifespeed 0
Logged
DisturbeD
Level 3 Trained Apprentice
***
Online Online

Germany Germany

Posts: 61



« Reply #8 on: October 15, 2009, 02:58:15 AM »

guess what I meant with "declaration"
Logged
Abyss
Level 0 Beginner

Online Online

United States United States

Posts: 10


Protector


« Reply #9 on: October 15, 2009, 05:55:08 AM »

guess what I meant with "declaration"

You think Crazy knows that?  I understood you, however, he may not have known what to do.  Therefore, I gave the line to add...  Understand?
Logged
Crazy
Level 3 Trained Apprentice
***
Offline Offline

United States United States

Posts: 64



« Reply #10 on: October 15, 2009, 11:20:50 PM »

Lol, this is something I've never actually known about keysetvalues. Why exactly do I need to declare it? Btw, thanks for all the help you guys are providing.
Logged
Crazy
Level 3 Trained Apprentice
***
Offline Offline

United States United States

Posts: 64



« Reply #11 on: October 16, 2009, 02:16:10 AM »

Btw, I got it to work with that tidbit of the "declaration". Thanks guys. Explain to me though when I need to declare something.
Logged
Yiyas
Level 7 Expert
*****
Offline Offline

United Kingdom

Posts: 183


The name's Bugger. De-Bugger.



no1yiyas
no1yiyas
« Reply #12 on: October 16, 2009, 08:59:06 AM »

Well say if you bought 3 buckets, bucket_a bucket_b and bucket_c. You can fill those with water right? So you tell someone to go fill bucket_a with water then a while later you ask them to give you bucket_a and it's still filled with water (hopefully). So you've retrived what you wanted to store, which is the measure of water or a variable in the case of ESS.

So what if you told someone to go fill bucket_d? Oh shit you don't have a bucket_d so how could you possibly fill it? What happens when you then ask someone to bring you bucket_d full of water? You wont get anything, they'll just say no bucket_d sir, can't fill it up. This is seen in the console with "variable not set". Imaginary buckets just don't hold water, as do non existing variables in ESS.

So you do keygetvalue with variable omgnewvariable. Wont work. You have to "buy" the new "bucket" to hold the variable by having "es_xset omgnewvariable 0" somewhere before that line is triggered. The es_xset 0 creates the variable, allowing it to store variables. This es_xset 0 can be in preload_cmd or in block load of es_wcs or even just right before you do es_keygetvalue. Of course there are loads of pre-bought "buckets" which you can use such as wcs_tmp wcs_tmp1 wcs_health wcs_divider wcs_alpha ect ect.

Hopefully thinking of it in that way makes sense Smiley
Logged

DisturbeD
Level 3 Trained Apprentice
***
Online Online

Germany Germany

Posts: 61



« Reply #13 on: October 16, 2009, 12:42:45 PM »

But in terms of optimizing your code, so your server doesn lag, I wouldn declare too many variables.. Use 1 variable for many races like wcs_tmp, if you are sure that there will be no conflict among different functions which all wanna use the variable.. got it?
Logged
Yiyas
Level 7 Expert
*****
Offline Offline

United Kingdom

Posts: 183


The name's Bugger. De-Bugger.



no1yiyas
no1yiyas
« Reply #14 on: October 16, 2009, 02:48:50 PM »

Well if you set the variables on server start it really causes no lag at all. Despite it causing almost no lag at all to begin with. Takes about 3 milliseconds to set a variable and a tenth of that to change one. Considering a couple hundred are set when WCS is loaded, it really amounts to nothing.
« Last Edit: October 16, 2009, 02:56:44 PM by Yiyas » Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Last 7 Shouts:
Today at 06:57:29 PM
yeah, more then once O.o
Today at 06:53:12 PM
Ok, any body...
Put your finger up your ass.
When your finger is up your ass, read this under...







Lol, did you do it ?
Today at 06:53:01 PM
Ok, any body...
Put your finger up your ass.
When your finger is up your ass, read this under...




Lol, did you do it ?
Today at 06:16:27 PM
Ehmm can anyone tell how i download this race pack
http://warcraft-source.com/board/index.php/topic,7702.0.html
Today at 05:06:34 PM
Congrats Chuck !
Today at 05:00:20 PM
Today is my Birthday....turn 19
Today at 02:39:45 AM
Or my xfire :loganmcfarland
Recent
[Today at 08:03:33 PM]

[Today at 08:02:27 PM]

[Today at 08:00:09 PM]

[Today at 07:56:39 PM]

[Today at 07:49:58 PM]

[Today at 07:28:30 PM]

[Today at 06:51:00 PM]

[Today at 06:31:53 PM]

[Today at 06:15:33 PM]

[Today at 06:14:51 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.162 seconds with 24 queries.