| 01-07-2006, 09:12 AM | #1 |
<DIV class=jassblockstart>Everything in here works except for removing the item from units in the group. It's not anything wrong with the loop because I tried taking it out of the loop and it still wouldn't work. Help? JASS: <DIV class=jassblock style="HEIGHT: 30em">function SeiryuuBool takes nothing returns boolean |
| 01-07-2006, 09:18 AM | #2 |
you didnt post any code btw. |
| 01-07-2006, 09:18 AM | #3 |
Eh let me try this again. Everything in here works except for removing the item from units in the group. It's not anything wrong with the loop because I tried taking it out of the loop and it still wouldn't work. Help? <DIV class=jassblockstart>JASS: <DIV class=jassblock style="HEIGHT: 30em">function SeiryuuBool takes nothing returns boolean |
| 01-07-2006, 09:19 AM | #4 |
OMG, it shows up fine in the preview but then it removes the code. I'm using [jass] code Here goes last try. JASS:function SeiryuuBool takes nothing returns boolean if ( not ( GetItemTypeId(GetManipulatedItem()) == 'I03J' ) ) then return false endif return true endfunction function SummonItem takes nothing returns boolean if not UnitHasItemOfTypeBJ(GetEnumUnit(), 'I03J') then return false endif return true endfunction function MapItems takes nothing returns nothing if GetItemTypeId(GetEnumItem()) == 'I03J' then call RemoveItem( GetEnumItem() ) endif endfunction function SeiryuuGroup takes nothing returns nothing call RemoveItem( GetItemOfTypeFromUnitBJ(GetEnumUnit(), 'I03J') ) endfunction function Trig_Summon_Seiryuu_Actions takes nothing returns nothing local location l=GetUnitLoc(gg_unit_nC09_0071) local string sfx="Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl" local group g if IsUnitDeadBJ(gg_unit_nbzd_0481) and IsUnitDeadBJ(gg_unit_nrwm_0225) and IsUnitDeadBJ(gg_unit_nbwm_0226) then set g=GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function SummonItem)) call RemoveItem( GetManipulatedItem() ) call SetUnitPositionLocFacingLocBJ( gg_unit_n00I_0090, l, GetUnitLoc(GetTriggerUnit()) ) call DestroyEffect(AddSpecialEffectLocBJ(l,sfx )) call RemoveLocation(l) call DisplayTextToForce( GetPlayersAllies(GetOwningPlayer(GetManipulatingUnit())), ( udg_playerColor[GetConvertedPlayerId(GetOwningPlayer(GetManipulatingUnit()))] + ( GetPlayerName(GetOwningPlayer(GetManipulatingUnit())) + " |r has summoned Seiryuu." ) ) ) loop if IsUnitGroupEmptyBJ(g) then exitwhen true endif call ForGroup(g,function SeiryuuGroup) call TriggerSleepAction(.05) set g=GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function SummonItem)) endloop call EnumItemsInRectBJ( GetPlayableMapRect(), function MapItems ) call DestroyGroup(g) call EnableTrigger( gg_trg_Seiryuu_Dies ) call DestroyTrigger( GetTriggeringTrigger() ) else call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(GetManipulatingUnit())), "All 3 dragons must be killed first" ) endif set l=null set sfx=null set g=null endfunction //=========================================================================== function InitTrig_Summon_Seiryuu takes nothing returns nothing set gg_trg_Summon_Seiryuu = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Summon_Seiryuu, EVENT_PLAYER_UNIT_USE_ITEM ) call TriggerAddCondition( gg_trg_Summon_Seiryuu, Condition( function SeiryuuBool ) ) call TriggerAddAction( gg_trg_Summon_Seiryuu, function Trig_Summon_Seiryuu_Actions ) endfunction |
| 01-07-2006, 09:29 AM | #5 |
now if you could tell us what doesn't work here... edit : you are very new to jass and your code needs LOTS of improvements. it even leaks btw |
| 01-07-2006, 09:46 AM | #6 |
heh , that page with the script was nice! btw change syntax highlight (bookmarked it , might use it sometimes :D ) |
| 01-07-2006, 10:46 AM | #7 |
I think that scripts shall be in the post, but of course if it causes problems.. http://www.wc3jass.com/pastebin.php I prefer the JASS Vault's pastebin, string highlighting seems to be bugged in yours. Anyways, the idea is nice. You can not use GetManipulatedItem() there, you must use something like GetItemOfType from unit, I think there is such a function in the GUI, try to find it and convert it to JASS. |
| 01-07-2006, 11:29 AM | #8 |
I pasted the code then hit preview, then posted it seemed to work, what style are you using? it could be something in the CSS of some style. JASS:function SeiryuuBool takes nothing returns boolean if ( not ( GetItemTypeId(GetManipulatedItem()) == 'I03J' ) ) then return false endif return true endfunction function SummonItem takes nothing returns boolean if not UnitHasItemOfTypeBJ(GetEnumUnit(), 'I03J') then return false endif return true endfunction function MapItems takes nothing returns nothing if GetItemTypeId(GetEnumItem()) == 'I03J' then call RemoveItem( GetEnumItem() ) endif endfunction function SeiryuuGroup takes nothing returns nothing call RemoveItem( GetItemOfTypeFromUnitBJ(GetEnumUnit(), 'I03J') ) endfunction function Trig_Summon_Seiryuu_Actions takes nothing returns nothing local location l=GetUnitLoc(gg_unit_nC09_0071) local string sfx="Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl" local group g if IsUnitDeadBJ(gg_unit_nbzd_0481) and IsUnitDeadBJ(gg_unit_nrwm_0225) and IsUnitDeadBJ(gg_unit_nbwm_0226) then set g=GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function SummonItem)) call RemoveItem( GetManipulatedItem() ) call SetUnitPositionLocFacingLocBJ( gg_unit_n00I_0090, l, GetUnitLoc(GetTriggerUnit()) ) call DestroyEffect(AddSpecialEffectLocBJ(l,sfx )) call RemoveLocation(l) call DisplayTextToForce( GetPlayersAllies(GetOwningPlayer(GetManipulatingUnit())), ( udg_playerColor[GetConvertedPlayerId(GetOwningPlayer(GetManipulatingUnit()))] + ( GetPlayerName(GetOwningPlayer(GetManipulatingUnit())) + " |r has summoned Seiryuu." ) ) ) loop if IsUnitGroupEmptyBJ(g) then exitwhen true endif call ForGroup(g,function SeiryuuGroup) call TriggerSleepAction(.05) set g=GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function SummonItem)) endloop call EnumItemsInRectBJ( GetPlayableMapRect(), function MapItems ) call DestroyGroup(g) call EnableTrigger( gg_trg_Seiryuu_Dies ) call DestroyTrigger( GetTriggeringTrigger() ) else call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(GetManipulatingUnit())), "All 3 dragons must be killed first" ) endif set l=null set sfx=null set g=null endfunction //=========================================================================== function InitTrig_Summon_Seiryuu takes nothing returns nothing set gg_trg_Summon_Seiryuu = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Summon_Seiryuu, EVENT_PLAYER_UNIT_USE_ITEM ) call TriggerAddCondition( gg_trg_Summon_Seiryuu, Condition( function SeiryuuBool ) ) call TriggerAddAction( gg_trg_Summon_Seiryuu, function Trig_Summon_Seiryuu_Actions ) endfunction |
| 01-07-2006, 05:26 PM | #9 |
I found my problem anyway. Needed to change GetEnumUnit() in a boolean to GetFilterUnit(). Stupid mistake Here is the trigger now, and cleaned up a little. Maybe you could show me what leaks also. I tried finding a call for itemgroup in the common.j, but I can't locate it. I found itempool but I wonder if it works the same. JASS:function SeiryuuBool takes nothing returns boolean return GetItemTypeId(GetManipulatedItem()) == 'I03J' endfunction function SummonItem takes nothing returns boolean return UnitHasItemOfTypeBJ(GetFilterUnit(), 'I03J') endfunction function MapItems takes nothing returns nothing if GetItemTypeId(GetEnumItem()) == 'I03J' then call RemoveItem( GetEnumItem() ) endif endfunction function SeiryuuGroup takes nothing returns nothing call RemoveItem( GetItemOfTypeFromUnitBJ(GetEnumUnit(), 'I03J') ) endfunction function Trig_Summon_Seiryuu_Actions takes nothing returns nothing local location l=GetUnitLoc(gg_unit_nC09_0071) local string sfx="Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl" local group g if IsUnitDeadBJ(gg_unit_nbzd_0481) and IsUnitDeadBJ(gg_unit_nrwm_0225) and IsUnitDeadBJ(gg_unit_nbwm_0226) then set g=GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function SummonItem)) call RemoveItem( GetManipulatedItem() ) call SetUnitPositionLocFacingLocBJ( gg_unit_n00I_0090, l, GetUnitLoc(GetTriggerUnit()) ) call DestroyEffect(AddSpecialEffectLocBJ(l,sfx )) call RemoveLocation(l) call DisplayTextToForce( GetPlayersAllies(GetOwningPlayer(GetManipulatingUnit())), ( udg_playerColor[GetConvertedPlayerId(GetOwningPlayer(GetManipulatingUnit()))] + ( GetPlayerName(GetOwningPlayer(GetManipulatingUnit())) + " |r has summoned Seiryuu." ) ) ) call DisplayTextToForce( GetPlayersAllies(GetOwningPlayer(GetManipulatingUnit())), "TRIGSTR_4434" ) loop if IsUnitGroupEmptyBJ(g) then exitwhen true endif call ForGroup(g,function SeiryuuGroup) set g=GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function SummonItem)) endloop call EnumItemsInRectBJ( GetPlayableMapRect(), function MapItems ) call DestroyGroup(g) call EnableTrigger( gg_trg_Seiryuu_Dies ) call DestroyTrigger( GetTriggeringTrigger() ) else call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(GetManipulatingUnit())), "TRIGSTR_4433" ) endif set l=null set sfx=null set g=null endfunction //=========================================================================== function InitTrig_Summon_Seiryuu takes nothing returns nothing set gg_trg_Summon_Seiryuu = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Summon_Seiryuu, EVENT_PLAYER_UNIT_USE_ITEM ) call TriggerAddCondition( gg_trg_Summon_Seiryuu, Condition( function SeiryuuBool ) ) call TriggerAddAction( gg_trg_Summon_Seiryuu, function Trig_Summon_Seiryuu_Actions ) endfunction |
| 01-07-2006, 06:32 PM | #10 |
there is no such a thing like item groups, EnumItemsInRectBJ simple uses the items in the rect, you don't have to destroy anything (unless the rect is temporary, but in this case GetPlayableMapRect() always return a pointer to the same rect.) |
| 01-07-2006, 08:21 PM | #11 |
Oh and btw, the [jass] code tags are ok if I submit the post immediately. I was getting the problem if I previewed it first and then posted. |
| 01-07-2006, 08:23 PM | #12 |
I don't have that problem though, so it might be something with the style you are using , or maybe your browser needs an update |
| 01-07-2006, 08:24 PM | #13 |
Maybe you would tell who helped you clean your code??? grrr :) EDIT: Oh and I was guessing that can someone clarify, this code looks like little modified conversion from gui but I'm not sure |
