HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why it drops people?

05-04-2004, 12:49 AM#1
iac
Can anyone tell me where is bug in the text below? Sympthoms are: when player uses ability Pick or Random pick (A006 or A007) new hero is created for the player and unit casting the ability becomes neutral-passive. all seems to be working, but since hero is created drop appears (player is disconnected). I haven't test it with more than 2 ppl including me, so IDK if all players are disconnected except host or just player casting the ability is disconnected.

here comes the trigger (yeah, it is based on Lord Vexorian's HSS):
//------------------------------------------------------------------------
function Trig_Pick_hero_Conditions takes nothing returns boolean
if ( not ( udg_Hero[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] == null ) ) then
return false
endif
if ( not ( GetOwningPlayer(GetSpellAbilityUnit()) != udg_ArmyOwnerNW ) ) then
return false
endif
if ( not ( GetOwningPlayer(GetSpellAbilityUnit()) != udg_ArmyOwnerSE ) ) then
return false
endif
if ( not ( IsUnitType(GetSpellAbilityUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction

function Trig_Pick_hero_Actions takes nothing returns nothing

local unit hero = GetSpellAbilityUnit()
local player owner = GetOwningPlayer(hero)
local integer id = GetConvertedPlayerId(owner)
local unit newhero

local real x = GetRectCenterX(udg_Respawn[id])
local real y = GetRectCenterY(udg_Respawn[id])

if GetSpellAbilityId() == 'A006' then //*Select Hero Clicked
call SetUnitOwner( hero, Player(PLAYER_NEUTRAL_PASSIVE), true )

set newhero=CreateUnit(owner, GetUnitTypeId(hero),x,y, bj_UNIT_FACING )

call SmartCameraPanBJ( owner, GetRectCenter(udg_Respawn[id]), 0.5 )
set udg_Hero[id] = newhero
call SetHeroLevelBJ( newhero, udg_HeroLevel[id], false )
call AddSpecialEffectLocBJ( GetUnitLoc(newhero), "Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl" )
call SelectUnitForPlayerSingle( newhero, owner )
set udg_SelectedHero[id] = null
call SetPlayerAllianceBJ( Player(PLAYER_NEUTRAL_PASSIVE), ALLIANCE_SHARED_VISION, false, owner )

elseif GetSpellAbilityId() == 'A007' then //*Random Hero Clicked
call SetUnitOwner( hero, Player(PLAYER_NEUTRAL_PASSIVE), true )

set newhero=CreateUnit(owner, GetUnitTypeId(udg_HeroesToPick[GetRandomInt(0, udg_NumberOfHeroes)]),x,y, bj_UNIT_FACING )

call SmartCameraPanBJ( owner, GetRectCenter(udg_Respawn[id]), 0.5 )
set udg_Hero[id] = newhero
call SetHeroLevelBJ( newhero, udg_HeroLevel[id], false )
call AddSpecialEffectLocBJ( GetUnitLoc(newhero), "Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl" )
call SelectUnitForPlayerSingle( newhero, owner )
set udg_SelectedHero[id] = null
call SetPlayerAllianceBJ( Player(PLAYER_NEUTRAL_PASSIVE), ALLIANCE_SHARED_VISION, false, owner )
endif


endfunction

//===========================================================================
function InitTrig_Pick_hero takes nothing returns nothing
set gg_trg_Pick_hero = CreateTrigger( )

call TriggerRegisterAnyUnitEventBJ( gg_trg_Pick_hero, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Pick_hero, Condition( function Trig_Pick_hero_Conditions ) )
call TriggerAddAction( gg_trg_Pick_hero, function Trig_Pick_hero_Actions )
endfunction
//------------------------------------------------------------------------
05-04-2004, 01:31 AM#2
ThyFlame
Alright, ease up Weaddar. You don't need to be a prick all the time when I take a guess at something.
05-04-2004, 02:43 AM#3
weaaddar
your an idiot ThyFlame you have no idea the difference between local in scope variable and a local instance. GetLocalPlayer returns the instance of the the local player.

A local player variable is the same exact thing as a global player variable only its usage is limited to teh function it is defined in. They both are four byte integer pointers. Plain and simple.
The reason this is screwing up is not because of that. I can't see anything abhorently wrong with it you should probably ask vex as it is his system nonetheless.
05-05-2004, 03:56 PM#4
Vexorian
call SmartCameraPanBJ( owner, GetRectCenter(udg_Respawn[id]), 0.5 )


SmartCameraPanBJ desyncs the game, and also try using my latest version instead of that old one.

In replacement of SmartCameraPanBJ use the normal pan function
05-06-2004, 06:00 AM#5
iac
Quote:
Originally Posted by Lord Vexorian
call SmartCameraPanBJ( owner, GetRectCenter(udg_Respawn[id]), 0.5 )

SmartCameraPanBJ desyncs the game, and also try using my latest version instead of that old one.

In replacement of SmartCameraPanBJ use the normal pan function

Thank you, Lord Vexorian, though i've found the problem with SmartPan myself this night... TT
BTW, I've wrote my own HSS fully from the beginning (however I've copied abilities from your map). I don't think I had to since your work is very universal and only needs minor changes to fit certain map if needs any at all, but I just wanted to prove to myself that I can do it (listing posted by me is written by me fully) =) And what I've started from is your HSS v6.0, latest version AFAIK. (credits will be added indeed)