HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Strange variable multiplication....

01-31-2003, 03:21 AM#1
FyreDaug
When 1 unit kills 1 unit - the proper 2 EXP is added, but if X units kills 1 unit then it adds 2X exp (So if 2 units kills it, is would add 4 exp) Why is this? Ill type up my code.

EVENT:
Unit owned by p12 dies
COND:
none
ACTIONS:
Unit group - pick every unit in (units within 512 of (position of (dying unit)) and do (If ((Owner of (Picked unit)) Equal to Player 1 (red)) then do (Set currentHeroEXP[1] = (CurrentHeroEXP[1] + 2)) Else do (Do nothing)

After that it just refreshed the leaderboard of the exact value of CurrentHeroEXP[1] for player 1.

I don't understand why having more than 1 unit killing it would times it by X units. I've tried setting the variable just after this to:
value = value / units in 512 of dying unit
but then it doesnt add anything.

(Note this is a custom leaderboard EXP system, so dont tell me about hero values)

If this is somehow unfixable, then please tell me a workaround, or something......
(Also, I havent done this yet but this trigger should be active for the other players aswell, just have to change a few variable array values thats all.)
Please help (Sorry about spleling errors, I'm really tired and im going to bed now)
01-31-2003, 03:30 AM#2
DaKaN
if your trying to create a new custom exp system

http://www.wc3campaigns.com/forums/s...threadid=10782

check that out
01-31-2003, 03:39 AM#3
Mr.123
I should be sleeping but I'm here for some reason...

Anyway, walking through your trigger as you have it typed out here, I get these results:

CurrentHeroEXP[1] = 0 to begin.

2 units (Unit A and B both owned by player 1) kill a unit owned by player 12. Both are within the radius specified.

Unit A gets picked first. Conditions check out, add 2 to CurrentHeroEXP[1]. Now we have CurrentHeroEXP[1] = 2.

Unit B gets picked next. Conditions check out, add 2 to CurrentHeroEXP[1]. Now we have CurrentHeroEXP[1] = 4.


Not sure where and what values you were dividing so don't know where that went wrong. Anyway, it's not unfixable just too sleepy to come up with something elegant :).
01-31-2003, 10:55 AM#4
AIAndy
Instead of adding the experience directly, set a boolean to true and then check if the boolean is true afterwards and only then add the experience.
01-31-2003, 02:54 PM#5
FyreDaug
Good Idea andy... ill try it
01-31-2003, 03:03 PM#6
FyreDaug
Thank you.
01-31-2003, 04:15 PM#7
DoctorDoom
Perhaps I'm missing something here since I don't have my editor here at school. But I'm pretty shure there is a way to determine who killed the unit. Something like if the owner of the killing unit owned by player 1 then add 2 to experiance. Not shure exactly what the action is called but I'll check when I get home unless someone wants to check now.
01-31-2003, 07:53 PM#8
Jeltz
Use the condition.

(player 1) Equal to owner of (killing unit)
01-31-2003, 08:49 PM#9
FyreDaug
No its a 11 player map, so everyone needs to get exp in the 512 radius. It works now, that what my thank you was for.