HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Challenge me!!!

11-22-2004, 08:19 PM#1
fugly
well having been in jass for a while im looking for a challange. i Want it to be something that might actually be used in maps. Something like an API thats never been done before. or maybe even a map that needs systems. come on!! challenge me!!
11-23-2004, 11:04 PM#2
-={tWiStÄr}=-
well, lets see here. ooh ooh! i've been thinking about making this for my map, but i dont need it.
Make a FULL copy of another unit. i mean everything down to abilities. if only buffs were possible :(. but yeah. or, create unit with properties.
seconds ones pretty easy though because you can do that anyways. i mean one function like
CreateUnitNew('hfoo', 40, 0, "Ahea - 1, Afla - 2;")
how bout that last part though? add abilities with levels?
ok.. thats all i got.
11-24-2004, 12:15 AM#3
fugly
actually im thinking of taking my skill system in d2 to allow people to have an unlimited amount of spells per char. yes its possible but all the actions of the spell have to be done in jass/triggering.
11-24-2004, 03:24 PM#4
a thing
Make a function that translates English into Snoop Dog or 1337 5P33|<.
11-24-2004, 10:52 PM#5
fugly
ok my first stab at the advacned unit maker, takes a string for unit type, and abilities, so something like "AsloAheal" will give the unit both slow and healing. life and mana are also strings. if you give 100 as a life parameter then the unit wil have 100 life. If you give 100p then the unit will have 100% life. i know its kinda raw but what else should be added?
NOTE: WILL ONLY WORK IF ALL FUNCTIONS ARE IN THE CUSTOM SCRIPT SECTION AND THE TWO FUNCTIONS ABOVE MINE WERE CREATED BY PEPPAR!!

Code:
function AsciiCharToInteger takes string char returns integer
    local string charMap = " !\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
    local string u = SubString(char, 0, 1)
    local string c
    local integer i = 0
    loop
        set c = SubString(charMap, i, i + 1)
        exitwhen c == ""
        if c == u then
            return i + 32
        endif
        set i = i + 1
    endloop
    return 0
endfunction



function IdStringToIdInteger takes string value returns integer
  return AsciiCharToInteger(SubString(value, 0, 1)) * 0x1000000 + AsciiCharToInteger(SubString(value, 1, 2)) * 0x10000 + AsciiCharToInteger(SubString(value, 2, 3)) * 0x100 + AsciiCharToInteger(SubString(value, 3, 4)) 
endfunction 

function makeAdvancedUnit takes player who, string id, location where, real angle, string life, string mana, string abil returns unit
local integer unitid = S2I(id)
local integer spellmnt = StringLength(abil)/4
local unit u = null
local integer i = 0
if unitid == 0 then
 set unitid = IdStringToIdInteger(id)
endif
set u = CreateUnit(who, unitid, GetLocationX(where), GetLocationY(where), angle)
loop
 exitwhen i>=spellmnt
  call UnitAddAbility(u, IdStringToIdInteger(SubString(abil,i*4,(i+1)*4)) )
 set i = i + 1
endloop

if StringCase(SubString(life,StringLength(life)-1,StringLength(life) ),false) == "p" then
  call SetUnitLifePercentBJ(u,S2R(SubString(life,0,StringLength(life)) ))
else
  call SetUnitLifeBJ(u, S2R(life) )
endif
if StringCase(SubString(mana,StringLength(mana)-1,StringLength(mana) ),false) == "p" then
  call SetUnitManaPercentBJ(u,S2R(SubString(mana,0,StringLength(mana)) ))
else
  call SetUnitManaBJ(u, S2R(mana) )
endif

return u
endfunction
11-25-2004, 03:54 AM#6
-={tWiStÄr}=-
pretty nice. just add in an ability level and it will be awesome.
11-26-2004, 03:41 PM#7
fugly
ok same as before but now you NEED to put a number after the ability wich indicates the level, ie.) "Aslo2Aheal1"

Code:
function makeAdvancedUnit takes player who, string id, location where, real angle, string life, string mana, string abil returns unit
local integer unitid = S2I(id)
local integer spellmnt = StringLength(abil)/5
local unit u = null
local integer i = 0
local string spells
if unitid == 0 then
 set unitid = IdStringToIdInteger(id)
endif
set u = CreateUnit(who, unitid, GetLocationX(where), GetLocationY(where), angle)
loop
 exitwhen i>=spellmnt
  set spells = SubString(abil, i*5,(i+1)*5)
  call UnitAddAbility(u, IdStringToIdInteger(SubString(spells,0,4)) )
  call SetUnitAbilityLevel(u,IdStringToIdInteger(SubString(spells,0,4)), S2I(SubString(spells,4,5)) )
 set i = i + 1
endloop

if StringCase(SubString(life,StringLength(life)-1,StringLength(life) ),false) == "p" then
  call SetUnitLifePercentBJ(u,S2R(SubString(life,0,StringLength(life)) ))
else
  call SetUnitLifeBJ(u, S2R(life) )
endif
if StringCase(SubString(mana,StringLength(mana)-1,StringLength(mana) ),false) == "p" then
  call SetUnitManaPercentBJ(u,S2R(SubString(mana,0,StringLength(mana)) ))
else
  call SetUnitManaBJ(u, S2R(mana) )
endif
return u
endfunction