• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Need Help, have a few questions

Status
Not open for further replies.
Level 2
Joined
May 2, 2005
Messages
9
Making an rpg and been working on it for quite some time. I dont have any saving triggers or anything like that. Now What I need help with is only 3 things.
1)No 1 player mode.
2)Saving triggers, how to make my own, simplified.
3)And mainly making a better respawning trigger.

What i have so far.

1 player mode trigger i have so far. (knowing that it doesnt work atm, just need to improve it.) *I know I can make it work if some1 is player 1 and I can get it to work, but I wana know another way for future reference.
Code:
function Trig_No_1_Player_Func001Func001Func009Func001C takes nothing returns boolean
    if ( ( GetPlayerSlotState(Player(0)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(1)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(2)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(3)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(4)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(5)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(6)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(7)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    return false
endfunction

function Trig_No_1_Player_Func001Func001Func009C takes nothing returns boolean
    if ( not Trig_No_1_Player_Func001Func001Func009Func001C() ) then
        return false
    endif
    return true
endfunction

function Trig_No_1_Player_Func001Func001C takes nothing returns boolean
    if ( ( GetPlayerSlotState(Player(0)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(1)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(2)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(3)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(4)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(5)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(6)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( ( GetPlayerSlotState(Player(7)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return true
    endif
    if ( Trig_No_1_Player_Func001Func001Func009C() ) then
        return true
    endif
    return false
endfunction

function Trig_No_1_Player_Func001C takes nothing returns boolean
    if ( not Trig_No_1_Player_Func001Func001C() ) then
        return false
    endif
    return true
endfunction

function Trig_No_1_Player_Actions takes nothing returns nothing
    if ( Trig_No_1_Player_Func001C() ) then
        call DisableTrigger( GetTriggeringTrigger() )
    else
        call CustomDefeatBJ( Player(0), "TRIGSTR_121" )
        call CustomDefeatBJ( Player(1), "TRIGSTR_122" )
        call CustomDefeatBJ( Player(2), "TRIGSTR_123" )
        call CustomDefeatBJ( Player(3), "TRIGSTR_124" )
    endif
endfunction

//===========================================================================
function InitTrig_No_1_Player takes nothing returns nothing
    set gg_trg_No_1_Player = CreateTrigger(  )
    call DisableTrigger( gg_trg_No_1_Player )
    call TriggerAddAction( gg_trg_No_1_Player, function Trig_No_1_Player_Actions )
endfunction


And respawning trigger I have right now. (Made each unit seperatly and basically they dont drop any items.)
Code:
function Trig_Respawn_Conditions takes nothing returns boolean
    if ( not ( GetOwningPlayer(GetDyingUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func001C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'hfoo' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func002C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'ngno' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func003C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'n002' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func004C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nnmg' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func005C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nggr' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func006C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nhyc' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func007C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nnrg' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func008C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nmyr' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func009C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nnsw' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func010C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'nsnp' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func011C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'h000' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func012Func001Func005001 takes nothing returns boolean
    return ( GetUnitTypeId(GetDyingUnit()) == 'Hblm' )
endfunction

function Trig_Respawn_Func012Func001Func005002 takes nothing returns boolean
    return ( I2S(GetHeroLevel(GetDyingUnit())) == "1" )
endfunction

function Trig_Respawn_Func012Func001C takes nothing returns boolean
    if ( not GetBooleanAnd( Trig_Respawn_Func012Func001Func005001(), Trig_Respawn_Func012Func001Func005002() ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func012Func002Func007001 takes nothing returns boolean
    return ( GetUnitTypeId(GetDyingUnit()) == 'Hblm' )
endfunction

function Trig_Respawn_Func012Func002Func007002 takes nothing returns boolean
    return ( I2S(GetHeroLevel(GetDyingUnit())) == "2" )
endfunction

function Trig_Respawn_Func012Func002C takes nothing returns boolean
    if ( not GetBooleanAnd( Trig_Respawn_Func012Func002Func007001(), Trig_Respawn_Func012Func002Func007002() ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func012Func003Func006001 takes nothing returns boolean
    return ( GetUnitTypeId(GetDyingUnit()) == 'Hblm' )
endfunction

function Trig_Respawn_Func012Func003Func006002 takes nothing returns boolean
    return ( I2S(GetHeroLevel(GetDyingUnit())) == "3" )
endfunction

function Trig_Respawn_Func012Func003C takes nothing returns boolean
    if ( not GetBooleanAnd( Trig_Respawn_Func012Func003Func006001(), Trig_Respawn_Func012Func003Func006002() ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func012Func004Func006001 takes nothing returns boolean
    return ( GetUnitTypeId(GetDyingUnit()) == 'Hblm' )
endfunction

function Trig_Respawn_Func012Func004Func006002 takes nothing returns boolean
    return ( I2S(GetHeroLevel(GetDyingUnit())) == "4" )
endfunction

function Trig_Respawn_Func012Func004C takes nothing returns boolean
    if ( not GetBooleanAnd( Trig_Respawn_Func012Func004Func006001(), Trig_Respawn_Func012Func004Func006002() ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func012Func005Func004001 takes nothing returns boolean
    return ( GetUnitTypeId(GetDyingUnit()) == 'Hblm' )
endfunction

function Trig_Respawn_Func012Func005Func004002 takes nothing returns boolean
    return ( I2S(GetHeroLevel(GetDyingUnit())) == "5" )
endfunction

function Trig_Respawn_Func012Func005C takes nothing returns boolean
    if ( not GetBooleanAnd( Trig_Respawn_Func012Func005Func004001(), Trig_Respawn_Func012Func005Func004002() ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Func012C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'Hblm' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Actions takes nothing returns nothing
    if ( Trig_Respawn_Func001C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(gg_rct_Region_000), GetUnitLoc(GetAttacker()) )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func002C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLocFacingLocBJ( 1, 'ngno', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(gg_rct_Region_006), GetUnitLoc(GetAttacker()) )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func003C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLocFacingLocBJ( 1, 'n002', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(gg_rct_Region_008), GetUnitLoc(GetAttacker()) )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func004C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLocFacingLocBJ( 1, 'nnmg', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(gg_rct_Region_011), GetUnitLoc(GetAttacker()) )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func005C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLocFacingLocBJ( 1, 'nggr', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(gg_rct_Region_007), GetUnitLoc(GetAttacker()) )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func006C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLocFacingLocBJ( 1, 'nhyc', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(gg_rct_Region_012), GetUnitLoc(GetAttacker()) )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func007C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLoc( 1, 'nnrg', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRectCenter(gg_rct_Region_014), bj_UNIT_FACING )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func008C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLoc( 1, 'nmyr', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(gg_rct_Region_013), bj_UNIT_FACING )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func009C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLoc( 1, 'nnsw', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(gg_rct_Region_013), bj_UNIT_FACING )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func010C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLoc( 1, 'nsnp', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(gg_rct_Region_013), bj_UNIT_FACING )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func011C() ) then
        call TriggerSleepAction( 10.00 )
        call CreateNUnitsAtLocFacingLocBJ( 1, 'h000', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(gg_rct_Region_002), GetUnitLoc(GetAttacker()) )
    else
        call DoNothing(  )
    endif
    if ( Trig_Respawn_Func012C() ) then
        if ( Trig_Respawn_Func012Func001C() ) then
            call TriggerSleepAction( 10.00 )
            call ReviveHeroLoc( GetDyingUnit(), GetRectCenter(gg_rct_Region_001), true )
            call SetHeroLevelBJ( GetDyingUnit(), ( GetHeroLevel(GetDyingUnit()) + 1 ), true )
        else
            call DoNothing(  )
        endif
        if ( Trig_Respawn_Func012Func002C() ) then
            call TriggerSleepAction( 10.00 )
            call ReviveHeroLoc( GetDyingUnit(), GetRectCenter(gg_rct_Region_001), true )
            call SetHeroLevelBJ( GetDyingUnit(), ( GetHeroLevel(GetDyingUnit()) + 1 ), true )
            call SelectHeroSkill( GetDyingUnit(), 'AHfs' )
            call SelectHeroSkill( GetDyingUnit(), 'AHbn' )
        else
            call DoNothing(  )
        endif
        if ( Trig_Respawn_Func012Func003C() ) then
            call TriggerSleepAction( 10.00 )
            call ReviveHeroLoc( GetDyingUnit(), GetRectCenter(gg_rct_Region_001), true )
            call SetHeroLevelBJ( GetDyingUnit(), ( GetHeroLevel(GetDyingUnit()) + 1 ), true )
            call SelectHeroSkill( GetDyingUnit(), 'AHdr' )
        else
            call DoNothing(  )
        endif
        if ( Trig_Respawn_Func012Func004C() ) then
            call TriggerSleepAction( 10.00 )
            call ReviveHeroLoc( GetDyingUnit(), GetRectCenter(gg_rct_Region_001), true )
            call SetHeroLevelBJ( GetDyingUnit(), ( GetHeroLevel(GetDyingUnit()) + 1 ), true )
            call SelectHeroSkill( GetDyingUnit(), 'AHfs' )
        else
            call DoNothing(  )
        endif
        if ( Trig_Respawn_Func012Func005C() ) then
            call TriggerSleepAction( 10.00 )
            call ReviveHeroLoc( GetDyingUnit(), GetRectCenter(gg_rct_Region_001), true )
        else
            call DoNothing(  )
        endif
    else
        call DoNothing(  )
    endif
endfunction

//===========================================================================
function InitTrig_Respawn takes nothing returns nothing
    set gg_trg_Respawn = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Respawn, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Respawn, Condition( function Trig_Respawn_Conditions ) )
    call TriggerAddAction( gg_trg_Respawn, function Trig_Respawn_Actions )
endfunction
 
Level 9
Joined
Jul 27, 2006
Messages
652
Um do you know JASS? Because thats a GUI -> JASS conversion without any editing... Im just wondering why this is not GUI...
 
Level 6
Joined
Apr 16, 2007
Messages
177
it is in gui, i just converted to jass.

The question is why.
First of all, I wont read this cuz you did not make it tabledriven, and converted it to JASS for no reason, if you still can plz post it in GUI JASS - easier to read.
Or make it real JASS.

Your condition, p. e. is really weird.
It makes: If not Not any of the players 1-8 is playing or not not not any of the 8 players is playing...
Wich is the same as:
Wether any or none of the players is playing, wich is the same as "true"

why not use this function? much more efficient
JASS:
function Trig_No_1_Player_Actions takes nothing returns nothing
    call DisableTrigger( GetTriggeringTrigger() )
endfunction
A trigger that does nothing but disabling itself - nice.
But it will never disable itself as you allready disable it in its initialisation:
//===========================================================================
function InitTrig_No_1_Player takes nothing returns nothing
set gg_trg_No_1_Player = CreateTrigger( )
call DisableTrigger( gg_trg_No_1_Player )

call TriggerAddAction( gg_trg_No_1_Player, function Trig_No_1_Player_Actions )
endfunction

Why don't you just delete the whole thing? unneeded memory usage, in my eyes. I think you still could invest some time in studying JASS, and then you can post good triggers, at wich we can really help you - as this is what we want to do here!

Greetings, Serra
 
Level 9
Joined
Jul 27, 2006
Messages
652
GUI - > JASS conversions have many flaws. The strange conditions is one of them, and the useless/memory consuming code is another.
The ONLY time its is ok to use GUI - > JASS is when a trigger is first created or when your finding a function name ( always use a native checker to make sure the function is not a useless bj ).
I have no idea why you converted this to JASS, you clearly arnt a JASSer ( the code isnt edited? ) and i still arnt sure what you want?
[offtopic]
You should introduce yourself to the Hive if your planning to stick with us. The introductions section is in the offtopic forum if you are planning to.
Still waiting on answers...
 
Status
Not open for further replies.
Top