Jass ability problem

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

darkxion
Member
Posts: 57
Joined: April 26th, 2007, 7:53 pm

Jass ability problem

Post by darkxion »

I'm trying to fix an ability for a hero in a map I'm messing with, but my minimal understanding of JASS is a bit of a problem. The hero's ultimate attack (5 levels) seems to, randomly, cause some or all players to lose control of their units for a number of seconds, including the hero using the ability. I'm unsure how many. It's not meant do work that way. It -should- only effect units in an AoE of 600. After that number of seconds, the heroes regain control, but the hero using the ability doesn't seem to until it dies. The ability in question is A000. I'm not sure if more code than this is needed to ascertain the problem, this is what seemed relevant. Any help would be great, thanks :D

Code: Select all

function O95370 takes nothing returns boolean
	if(not(GetSpellAbilityId()=='A000'))then
		return false
	endif
	return true
endfunction

function O95321 takes nothing returns nothing
	call PauseUnitBJ(false,GetEnumUnit())
	call SetUnitTimeScalePercent(GetEnumUnit(),100.00)
endfunction

function O95467 takes nothing returns nothing
	if(O94850())then
		set udg_unit59=GetSpellAbilityUnit()
		set bj_forLoopBIndex=1
		set bj_forLoopBIndexEnd=3
		loop
			exitwhen bj_forLoopBIndex>bj_forLoopBIndexEnd
			set udg_location02=PolarProjectionBJ(GetUnitLoc(GetSpellAbilityUnit()),GetRandomReal(1.00,500.00),GetRandomReal(1.00,360.00))
			call AddSpecialEffectLocBJ(udg_location02,"Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl")
			call DestroyEffectBJ(GetLastCreatedEffectBJ())
			call RemoveLocation(udg_location02)
			set bj_forLoopBIndex=bj_forLoopBIndex+1
		endloop
		set bj_forLoopBIndex=1
		set bj_forLoopBIndexEnd=10
		loop
			exitwhen bj_forLoopBIndex>bj_forLoopBIndexEnd
			set udg_location02=PolarProjectionBJ(GetUnitLoc(GetSpellAbilityUnit()),GetRandomReal(1.00,500.00),GetRandomReal(1.00,360.00))
			call AddSpecialEffectLocBJ(udg_location02,"Abilities\\Spells\\Other\\Tornado\\TornadoElemental.mdl")
			call DestroyEffectBJ(GetLastCreatedEffectBJ())
			call RemoveLocation(udg_location02)
			set bj_forLoopBIndex=bj_forLoopBIndex+1
		endloop
		set udg_location02=GetUnitLoc(GetSpellAbilityUnit())
		set udg_group04=GetUnitsInRangeOfLocMatching(500.00,udg_location02,Condition(function O94755))
		call TriggerSleepAction(0.20)
		call DestroyGroup(udg_group04)
		call RemoveLocation(udg_location02)
	else
	endif
	if(O95370())then
		set udg_unit59=GetSpellAbilityUnit()
		set udg_location02=GetUnitLoc(udg_unit59)
		set udg_group08=GetUnitsInRangeOfLocMatching(600.00,udg_location02,Condition(function O95184))
		call RemoveLocation(udg_location02)
		set bj_forLoopBIndex=1
		set bj_forLoopBIndexEnd=10
		loop
			exitwhen bj_forLoopBIndex>bj_forLoopBIndexEnd
			set udg_location02=PolarProjectionBJ(GetUnitLoc(GetSpellAbilityUnit()),GetRandomReal(1.00,600.00),GetRandomReal(1.00,360.00))
			call AddSpecialEffectLocBJ(udg_location02,"Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl")
			call DestroyEffectBJ(GetLastCreatedEffectBJ())
			call RemoveLocation(udg_location02)
			set bj_forLoopBIndex=bj_forLoopBIndex+1
		endloop
		call ForGroupBJ(udg_group08,function O95306)
		call SetUnitLifeBJ(udg_unit59,(GetUnitStateSwap(UNIT_STATE_LIFE,udg_unit59)+(70.00*I2R(GetUnitAbilityLevelSwapped('A000',udg_unit59)))))
		call TriggerSleepAction((1.00*I2R(GetUnitAbilityLevelSwapped('A000',udg_unit59))))
		call ForGroupBJ(udg_group08,function O95321)
		set udg_group08=GetUnitsSelectedAll(Player(PLAYER_NEUTRAL_PASSIVE))
		call DestroyGroup(udg_group04)
	else
	endif
endfunction
What would be a working alternative to GetUnitsSelected?
Last edited by darkxion on October 31st, 2007, 5:26 pm, edited 1 time in total.
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2507
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Re: Jass ability problem

Post by Xantan »

Its this:
set udg_group08=GetUnitsSelectedAll(Player(PLAYER_NEUTRAL_PASSIVE))

Selected units causes major malfunctions on multi-player (online forms of custom bnet games)

I've experienced it myself and as aero had said Its just not a good function to use in the WE, he uses it and knows exactly you want selected but the first of the selected instead of using the command, cause that totally bugs...

anyways yeah try it.
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Jass ability problem

Post by Aero »

Selected units works flawlessly if you avoid BJ functions.
SyncSelections() is the killer
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2507
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Re: Jass ability problem

Post by Xantan »

Aero wrote:Selected units works flawlessly if you avoid BJ functions.
SyncSelections() is the killer
So whats the killer here? =/
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Jass ability problem

Post by Aero »

Hidden.
function GetUnitsSelectedAll takes player whichPlayer returns group
local group g = CreateGroup()
call SyncSelections()
call GroupEnumUnitsSelected(g, whichPlayer, null)
return g
endfunction
set udg_group08=GetUnitsSelectedAll(Player(PLAYER_NEUTRAL_PASSIVE))
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2507
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Re: Jass ability problem

Post by Xantan »

ahhh, so that was the problem, I'm just a noob when it comes to why.

glad to have you around aero =/