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 2008-12-05 (original capture). Home · Forum · All archived topics · Downloads
Warcraft-Source.com - WCS mod for CSS
December 05, 2008, 08:06:24 AM *
Welcome, Guest. Please login or register.
Login with username, password and session length
News: Hall of Fame
Must Visit it
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: math problem (dont know exactly howto)  (Read 30 times)
maxxi
Level 4 Intermediate
****
Offline Offline

Netherlands Netherlands

Posts: 86



« on: December 03, 2008, 10:41:41 PM »

im just trying to understand the fuction math and how to subtract variables from variables

Code:
block dead
{
es_xset alive 0
es_xset all 0
es_xset dead 0

es_xgetplayercount all
es_xgetlivingplayercount alive

es es_xtell event_var(userid) #multi #green server_var(alive) Players are alive
es es_xtell event_var(userid) #multi #green server_var(all) Players are in the server
     
                es_xcopy dead all
es_math dead - server_var(all)

es es_xtell event_var(userid) #multi #green server_var(dead) Players are dead
}

what did i do wrong here?
« Last Edit: December 03, 2008, 10:56:59 PM by maxxi » Logged
[H.F.M.]Rasmus{Chef}
WCS Supporter
Level 7 Expert
*****
Offline Offline

Denmark Denmark

Posts: 889




Rasmus4J
rasmus4j

myServer 85.190.17.115:27015
(Warning: click connects through Steam)
« Reply #1 on: December 03, 2008, 11:14:46 PM »

first of all, this   
Code
GeSHi (eventscripts):
es_xcopy dead all
es_math dead - server_var(all)
wont give you the amount of dead players, but a negative amount of players. this will give you the amount of dead player:

Code
GeSHi (eventscripts):
es es_xmath all - server_var(alive)
basic maths tells us that to get the amount of apples in a bundle of apples and bananas, we have to remove the bananas (apples being dead players, bananas being living players and the bundle being all players on the server).

what you did was to remove the amount of apples and bananas from the apples, that will give you a negative value

now, the es_xcopy command does this: it copies the value of the first var you mention, to the second var you mention, so infact what you did in the es_xmath command, was to subtract the dead amount of players from the dead amount of players, but im sure that wasnt what you thought you did?

i think you can exclude the es_xcopy command from this "script".

conclusion: try this
Code
GeSHi (eventscripts):
block dead
{
es_xset alive 0
es_xset all 0
es_xset dead 0
 
es_xgetplayercount all
es_xgetlivingplayercount alive
 
es es_xtell event_var(userid) #multi #green server_var(alive) Players are alive
es es_xtell event_var(userid) #multi #green server_var(all) Players are in the server
 
               es es_xmath all - server_var(alive)
 
es es_xtell event_var(userid) #multi #green server_var(all) Players are dead
}

this would be my suggestion, try it out and tell me how it works.

Kind regards
Rasmus

P.S. es_math command aint my favorite, but think it should work though
Logged

maxxi
Level 4 Intermediate
****
Offline Offline

Netherlands Netherlands

Posts: 86



« Reply #2 on: December 03, 2008, 11:23:17 PM »

cut out long crap

P.S. es_math command aint my favorite, but think it should work though

yes im not good at math in coding il give it a try thanks

EDIT:
i see what i missed >.<

Code
GeSHi (eventscripts):
es_xcopy dead all
es_math dead - server_var(all)


this should be

Code
GeSHi (eventscripts):
es_xcopy dead all
es es_math dead - server_var(alive)
« Last Edit: December 03, 2008, 11:30:59 PM by maxxi » Logged
[H.F.M.]Rasmus{Chef}
WCS Supporter
Level 7 Expert
*****
Offline Offline

Denmark Denmark

Posts: 889




Rasmus4J
rasmus4j

myServer 85.190.17.115:27015
(Warning: click connects through Steam)
« Reply #3 on: December 03, 2008, 11:45:38 PM »

haha, no, it shouldnt be last thing you wrote
what you are doing there is to subtract the amount of living players from the amount of dead players

if you want tho show the amount of dead players you have to do as i told:
Code
GeSHi (eventscripts):
es es_xmath all - server_var(alive)

otherwise you will get some wierd values.

and what do you mean by cut out long crap? i was just giving you a thoroughly and understandable explanation and examples.
Logged

maxxi
Level 4 Intermediate
****
Offline Offline

Netherlands Netherlands

Posts: 86



« Reply #4 on: December 04, 2008, 12:02:42 AM »

haha, no, it shouldnt be last thing you wrote
what you are doing there is to subtract the amount of living players from the amount of dead players

if you want tho show the amount of dead players you have to do as i told:
Code
GeSHi (eventscripts):
es es_xmath all - server_var(alive)

otherwise you will get some wierd values.

and what do you mean by cut out long crap? i was just giving you a thoroughly and understandable explanation and examples.

to quote that long text nothing offensive:)
Logged
[H.F.M.]Rasmus{Chef}
WCS Supporter
Level 7 Expert
*****
Offline Offline

Denmark Denmark

Posts: 889




Rasmus4J
rasmus4j

myServer 85.190.17.115:27015
(Warning: click connects through Steam)
« Reply #5 on: December 04, 2008, 12:16:57 AM »

ok,

nevertheless, have you gotten my point?
if not, please tell me where it snaps for you so i can explain it deeper.
Logged

maxxi
Level 4 Intermediate
****
Offline Offline

Netherlands Netherlands

Posts: 86



« Reply #6 on: December 04, 2008, 12:25:04 AM »

ok,

nevertheless, have you gotten my point?
if not, please tell me where it snaps for you so i can explain it deeper.

i get it now thanks
Logged
[H.F.M.]Rasmus{Chef}
WCS Supporter
Level 7 Expert
*****
Offline Offline

Denmark Denmark

Posts: 889




Rasmus4J
rasmus4j

myServer 85.190.17.115:27015
(Warning: click connects through Steam)
« Reply #7 on: December 04, 2008, 12:25:57 AM »

your welcome
Logged

maxxi
Level 4 Intermediate
****
Offline Offline

Netherlands Netherlands

Posts: 86



« Reply #8 on: December 04, 2008, 02:58:26 PM »

i have another question not about math but hey its still a topic :p

Code:
        "racealias_axe"     "es est_Near cyclone_target server_var(team) server_var(wcs_radius) event_var(userid) "es_exists ex userid server_var(cyclone_target);if (server_var(ex) = 1) then racealias_lone""
"racealias_set"     "es_xset cyclone_target 0;es_xset axe 10;es_xset team 0;es_xset count 0;es_xset attackn 0;es_xset victimn 0;es est_getteam team event_var(userid);es_getplayername victimn event_var(userid);es_getplayername attackn event_var(attacker);racealias_axe"
"skill2_cmd"        "if (server_var(wcs_dice) <= server_var(chance)) then racealias_set;if (server_var(wcs_dice) <= server_var(chance)) then racealias_cyc"
"skill2_sfx"        "0"

i wanted to make an attack skill that will dmg players near my target but it wont get the players near target
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Last 7 Shouts:
December 04, 2008, 09:57:56 PM
gg
December 04, 2008, 09:46:16 PM
hey guys, how are you?
gonna sleep, cya tomorrow
December 03, 2008, 12:45:48 PM
@ bombkill : all mods should be compatible with WCS... but we can't be sure
@retrokboy : css server? provider? other mods?
December 03, 2008, 01:49:25 AM
I NEED SERVER HELP MY FORUM IS IN BUG REPORT PLEASE REPLY I NEED HALP
December 02, 2008, 10:05:01 PM
does anyone know where all the wcs compatible mods are listed or a website i can find them
December 02, 2008, 08:24:47 PM
/agree
Recent
[Today at 04:51:59 AM]

[Today at 04:11:23 AM]

[Today at 04:04:32 AM]

[Today at 04:02:29 AM]

[Today at 03:33:23 AM]

[Today at 02:29:40 AM]

[Today at 01:07:24 AM]

[December 04, 2008, 10:55:49 PM]

[December 04, 2008, 10:30:18 PM]

[December 04, 2008, 10:24:35 PM]
Theme switch

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.106 seconds with 28 queries.