[Help]Ninja Hability

Status
Not open for further replies.
Hi, i have the next problem :

I'm doing a skill that makes a sand cloud for hide the ninja. (I use Phamtom hability for make it stealth ). The problem is : if i get out of the sand cloud i want to remove Phantom hability from a ninja and if i get into the sand cloud , i want to get phamton hability for hide. It's for normal editor , non JASS :)


Anyone can help me? plz :(
:cute:
 
Level 4
Joined
Mar 23, 2008
Messages
87
Normal editor also has JASS, just select your trigger and go Edit>Convert to custom script.
This trigger would be easiest to make in JASS as you would need to do some calculations to check if the ninja has moved away from the point it cast the spell.

Suggestion (uncomplete):
JASS:
function checkcloud takes nothing returns nothing
   local real dist
   local real dx = udg_pointx - GetUnitX(GetEnumUnit()) //pointx & y is global variables for where the spell was cast
   local real dy = udg_pointy - GetUnitY(GetEnumUnit())
   set dx = dx*dx
   set dy = dy*dy
   set dist = SquareRoot(dx+dy)
   if dist>256.00 then
      //Remove spell here
   endif
endfunction

This is also possible in GUI, but lacking World editor @ work i can't concuct an example before i get home :(
 
Normal editor also has JASS, just select your trigger and go Edit>Convert to custom script.
This trigger would be easiest to make in JASS as you would need to do some calculations to check if the ninja has moved away from the point it cast the spell.

Suggestion (uncomplete):
JASS:
function checkcloud takes nothing returns nothing
   local real dist
   local real dx = udg_pointx - GetUnitX(GetEnumUnit()) //pointx & y is global variables for where the spell was cast
   local real dy = udg_pointy - GetUnitY(GetEnumUnit())
   set dx = dx*dx
   set dy = dy*dy
   set dist = SquareRoot(dx+dy)
   if dist>256.00 then
      //Remove spell here
   endif
endfunction

This is also possible in GUI, but lacking World editor @ work i can't concuct an example before i get home :(

Thx for you help, but i don't know how to script in JASS , i don't know how to start with your script :S xd Im triying combine that script with my code. MY code is:

and for remove


but the second part it doesn't work, because it won't remove :)

 
Level 4
Joined
Mar 23, 2008
Messages
87
Remove
  • Set X_Ninja_Unit_Caster = (Triggering Unit)

From the second trigger (Keep it in the first!)
Also, the last if statement in the first trigger should be moved over into the second trigger. (except for the one enabling the trigger)

You can also change the event for the second trigger to be Unit Leaves/Enters Region.

and as i sent you a pm about, i'll post a working example once i get home :p


Edit:
I tried making it strictly GUI, but failed. To be able to use it with more than one hero at a time i had to convert to jass because of special timer tricks.
This works, no sfx or anything fancy, but it does hide (ghost) the hero inside a given radius:

JASS:
//Put this into a Trigger called "Spell" without quotes
//Convert into JASS by having the trigger selected
//and go Edit>Convert to custom script
function SpellWearsOff takes nothing returns nothing
    call RemoveLocation(udg_CloudPos[udg_id])
    call UnitRemoveAbilityBJ( 'Agho', udg_CloudUnit[udg_id] )
    //=========================
    //End SFX stuff and whatever here:
    
    
    //=========================
    set udg_id = ( udg_id + 1 )
    if (  udg_id > 50 ) then
        set udg_id = 1
    endif
endfunction


function Trig_Spell_Actions takes nothing returns nothing
    set udg_CloudPos[udg_uid] = GetUnitLoc(GetTriggerUnit())
    set udg_CloudUnit[udg_uid] = GetTriggerUnit()
    set udg_Invis[udg_uid] = false
    set udg_Ctimer[udg_uid] = CreateTimer()
    call TimerStart(udg_Ctimer[udg_uid], 10.00, false, function SpellWearsOff)
    //=========================
    //Start SFX stuff and whatever here:
    
    
    //=========================
    set udg_uid = ( udg_uid + 1 )
    if ( udg_uid > 50 ) then
        set udg_uid = 1
    endif
endfunction

//===========================================================================
function InitTrig_Spell takes nothing returns nothing
    set gg_trg_Spell = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Spell, EVENT_PLAYER_UNIT_SPELL_FINISH )
    call TriggerAddAction( gg_trg_Spell, function Trig_Spell_Actions )
endfunction


Trigger to check if the Hero is inside the cloud:

  • runSpell
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
      • uid Not equal to id
    • Actions
      • For each (Integer A) from id to uid, do (Actions)
        • Loop - Actions
          • Set loc = (Position of CloudUnit[(Integer A)])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between loc and CloudPos[(Integer A)]) Less than (256.00 + (16.00 x (Real((Level of PhantomCloud for CloudUnit[(Integer A)])))))
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Invis[(Integer A)] Equal to False
                • Then - Actions
                  • Set Invis[(Integer A)] = True
                  • Unit - Add Ghost to CloudUnit[(Integer A)]
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Invis[(Integer A)] Equal to True
                • Then - Actions
                  • Set Invis[(Integer A)] = False
                  • Unit - Remove Ghost from CloudUnit[(Integer A)]
                • Else - Actions
          • Custom script: RemoveLocation(udg_loc)
 
Last edited:
Status
Not open for further replies.
Top