HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Adding Abilities and Creating Items

07-30-2005, 03:19 AM#1
Pheonix-IV
Alrighty, basically i need to know if this is possible, and how. What i want to happen is the player can type:

item ITEMNAMEHERE and it will create whatever ITEMNAMEHERE is below a certain unit. I need a similar thing for abilities:

spell SPELLNAMEHERE i want to add SPELLNAMEHERE is to the picked unit\s. So far i have a spawn trigger that works as follows:

spawn ## UNITNAME with ## being a number between 01 to 12 and UNITNAME being the name of a unit (Ex: highelfarcher) is it possible to make this system?
07-30-2005, 10:33 AM#2
Anitarf
It's possible.

...

I get a feeling you want to know something more than just that... what is it?
07-30-2005, 10:39 AM#3
Pheonix-IV
Aye, how do i do it :P
07-30-2005, 12:15 PM#4
EdwardSwolenToe
Have a function like this:

Quote:
function msg2ability takes string msg returns integer
if( msg == "Chain Lightning")then
return 'A001' // The "chain lightining" ability
elseif(msg == "blizzard")then
return 'A002'
endif
return null
endfunction

damn no code tags -.-
07-31-2005, 12:24 AM#5
Pheonix-IV
Ugh, do i really have to make an If\Then\Else for every ability? I was hoping i could convert a substring into an ability the same way i do with units. Spawn unit trigger below -

Quote:
Spawn Copy
Events
Player - Player 1 (Red) types a chat message containing spawn as A substring
Player - Player 2 (Blue) types a chat message containing spawn as A substring
Player - Player 3 (Teal) types a chat message containing spawn as A substring
Player - Player 4 (Purple) types a chat message containing spawn as A substring
Player - Player 5 (Yellow) types a chat message containing spawn as A substring
Player - Player 6 (Orange) types a chat message containing spawn as A substring
Player - Player 7 (Green) types a chat message containing spawn as A substring
Player - Player 8 (Pink) types a chat message containing spawn as A substring
Player - Player 9 (Gray) types a chat message containing spawn as A substring
Player - Player 10 (Light Blue) types a chat message containing spawn as A substring
Player - Player 11 (Dark Green) types a chat message containing spawn as A substring
Player - Player 12 (Brown) types a chat message containing spawn as A substring
Conditions
(Substring((Entered chat string), 1, 6)) Equal to spawn
(Substring((Entered chat string), 7, 7)) Not equal to
(Substring((Entered chat string), 8, 8)) Not equal to
(Integer((Substring((Entered chat string), 7, 8)))) Less than or equal to MaxSpawn
(Substring((Entered chat string), 9, 9)) Equal to
Actions
If ((Substring((String((Entered chat string)) as Lower case), 10, 16)) Equal to custom_) then do (Skip remaining actions) else do (Do nothing)
Unit - Create (Integer((Substring((Entered chat string), 7, 8)))) (Unit-type((Substring((Entered chat string), 10, (Length of (Entered chat string)))))) for (Triggering player) at (Position of Spawner[(Player number of (Triggering player))]) facing Default building facing (270.0) degrees

Its the last one -

Quote:
Unit - Create (Integer((Substring((Entered chat string), 7, 8)))) (Unit-type((Substring((Entered chat string), 10, (Length of (Entered chat string)))))) for (Triggering player) at (Position of Spawner[(Player number of (Triggering player))]) facing Default building facing (270.0) degrees

That i want to replicate for abilities and items. Is that possible or do i need a whopping great if\then\else trigger or set each ability to a variable (almost as bad)
07-31-2005, 08:16 AM#6
EdwardSwolenToe
I think there is an ability name to string conversion. Try that
07-31-2005, 09:08 AM#7
CyborgDragon
This is for your CotM RP Edit isn't it? Well you could copy the spawn trigger and replace it with ability names and that kinda stuff.
07-31-2005, 09:32 AM#8
Pheonix-IV
Yes it is, however the string conversion trigger for Items and Abilities is one of WEUnlimited's "Advanced" triggers, none of which seem to work (at least none of the ones i've tryed.) I'm hoping theres a JASS solution or something.
08-02-2005, 12:34 AM#9
Pheonix-IV
So can anyone help me?
08-02-2005, 07:59 AM#10
EdwardSwolenToe
Quote:
I'm hoping theres a JASS solution or something.

how about this. Its not that hard and there are no quick solutions.

It will be like:
Event- Player types message as a substring
Action - call AddAbility(msg2ability(GetEnteredString()))

Quote:
Originally Posted by EdwardSwolenToe
Have a function like this:

Quote:
function msg2ability takes string msg returns integer
if( msg == "Chain Lightning")then
return 'A001' // The "chain lightining" ability
elseif(msg == "blizzard")then
return 'A002'
endif
return null
endfunction

damn no code tags -.-