| 04-21-2004, 02:07 AM | #1 |
Anyone know the map Pest Invasion? There are bugs and humans try and catch them, one of the human characters is called "Ned" and it has the ability to shrink his size. How does this relate to the thread? When I cast the spell I get blue screened and WinXp starts dumping memory complaining my videocard's driver's dll did something that is potentially dangerous. Other people have crashed out trying to cast the spell but the odd thing is it only affects the person casting the spell. heres the code, I dont see why it would crash but these few lines I think are whats causing it: Code:
call ReplaceUnitBJ( GetTriggerUnit(), 'h00L', bj_UNIT_STATE_METHOD_RELATIVE ) call SelectUnitAddForPlayer( GetLastReplacedUnitBJ(), GetOwningPlayer(GetTriggerUnit()) ) Full code here: Code:
function Trig_Shrink_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A00F' ) ) then return false endif return true endfunction function Trig_Shrink_Func002C takes nothing returns boolean if ( not ( RectContainsUnit(gg_rct_MiddleVision, GetTriggerUnit()) == true ) ) then return false endif return true endfunction function Trig_Shrink_Actions takes nothing returns nothing call UnitRemoveAbilityBJ( 'A00F', GetTriggerUnit() ) if ( Trig_Shrink_Func002C() ) then call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit())), "TRIGSTR_021" ) call TriggerSleepAction( 0.50 ) call SetUnitManaBJ( GetTriggerUnit(), 99.00 ) else call UnitAddAbilityBJ( 'A00D', GetTriggerUnit() ) call IssueTargetOrderBJ( GetTriggerUnit(), "bloodlust", GetTriggerUnit() ) call TriggerSleepAction( 1.30 ) call ReplaceUnitBJ( GetTriggerUnit(), 'h00L', bj_UNIT_STATE_METHOD_RELATIVE ) call SelectUnitAddForPlayer( GetLastReplacedUnitBJ(), GetOwningPlayer(GetTriggerUnit()) ) endif endfunction function InitTrig_Shrink takes nothing returns nothing set gg_trg_Shrink = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Shrink, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Shrink, Condition( function Trig_Shrink_Conditions ) ) call TriggerAddAction( gg_trg_Shrink, function Trig_Shrink_Actions ) endfunction function Trig_Grow_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A00G' ) ) then return false endif return true endfunction function Trig_Grow_Actions takes nothing returns nothing call UnitRemoveAbilityBJ( 'A00G', GetTriggerUnit() ) call UnitAddAbilityBJ( 'A00E', GetTriggerUnit() ) call IssueTargetOrderBJ( GetTriggerUnit(), "bloodlust", GetTriggerUnit() ) call TriggerSleepAction( 1.30 ) call ReplaceUnitBJ( GetTriggerUnit(), 'h00K', bj_UNIT_STATE_METHOD_RELATIVE ) call SelectUnitAddForPlayer( GetLastReplacedUnitBJ(), GetOwningPlayer(GetTriggerUnit()) ) endfunction function InitTrig_Grow takes nothing returns nothing set gg_trg_Grow = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Grow, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Grow, Condition( function Trig_Grow_Conditions ) ) call TriggerAddAction( gg_trg_Grow, function Trig_Grow_Actions ) endfunction function Trig_Force_Grow_Conditions takes nothing returns boolean if ( not ( GetUnitTypeId(GetAttackedUnitBJ()) == 'h00L' ) ) then return false endif return true endfunction function Trig_Force_Grow_Actions takes nothing returns nothing call IssueImmediateOrderBJ( GetAttackedUnitBJ(), "howlofterror" ) endfunction function InitTrig_Force_Grow takes nothing returns nothing set gg_trg_Force_Grow = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Force_Grow, EVENT_PLAYER_UNIT_ATTACKED ) call TriggerAddCondition( gg_trg_Force_Grow, Condition( function Trig_Force_Grow_Conditions ) ) call TriggerAddAction( gg_trg_Force_Grow, function Trig_Force_Grow_Actions ) endfunction This is from one of those protected maps so pretty gui triggers are nonexistant. |
| 04-21-2004, 02:20 AM | #2 |
It might be a trigger error caused by the decompilation of the map, can't really tell ya with JASS (not much of an expert at it). By the way, did you (or anyone else) unprotect the map for learning purposes only? |
| 04-21-2004, 03:06 AM | #3 | |
Quote:
I want to know _WHY_ this is crashing and _HOW2FIX_ it ^_^ |
| 04-21-2004, 04:04 AM | #4 |
Those two lines will not cause the crash. IMO when a spell goes kaput like that then you should start from scratch. I had one that just decided to crash WC with an memory error, and I had to start over. Although, it turned out to be good because I created a funciton that can make the same effect but is generic now so I can easily make other spells like that. |
| 04-21-2004, 06:48 AM | #5 |
I wouldn't say that the error lies in these code lines. It will be some serious problem in either the hardcoded part of Warcraft 3 or something else. |
| 04-21-2004, 10:53 AM | #6 |
Ah, this is a cool one, I can think of what the problem is, atleast, if it's not the cause for the crash, it's atleast a serious bug. When you call ReplaceUnitBJ, it is a pretty lame function that kills->Removes the unit that gets passed, and creates a new unit with all the old units data, like location, facing, and stuff. So, what happens, is that after this line, your old unit doesn't exist, but you still have a pointer in the GetTriggerUnit(), so when you get the owning player of this non-existant unit, then you theoratically should get null, but you might get some garbage, which either then causes the game to crash, or in the next action, when you pass this garbage-player to SelectUnit. So, you have two options, atleast to fix this bug, if it's not related to the crash...Replace all references to GetTriggeringUnit after that line with GetLastReplacedUnit (if there is a wait in that trigger you should store it in a variable), and for that line, you can even just use GetTriggerPlayer() instead, as that returns the owner of the unit, i'm sure of. However, that might be too risky for you. Cubasis |
