Page 1 of 2

help increase points skill

Posted: Fri Sep 24, 2010 6:39 am
by Squall
i saw in a game, somthing at heros a book whit skills , if you press it is show skills. I want to know how to put that book, but more important, i want to put in that book some skills named, Strenght, Intelligence and Agility. If you choose one time one of those skills, Exemple Strenght it increase strenght by 1.
And at every level up you can choose 5 times the skills from the book. Like in this game: http://www.epicwar.com/maps/135667/
Please help me. Thank you.

Re: help increase points skill

Posted: Fri Sep 24, 2010 6:49 am
by Siraraz
With no idea what you are talking about (since you posted in not-the-best way), I'm going to assume you mean something similiar to the Hero Skills Tab ("O" being the hotkey?), and when clicked, you can upgrade stats.

That's probably a spellbook, with the abilities inside the spellbook being dummy abilities that raise your stat upon cast (and deduct a certain resource).

Re: help increase points skill

Posted: Fri Sep 24, 2010 7:51 am
by 3ICE
Siraraz is right, that's a spell book with the icon changed to the red "+" of the Hero Abilities button.

You will need:
An integer array, lets call it PlayerPoints.
Three spells inside the spellbook: Str, Agi, Int. You can use any spells for this, just make sure they have no cooldown, no cast time, no targeting mechanism, and no mana cost. You also have to use three different spells because of a bug in wc3.
A trigger that has the event: Any unit begins casting a spell.
And conditions: Casting unit is a hero (just for safety) and PlayerPoints[Player number of(Triggering Player)] > 0
Three if/then/else blocks, checking if the Spell being case equals to those three dummy spells.
Depending on which spell was cast, add +1 to that stat of Casting Unit and take one off from PlayerPoints[Player number of(Triggering Player)]

And of course you will need to increment PlayerPoints[Player number of(Triggering Player)] by 5 every time a hero levels up.

Re: help increase points skill

Posted: Fri Sep 24, 2010 9:27 am
by Squall
i didnt found "begins casting a spell" only "begins casting a ability" and what condition is that "PlayerPoints[Player number of(Triggering Player)] > 0"
how much Size should PlayerPoints have and what Variable Type?
Sorry if my questions looks like im a "noob".

Re: help increase points skill

Posted: Fri Sep 24, 2010 9:37 am
by 3ICE
spell/ability: same thing.
PlayerPoints is increased by 5 every time your hero levels up. Doesn't that explain everything? You decrement it by 1 every time a player clicks the Str/Agi/Int buttons. It is a counter, to keep track of how many points a player can spend on +1ing his hero.
Array size does not matter, leave it at zero. Once you switch to StarCraft 2, array sizes will start to matter, but in wc3 arrays expand automatically so one less thing to worry about :)
About the variable type, I already said it should be an integer. It means "whole number" or something like that. Basically a counter that goes:
0->(wait for level up)->5->4->3->2->1->0->(wait for level up) and so on.

Re: help increase points skill

Posted: Fri Sep 24, 2010 10:16 am
by Squall
"and take one off from PlayerPoints[Player number of(Triggering Player)]", how should i do this? i mean in If, Then,else?
I make one like this:
t_if If ((Ability being cast) Equal to Strenght ) then do (Hero - Modify Strength of (Triggering unit): Add 1) else do nothing

what should i put at else to descrease one point from PlayerPoints?

Re: help increase points skill

Posted: Fri Sep 24, 2010 10:18 am
by 3ICE
You don't have TFT? Oh my, that's going to make it harder.
EDIT: If (PlayerPoints[Player number of(Triggering Player)]>0 ) then do set PlayerPoints[Player number of(Triggering Player)] = PlayerPoints[Player number of(Triggering Player)]-1 else do nothing
EDIT2: Add that at the end of your trigger.

Re: help increase points skill

Posted: Fri Sep 24, 2010 10:20 am
by Squall
i do have TFT

Re: help increase points skill

Posted: Fri Sep 24, 2010 10:28 am
by 3ICE
Then use the new way of doing if/then/else! The old way is terrible. :evil:

Re: help increase points skill

Posted: Fri Sep 24, 2010 10:32 am
by Squall
what do you mean the new way?