Need to edit this Omnislash

  • Thread starter Thread starter spectre237
  • Start date Start date
Status
Not open for further replies.
S

spectre237

Guest
Ok, see I've got this 'Omnislash' type ability, it's really kewl. Thanks Vex!

Anyway the deal is I need to edit it so that the hero becomes invulnerable for it's duration.

The entire script runs as follows:




PHP:
//**********************************************************************  ***************************** 
//* 
//* Slash Template 
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 
//* Requires: 
//*          -A triggerer ability ( Unit targetable please) 
//*          -The Caster System 
//*          -The Alternative Spell Templates System 
//*          -This Trigger 
//* 
//* Art: The Triggerer ability has art fields that are considered: 
//* - Caster effect is attached twice to the hero during the slash. 
//* - Second and Third Caster Effects are attachment points for the Caster Effect 
//* - Special effect is used on the feet of the hero before teleporting to slash 
//* - Target art is the target effect, or the periodic damage effect if used, and the 
//*   second target effect is its attachment point. 
//* 
//**********************************************************************  ***************************** 

//======================================================================  ============================= 
// Slash Template Configuration: 
// 
function SlashTemplateSetup takes nothing returns nothing 
local integer D //An integer variable we use later to save the Damage Options so we give them to the templates 
local integer s //An integer variable we use later to save the rawcodes of spells to save some time 

//======================================================================  ============================= 
// Template Info: 
// 
// Template Name Id = "SlashTemplate" 
// 
// The hero just gets teleported and attacks the targets fast, it looks nice and allows to cast 
// a spell, do damage, damage per second, and also has options for the way to choose targets and 
// factor for each target and that stuff. 
// 
// 
// integer "totalhits"  The maximum number of hits done per cast 
// real    "dmg"        The initial damage 
// real    "PDmg"       The initial Periodic Damage 
// real    "PDmgPeriod" The period of the Periodic Damage 
// real    "PDmgDur"    The Duration of the periodic Damage 
// 
// real    "dmgfct"     The factor per target for the damage, each time the unit hits a target, 
//                      the damage will be multiplied by this value to get reduced or incremented 
// 
// integer "Spell"      Rawcode of the Spell to cast (if any) 
// real    "SpellHeight" Height of the caster that casts the spell to cast 
// integer "OrderId"    Order Id of that spell 
// real    "RecDelay"   Caster Recycle delay for that spell 
// 
// 
// real    "area"       The new target detection range 
// integer "canrepeat"  Is 1 if the slash can repeat targets, otherwise 0 
// 
// integer "SelMethod"  Is 0 if the slash should pick the closest unit, 1 to pick random units 
// integer "SlashKind"  The kind of the Slash, 0 will try to get to the back of the unit, 1 
//                      will attack in random direction, and 2 is a combination of both 
// 
// integer "AngleKind"  Is 0 for the default angle kind, is 1 to multiple the angle by -1 
// 
// string  "animation"  The animation used by the slash 
// 
// integer "colorize"   If it is 1 enables casting unit "colorizing" 
// integer "SlashColor" Color in 0xAARRGGBB form for the duration of the slash 
// integer "EndColor"   Color in 0xAARRGGBB form after the slash (original color of the hero) 
// 

// integer "DamageOptions" Caster System Damage Options in saveable form, used to determine which 
//                         units can be attacked by the slash, if the damage factor is 0 the unit 
//                         is not affected by the target spells nor damage, otherwise the value 
//                         is only important as a damage factor. 


//======================================================================  ============================= 
// Slash template Defaults: 
// 
    call SetTemplateDefaultInt(   "SlashTemplate", "totalhits", 1) //Default Total Hits is 1 
    call SetTemplateDefaultInt(   "SlashTemplate", "canrepeat", 0) //Can't repeat targets 
    call SetTemplateDefaultReal(  "SlashTemplate", "area", 100)    //Default area is 100 
    call SetTemplateDefaultReal(  "SlashTemplate", "dmg", 150)     //Default initial damage is 150 
    call SetTemplateDefaultReal(  "SlashTemplate", "dmgfct", 1)    //Default damage factor is 1 
    call SetTemplateDefaultString("SlashTemplate", "animation", "attack slam") //Default animation is attack slam 
    call SetTemplateDefaultInt(   "SlashTemplate", "SlashColor", 0xFFFFFFFF)   //Default slash color is 255-255-255-255 
    call SetTemplateDefaultInt(   "SlashTemplate", "EndColor"  , 0xFFFFFFFF)   //Default end color is 255-255-255-255 

//======================================================================  ============================= 
// Cold Slash ('A006') 
// 
set s=SetSpellTemplate('A006',"SlashTemplate") 
set D=0                                                //Cold Slash Options : 
set D=DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_COLD) //Cold spell damage 
set D=DamageOnlyEnemies()                              //Only hurt enemies 
set D=CreateDamageOptions(D)                           //Save the damage options 

    call SetAbilityDataInt( s,"totalhits",1,3) //Level 1: 3 hits 
    call SetAbilityDataInt( s,"totalhits",2,5) //Level 2: 5 hits 
    call SetAbilityDataInt( s,"totalhits",3,7) //Level 3: 7 hits 

    call SetAbilityDataReal(s,"dmg",1,150) //Level 1: 150 damage 
    call SetAbilityDataReal(s,"dmg",2,200) //Level 2: 200 damage 
    call SetAbilityDataReal(s,"dmg",3,250) //Level 3: 250 damage 

    call SetAbilityDataReal(s,"area",1,360) //Level 1: 360 area 
    call SetAbilityDataReal(s,"area",2,370) //Level 2: 370 area 
    call SetAbilityDataReal(s,"area",3,380) //Level 3: 380 area 


    call SetAbilityDataInt( s,"DamageOptions",0,D)   //Using the damage options saved before 

    call SetAbilityDataString(s,"animation",0,"attack slam") //Use attack slam animation 

//======================================================================  ============================= 
// Fire Slash ('A00D') 
// 
set s=SetSpellTemplate('A00D',"SlashTemplate") 
set D=0                                                //Fire Slash Options : 
set D=DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE) //Fire spell damage 
set D=DamageOnlyEnemies()                              //Only hurt enemies 
set D=CreateDamageOptions(D)                           //Save the damage options 

    call SetAbilityDataInt( s,"totalhits",0,5) //5 Hits 

    call SetAbilityDataReal(s,"dmg",1,200) //Level 1: 200 damage 
    call SetAbilityDataReal(s,"dmg",2,270) //Level 2: 270 damage 
    call SetAbilityDataReal(s,"dmg",3,340) //Level 3: 340 damage 

    call SetAbilityDataReal(s,"area",0,500) //Always 500 of area 

    call SetAbilityDataInt( s,"SlashKind",0,2)   //Slash Kind is 2 
    call SetAbilityDataInt( s,"canrepeat",0,1)   //It can repeat targets! 

    call SetAbilityDataReal(s,"dmgfct",0,0.75) //Will lose 25% of the damage per target 

    call SetAbilityDataString(s,"animation",0,"attack") //Use attack animation 

    call SetAbilityDataInt( s,"DamageOptions",0,D)   //Using the damage options saved before 


endfunction 

//======================================================================  ============================= 
function SlashTemplate_DoSpell takes player ow, unit t, integer s, integer l returns nothing 
local integer ab=GetAbilityDataInt(s,l,"Spell") 

    if (ab!=0) then 
        call CasterCastAbilityEx(ow,GetUnitX(t),GetUnitY(t),GetAbilityDataReal(s,l,  "SpellHeight"),ab,l,I2S(GetAbilityDataInt(s,l,"OrderId") ),t,GetAbilityDataReal(s,l,"RecDelay") ) 
    endif 
endfunction 
     

function SlashTemplate_Colorize takes unit u, integer rgb returns nothing 
local integer Y=rgb+IntegerTertiaryOp(rgb<0,0x80000000,0) 
local integer Z 
local integer r 
local integer g 
local integer b 

    set Z=Y/0x100 
    set b=Y-(Z*0x100) 
    set Y=Z/0x100 
    set g=Z-(Y*0x100) 
    set Z=Y/0x100 
    set r=Y-(Z*0x100) 
    if (rgb<0) then 
        set Z=Z+128 
    endif 
    call SetUnitVertexColor(u,r,g,b,Z) 
endfunction 

function SlashTemplate takes nothing returns nothing 
local unit u=GetTriggerUnit() 
local integer s=GetSpellAbilityId() 
local integer l=GetUnitAbilityLevel( u, s ) 
local group targetlog=CreateGroup() 
local group inrange=CreateGroup() 
local integer i=GetAbilityDataInt( s,l, "totalhits") 
local unit target=GetSpellTargetUnit() 
local unit picked 
local unit other=GetSpellTargetUnit() 
local real grad=GetUnitX( u) 
local real damage=GetAbilityDataReal(s,l,"dmg") 
local effect fx1=AddSpellEffectTargetById( s, EFFECT_TYPE_CASTER, u, GetAbilityEffectById(s,EFFECT_TYPE_CASTER,1)) 
local effect fx2=AddSpellEffectTargetById( s, EFFECT_TYPE_CASTER, u, GetAbilityEffectById(s,EFFECT_TYPE_CASTER,2)) 

local real x 
local real y 
local real tx 
local real ty 
local real d 
local integer dop 
local real fc 

local real dmgps=GetAbilityDataReal(s,l,"PDmg") 
local real period=GetAbilityDataReal(s,l,"PDmgPeriod") 
local real dur=GetAbilityDataReal(s,l,"PDmgDur") 

local integer ki=GetAbilityDataInt(s,l,"SlashKind") 

local boolean closest=(GetAbilityDataInt(s,l,"SelMethod")==0) 
local boolean color = (GetAbilityDataInt(s,l,"colorize")==1 ) 

    call PauseUnit(u, true) 
    call SetUnitPathing(u,false) 
    if (color) then 
        call SlashTemplate_Colorize(u,GetAbilityDataInt(s,l,"SlashColor")) 
    endif 

    loop 
        call GroupAddUnit( targetlog,target) 
        set x=GetUnitX(u) 
        set y=GetUnitY(u) 
        set tx=GetUnitX(target) 
        set ty=GetUnitY(target) 

        call DestroyEffect( AddSpellEffectById( s, EFFECT_TYPE_SPECIAL, x,y ) ) 

        call SetUnitAnimation( u, GetAbilityDataString(s,l,"animation") ) 
        call TriggerSleepAction(0) 

        if ((ki==0) or ((ki==2) and (GetRandomInt(0,1)==0))) then 
            set grad=Atan2( ty - y, tx - x ) 
        else 
            set grad=GetRandomReal(0,2*bj_PI) 
        endif 
        set x=100*Cos(grad) 
        set y=100*Sin(grad) 
        if (GetAbilityDataInt(s,l,"AngleKind")==1) then 
            set x=-x 
            set y=-y 
        endif 
        set x=tx+x 
        set y=ty+y 
         
        call SetUnitFacing( u, grad*bj_RADTODEG ) 
        call SetUnitPosition( u, x, y ) 

        set dop=LoadDamageOptions(GetAbilityDataInt(s,l,"DamageOptions")) 
        set fc=GetDamageFactorByOptions(u,target,dop) 

        if (fc!=0) then 
            call UnitDamageTarget( u,target, damage*fc,true,false,null,null,null) 
            call SlashTemplate_DoSpell(GetOwningPlayer(u),target,s,l) 
            if (dmgps!=0) then 
                call UnitDamageUnitTimed(u,dmgps*fc,period,dur,target,GetAbilityEffectById(  s,EFFECT_TYPE_TARGET,0),GetAbilityEffectById(s,EFFECT_TYPE_TARGET,1),n  ull,null) 
            else 
                call DestroyEffect( AddSpellEffectTargetById( s, EFFECT_TYPE_TARGET, target, GetAbilityEffectById(s,EFFECT_TYPE_TARGET,1) ) ) 
            endif 
        endif 




        call TriggerSleepAction(0) 

        set x=GetAbilityDataReal(s,l,"dmgfct") 
        set damage=damage*x 
        set dmgps=dmgps*x 

        set x=GetUnitX(u) 
        set y=GetUnitY(u) 
        set tx=GetUnitX(target) 
        set ty=GetUnitY(target) 

        set i=i-1 
        exitwhen (i==0) or (GetWidgetLife(u)<1) 
        call GroupClear(inrange) 
        call GroupEnumUnitsInRange(inrange, tx, ty , GetAbilityDataReal(s,l,"area") , null) 
        set target=null 
        set other=null 
        if closest then 
            set grad=1000000 
        else 
            set grad=0 
        endif 
        set dop=LoadDamageOptions(GetAbilityDataInt(s,l,"DamageOptions")) 
        loop 
            set picked=FirstOfGroup(inrange) 
            exitwhen (picked==null) 
            set fc=GetDamageFactorByOptions(u,picked,dop) 
            if (fc!=0) then 
                if closest then 
                    set d=SquareRoot( Pow(x-GetUnitX(picked),2) + Pow(y-GetUnitY(picked),2) ) 
                else 
                    set d=GetRandomInt(0,R2I(grad+1)) 
                endif 
                if (d <= grad) then 
                    if not( IsUnitInGroup(picked,targetlog) ) then 
                        if closest then 
                            set grad=d 
                        endif 
                        set target=picked 
                    endif 
                    if not(closest) then 
                        set grad=grad+1 
                    endif 
                    set other=picked 
                endif 
            endif 
            call GroupRemoveUnit(inrange,picked) 
        endloop 
        if (target==null) and (GetAbilityDataInt(s,l,"canrepeat") == 1) then 
            set target=other 
        endif 
        exitwhen (target==null) 
    endloop 
    if (color) then 
        call SlashTemplate_Colorize(u,GetAbilityDataInt(s,l,"EndColor")) 
    endif 
    call DestroyEffect( AddSpellEffectTargetById( s, EFFECT_TYPE_SPECIAL, u, "origin" ) ) 
    call PauseUnit(u,false) 
    call SetUnitPathing(u,true) 
    call SetUnitPosition(u, GetUnitX(u), GetUnitY(u) ) 
call DestroyEffect(fx1) 
call DestroyEffect(fx2) 
set fx1=null 
set fx2=null 
set u=null 
call DestroyGroup(targetlog) 
set targetlog=null 
call DestroyGroup(inrange) 
set inrange=null 
set target=null 
set other=null 
endfunction 

function InitTrig_Slash_Template takes nothing returns nothing 
    call ExecuteFunc("SlashTemplateSetup") 
//Must use ExecuteFunc to prevent the Map init thread from getting too long and crash. 
endfunction




Any help you could provide would be most appreciated.
 
1. Im not even going to read Vex's script, it hurts my head when he does stuff.

2. Make a 2nd GUI trigger that ones when the ability is cast? 1 ability can fire more than 1 trigger of corse.

Or i guess wait till a JASS master comes and helps. :D

..or Axe's beats me to posting...
 
hehe yeah funny how vex talks about how easy it is to do, but yeah wut you suggested sounds like a great idea i may give that a try. :)

Hmm but to do that I'm gonna have to find the exact time it takes him to carry out the move...
 
ahh u gotta be kidding me
if u cant read that crap dont bother using it
vex makes everything harder than it has to be
id have to check out how the omni looks but omnislash type spells are pretty simple and plain to create.
 
Hehe, yeah it's real confusing, but I love the effects he has done with the spell, if you'de like, I could post the map I got it from. :)
 
hmm actually minus all the coments its decently short but id recommend for now on dont use jass unless u know EXACTLY what its saying and doing or learn jass, start by getting C++ for dummies thatll help im currently trying to learn c++ atm.. hurts ur brain alot >.<
 
Yeah I don't doubt it, thing is Vex makes all the best spells and abilities. ;)

I guess using the jass, which I dunno how to do, I need to somehow pause the caster, and make invulnerable until the move is carried out.
 
Ok... gui, I need to know 1. What is it?
2. Ho do I get it?

Srry I'm still kinda noob at this stuff so plz bear with me. :o
 
GUI is the regular trigger editor. Now, this topic is being locked, because you've posted this more than once. I will bump your other topic.
 
Status
Not open for further replies.
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Happy Thursday!
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    we were down for a minute - think a log file or something got too big
    +1
  • Ghan Ghan:
    The alerts say it was down for a while unfortunately.
  • Ghan Ghan:
    Didn't know what was going on while I was at work.
  • Ghan Ghan:
    Disk filled up with logs. Fixed now.
    +1
  • The Helper The Helper:
    not a problem at all thanks for getting us back up
  • The Helper The Helper:
    I think the bots are finding a way to get through the anubis
  • The Helper The Helper:
    Happy Wednesday Everyone! Hope everyone has a Fantastic Day!
    +1
  • The Helper The Helper:
    Yeah, stats are showing big bot influx like 12k page views.
  • Wizard Wizard:
    :wave:
    +1
  • Ghan Ghan:
    TH changed his avatar again. 6 more weeks of summer.
    +3
  • Wizard Wizard:
    lol
    +1
  • The Helper The Helper:
    Guys just a heads up I am going to be shutting the site down soon. I am just waiting on the NUON people to decide whether they want to transfer forum data and keep the discord. My email is [email protected] for anyone that wants to keep in touch and I have a facebook too. I will make an official post later. Love you guys and will miss everyone!
    +1
  • V-SNES V-SNES:
    Sent a pm @The Helper
  • Stephen Stephen:
    Oh no - please don't lose the Nuon content
    +1
  • The Helper The Helper:
    Someone email AtariAge and see if they want me to transfer the forum data over to it
  • Ghan Ghan:
    Could probably keep NUON stuff around here if we wanted.
  • Ghan Ghan:
    Hmm what to do about the World Editor site though?
  • Stephen Stephen:
    I'd rather personally just own a backup of the Nuon data than see it go to AtariAge honestly. If it gets enshittified as per usual, or if some of the "regular" Jaguar folks get there, it's not gonna be fun
  • The Helper The Helper:
    There will be a github of the forum data so the NUON Forum Data I guess would be available there
  • The Helper The Helper:
    World Editor is technically Ryoko stuff not mine you guys can keep that I am not in that even
  • jonas jonas:
    :( end of an era :(
  • The Helper The Helper:
    Dont think of it as an end jonas - think of it as a beginning, because really my friend that is what it is.

The Helper Discord

Staff online

  • Ghan
    Administrator - Servers are fun

Members online

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top