HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I'm trying to put a size modification and a tint

08-13-2006, 09:13 PM#1
Lord_of_heaven
How can i put a size modification by trigger in-game Ex:someone writes size 50 and puts the selected unit size to 50?



How can i put a tint modification by trigger in-game Ex:someone writes tint
###/###/###/###
RED/GREEN/BLUE/TRANSPARENCY and takes the written color?



Sorry guy for disturbing you like this
08-13-2006, 10:07 PM#2
The)TideHunter(
The size is ok, but the colour is ALOT harder just in 1 string.
Because you have to find where the /'s are to get to the next part.
Knowing that you CAN do the size part by your self, because somebody showed you chat strings before, just change the action to Animation - Size or something.

As for the /'s, im making a lil system which will do that now.
Give me 10 mins or so.
Btw, this will be in Jass, i doubt their is any other way without using GUI loops...

EDIT: Ok, im back, im not sure if this is gonna work, but i think it will.
Heres the code:

Collapse JASS:
function ChangeUnitColourRGBAString takes unit whichUnit, string Source returns nothing
    local integer FirstSlash
    local integer SecondSlash
    local integer ThirdSlash
    local integer i=1
    local integer Red
    local integer Green
    local integer Blue
    local integer Alpha
    local string C = Source
    loop
        exitwhen i==StringLength(C)
        if(SubString(C, i-1, i) == "/") then
            set FirstSlash = i
        endif
        set i = i + 1
    endloop
    set C = SubString(C, FirstSlash+1, StringLength(C))
    set i = 1
    loop
        exitwhen i==StringLength(C)
        if(SubString(C, i-1, i) == "/") then
            set SecondSlash = i
        endif
        set i = i + 1
    endloop
    set C = SubString(C, SecondSlash+1, StringLength(C))
    set i = 1
    loop
        exitwhen i==StringLength(C)
        if(SubString(C, i-1, i) == "/") then
            set ThirdSlash = i
        endif
        set i = i + 1
    endloop
    set Red = S2I(SubString(Source, 0, FirstSlash))
    set Green = S2I(SubString(Source, FirstSlash+1, SecondSlash))
    set Blue = S2I(SubString(Source, SecondSlash+1, ThirdSlash))
    set Alpha = S2I(SubString(Source, ThirdSlash+1, StringLength(Source)))
    call SetUnitVertexColor(whichUnit, Red, Green, Blue, Alpha)
endfunction 

All you have to do is use that function, but dont put anything like "colour 50/20/12/40" into it.
Only put the numbers, dont include the "colour ".
If it dosent work, post in the thread and il try to fix it.

EDIT2: Their was a syntax error, i'v changed it now, i added a S2I().
EDIT3: Forgot to reset i to 1 after finding a slash.
08-13-2006, 10:50 PM#3
Lord_of_heaven
Dude what u want i write in it only like 100/150/200 ???


If yes it doesn't work :(

Plz answer the fastest possible :)
08-15-2006, 01:20 AM#4
Vexorian
patience
08-15-2006, 01:49 AM#5
TaintedReality
Don't see any need for JASS, considering that he won't understand it. Here you go, you must use 3 digits in every value even if it isn't a 3 digit number (025,000,003,etc).

Trigger:
LOLOL COLOR
Collapse Events
Player - Player 1 (Red) types a chat message containing / as A substring
Player - Player 2 (Blue) types a chat message containing / as A substring
Player - Player 3 (Teal) types a chat message containing / as A substring
Player - Player 4 (Purple) types a chat message containing / as A substring
Player - Player 5 (Yellow) types a chat message containing / as A substring
Player - Player 6 (Orange) types a chat message containing / as A substring
Player - Player 7 (Green) types a chat message containing / as A substring
Player - Player 8 (Pink) types a chat message containing / as A substring
Player - Player 9 (Gray) types a chat message containing / as A substring
Player - Player 10 (Light Blue) types a chat message containing / as A substring
Player - Player 11 (Dark Green) types a chat message containing / as A substring
Player - Player 12 (Brown) types a chat message containing / as A substring
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is selected by (Triggering player)) Equal to True)) and do (Actions)
Collapse Loop - Actions
Animation - Change (Picked unit)'s vertex coloring to (((100.00 / 255.00) x (Real((Substring((Entered chat string), 1, 3)))))%, ((100.00 / 255.00) x (Real((Substring((Entered chat string), 5, 7)))))%, ((100.00 / 255.00) x (Real((Substring((Entered chat string), 9, 11)))))%) with ((100.00 / 255.00) x (Real((Substring((Entered chat string), 13, 15)))))% transparency

Edit: Oh and it's not in percentages, it's out of 255. You can change that if you want.
08-15-2006, 05:24 AM#6
Lord_of_heaven
Ok ty wery much
08-15-2006, 10:22 AM#7
The)TideHunter(
The reason i used Jass, is because you dident need to use 3 digits.
I dont like maps like that, sorry.
Its a easier work around, but can save the map player trouble and confusion.