• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Ideas on how to JASS trigger this?

Status
Not open for further replies.
Level 1
Joined
Apr 8, 2005
Messages
3
spell?

Basically, the dummy skill will target an area. The skill will:

Create 4 custom units in a preset region (mortars with locust)
Play an sound that's included in wc3
Display a text message to all players
Order the custom units to "attack ground" random points in the AOE of the dummy skill
Do 3 "waves" of these attacks



any help would really be appreciated in helping start with JASS triggering Smile)
 
Level 2
Joined
Sep 10, 2004
Messages
21
Try this:
assume - the radius of the dummy spell is 500
- 'h001' is the rawcode of the mortar unit
- udg_mortarsregion is the region where the mortars should appear
- udg_sound is the sound you specified to be played
- the spell´s rawcode is 'A001'
- your spell´s trigger is named "mortarfire"

JASS:
function mortarfire_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A001'
endfunction

function mortarspell takes nothing returns nothing
  local location loc=GetSpellTargetLoc()
  local unit array mortars
  local integer a=0
  local integer b=0
  local real radius=500
  loop
    exitwhen a=>4
    set mortars[a]=CreateUnitAtLoc(Player(16), 'h001', GetRectCenter(udg_mortarsregion),0)
    set a=a+1
  endloop
  set a=0
  call PlaySoundBJ(udg_sound)
  call DisplayTextToForce(GetPlayersAll(),"Mortars are now fireing!!")
  loop
    exitwhen b=>3
    loop
      exitwhen a=>4
      call IssuePointOrderLoc(mortars[a],"attackground",PolarProjectionBJ(loc,GetRandomReal(0,radius),GetRandomDirectionDeg()))
      set a=a+1
    endloop
    call PolledWait(1)
    set b=b+1
  endloop
  set a=0
  call RemoveLocation(loc)
  set loc=null
  loop
    exitwhen a=>4
    set mortars[a]=null
    set a=a+1
  endloop
endfunction


function InitTrig_mortarfire takes nothing returns nothing
set gg_trg_mortarfire=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_mortarfire,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_mortarfire,Condition(function mortarfire_Conditions))
call TriggerAddAction(gg_trg_mortarfire,function mortarspell)
endfunction

//edit:corrected typing mistakes and added InitTrig and Condition
 
Level 2
Joined
Sep 10, 2004
Messages
21
No problem, rly.
You should also add a something that removes the mortars afterwards, else there will be lots of mortars after a time.
 
Level 2
Joined
Sep 10, 2004
Messages
21
Hmm...
doesnt happen in my WE.
just copied/pasted it into the trigger and it worked :?
maybe you should just copy/paste it into the WE and format it so it looks like that, perhaps its that strange because the php script auto formats the JASS snippet, but I really have no other idea why it shouldnt work.
 
Status
Not open for further replies.
Top