• 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] Help with opening doors plz

Status
Not open for further replies.
Level 9
Joined
May 25, 2008
Messages
148
So i started learning JASS a week ago and wrote my own scrpit for a map, but im totally stuck here:

So whats supposed to happen : a hero enters a region infront of a gate.
A timer comes up counting down from 5, if the hero is still in the region after the 5 secs the gate opens.
There are 8 different gates and only a specific player may trigger a specific gate.

What happens : when a hero runs into any of the regions that activates the trigger, the special effect spawns on the triggering unit but nothing happens to the gate, the special effect on the gate and the text saying '5' spawns on another gate (allways the same one) but doesnt count down since the unit isnt in the region where he is supposed to be.
I have done some tests and there is absolutley nothing wrong with udg_Player or udg_rRegion but the trouble is at udg_dGate.

Custom Script Code :
function DoorOpen_condition takes nothing returns boolean
local player pPlay = udg_Player
return GetOwningPlayer(GetTriggerUnit()) == pPlay
endfunction

function DoorOpen_actions takes nothing returns nothing

local rect Reg = udg_rRegion
local destructable dDoor = udg_dGate

local integer Ttime = 5

set udg_rRegion = null
set udg_dGate = null


call AddSpecialEffectTargetUnitBJ( "origin", GetTriggerUnit(), "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl")
call DestroyEffect(GetLastCreatedEffectBJ())
call AddSpecialEffectLocBJ( GetDestructableLoc(dDoor), "Abilities\\Spells\\NightElf\\Starfall\\StarfallTarget.mdl" )
call DestroyEffect(GetLastCreatedEffectBJ())

call CreateTextTagLocBJ( "5", GetDestructableLoc(dDoor), 0, 10, 100, 100, 0, 0)
call SetTextTagPermanent(GetLastCreatedTextTag(),false)
call SetTextTagLifespan(GetLastCreatedTextTag(),1)
call SetTextTagFadepoint(GetLastCreatedTextTag(),0.6)
call TriggerSleepAction(1)

loop

exitwhen Ttime == 1
if RectContainsUnit(Reg, GetTriggerUnit()) == true then
call CreateTextTagLocBJ( I2S(Ttime-1), GetDestructableLoc(dDoor), 0, 11.5, 100, 100, 0, 0)
call SetTextTagPermanent(GetLastCreatedTextTag(),false)
call SetTextTagLifespan(GetLastCreatedTextTag(),1)
call SetTextTagFadepoint(GetLastCreatedTextTag(),0.6)
call TriggerSleepAction(1)
set Ttime = Ttime-1
endif
if (Ttime == 1) and (RectContainsUnit(Reg, GetTriggerUnit()) == true) then
call ModifyGateBJ( bj_GATEOPERATION_OPEN, dDoor )
endif
endloop

set Ttime = 0
set Reg = null
set dDoor = null

endfunction

8 Different Triggers :
function InitTrig_Door_B takes nothing returns nothing
set gg_trg_Door_B = CreateTrigger()

set udg_rRegion = gg_rct_Door_bot
set udg_dGate = gg_dest_ATg1_0001
set udg_Player = Player(0)

call TriggerRegisterEnterRectSimple(gg_trg_Door_B, gg_rct_Door_bot )
call TriggerAddCondition(gg_trg_Door_B,Condition(function DoorOpen_condition))
call TriggerAddAction(gg_trg_Door_B, function DoorOpen_actions)
endfunction

The red text is different with each trigger
 
Status
Not open for further replies.
Top