• Shoutbox
    Active Users: 0
     
  • Notice: N/A
    Loading...
 
  • Active Users
     
  • There are currently no users chatting.
 
Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 37
  1. #11
    Okay I have added the "nottriggerable" command in the simplest way I know how.
    I gave the trigger_multiple that closes the gate, the targetname of "trigeast_close".
    Then gave the trigger_use (switch) that opens the gate, the target name of "trigeast_open".

    So the east jail part of the script looks like this:

    Code:
    lockeast:
    	$trigeast_close nottriggerable // After any player passes through it
    	$eastgate moveto $eastshut // Gate named "eastgate" move to script_origin named "eastshut"
    	iprintlnbold "Allies jail A is locked"
    	$trigeast_open triggerable // Rest the gate opening trigger, allowing the switch to be toggled
    end
    
    openeast:
    	$trigeast_open nottriggerable // When a player toggles the switch
    	$eastgate moveto $eastopen //  Gate named "eastgate" move to script_origin named "eastopen"
    	iprintlnbold "Allies jail A is unlocked"
    	$trigeast_close triggerable // Rest the gate closing trigger, allowing the gate to be closed again upon trigger
    end
    For lack of a better word, they "offset" (or perhaps "reset") each other.

    BTW, the gates are "script_object"s, just in case anyone was wondering.

    Regardless of how its scripted the bloody gates simply won't move.
    I will try Major's suggestion of deleting and resetting the target names.

  2. #12
    I will take a look at your script you sent later, as I can't access dropbox at work (it's blocked... Friday is slow...) :P. But I can have a go at what it may look like...

    As you like to keep your lines of code to a minimum, you could invest in 'argument passing' or, essentially, parameterising a thread.

    For example, if the code to move a script_object requires more than one line, you can always create a thread like so:

    Code:
    //-------------------------------------------------------------------------------//
    // move jail gate
    // [gate] togglegate [destination] [speed of gate| default is 2]
    //-------------------------------------------------------------------------------//
    togglegate local.dest local.speed:
       
       if (local.speed == NIL) 
          local.speed = 2 //set a default speed
      
       self speed local.speed
       self moveto local.dest.origin
       self waitmove //perhaps wait local.speed instead...
    
    end
    Then when it comes to your current threads do:

    Code:
    lockeast:
    	$trigeast_close nottriggerable 
    	$eastgate waitthread togglegate $eastshut 4 
    	iprintlnbold "Allies jail A is locked"
    	$trigeast_open triggerable // Rest the gate opening trigger, allowing the switch to be toggled
    end
    
    openeast:
    	$trigeast_open nottriggerable // When a player toggles the switch
            $eastgate waitthread togglegate $eastopen 4
    	iprintlnbold "Allies jail A is unlocked"
    	$trigeast_close triggerable // Rest the gate closing trigger, allowing the gate to be closed again upon trigger
    end
    There could be glaring mistakes, but that's the gist! It's good abstracting the code at times as you can reuse it a lot, and also simply copy / paste to other projects that'll benefit from them.

    You can even get your trigger states in there, as long as you keep to your naming conventions (looks like you do, which is a good habit to have, I'm lazy when it comes to naming stuff...):

    Code:
    //-----------------------------------------------------------------------------------------------------//
    // move jail gate
    // [gate] togglegate [destination] [speed of gate| default is 2] [cardinal point] [action]
    //-----------------------------------------------------------------------------------------------------//
    togglegate local.dest local.speed local.point local.action:
       
       $("trig" + local.point + "_" + local.action) nottriggerable
    
       switch (local.action)
       {
       open: 
              local.opposite = close
              break
       close: 
              local.opposite = open
              break
       }
      
       self speed local.speed
       self moveto local.dest.origin
       self waitmove 
    
       $("trig" + local.point + "_" + local.opposite) triggerable
    
    end
    Then for all your gate threads:
    Code:
    
    lockeast:
    	$eastgate waitthread togglegate $eastshut 4 east close
    	iprintlnbold "Allies jail A is locked"
    end
    
    openeast:
            $eastgate waitthread togglegate $eastopen 4 east open
    	iprintlnbold "Allies jail A is unlocked"
    end
    
    locknorth:
    	$northgate waitthread togglegate $northshut 4 north close
    	iprintlnbold "Axis jail A is locked"
    end
    
    opennorth:
    	$northgate waitthread togglegate $northopen 4 north open
    	iprintlnbold "Axis jail A is unlocked"
    end
    This is partly academic obviously, and you may be fully aware of these methods, but this is a public forum so I just post as much detail to reach as many people as possible, myself included. I'm still a novice, especially when compared to some of the big MOHAA coders (or ex-MOHAA coders as most are now).
    Last edited by 1337Smithy; 09-15-2017 at 08:54 PM.

  3. #13
    I took a look at your map and got it to work using both of the methods I discussed in my last comment , with some slight modifications. Seems like you do need more lines, as 'moveto' just didn't seem to work on its own...

    Only managed to look at the gate stuff, had to comment out a load of code so I could run the script. If you get stuck elsewhere let me know.

    First way:

    Open & close threads:
    Code:
    locksouth:
            $trigsouth_close nottriggerable
    	$southgate waitthread togglegate $southshut
    	iprintlnbold "Axis jail B is locked"
            $trigsouth_open triggerable
    end
    
    opensouth:
            $trigsouth_open nottriggerable
    	$southgate waitthread togglegate $southopen
    	iprintlnbold "Axis jail B is unlocked"
            $trigsouth_close triggerable
    end
    Togglegate thread:
    Code:
    //-------------------------------------------------------------------------------//
    // move jail gate
    // [gate] togglegate [destination] [speed of gate| default is 1]
    //-------------------------------------------------------------------------------//
    togglegate local.dest local.speed:
       
    	if (local.speed == NIL) 
    		local.speed = 1  
    	self time local.speed
    	self moveto local.dest.origin
    	self waitmove
        
    end
    Second way...

    Open & close gate threads:
    Code:
    locksouth:
    	$southgate waitthread togglegate $southshut south close
    	iprintlnbold "Axis jail B is locked"
    end
    
    opensouth:
    	$southgate waitthread togglegate $southopen south open
    	iprintlnbold "Axis jail B is unlocked"
    end
    Togglegate thread:
    Code:
    //-----------------------------------------------------------------------------------------------------//
    // move jail gate
    // [gate] togglegate [destination] [cardinal point] [action] [speed of gate| default is 1] 
    //-----------------------------------------------------------------------------------------------------//
    togglegate local.dest local.point local.action local.speed:
       
    	$("trig" + local.point + "_" + local.action) nottriggerable
    	iprintlnbold ("trig" + local.point + "_" + local.action + " set to nottriggerable")
       
    	switch (local.action)
    	{
    	open: 
    		local.opposite = close
    		break
    	close: 
    		local.opposite = open
    		break
    	}
      
    	if (local.speed == NIL)
    		local.speed = 1
    	self time local.speed
    	self moveto local.dest.origin
    	self waitmove 
    
    	$("trig" + local.point + "_" + local.opposite) triggerable
    	iprintlnbold ("trig" + local.point + "_" + local.opposite + " set to triggerable")
    
    end
    Also needed to use 'time' instead of 'speed'.

    If you want it faster or slower, explicitly give the number (in seconds) when calling togglegate.

    E.g.:
    Code:
    $southgate waitthread togglegate $southopen south open 2

    Will email you the map and script, as I just moved the south gate trigger closer so I can watch it move, plus I lowered the origin for south gate a little (may need more) as it was rising. The rest of the threads can be modified to use the togglegate function .
    Last edited by 1337Smithy; 09-15-2017 at 08:51 PM.

  4. #14
    Mate, you're a f'king legend!
    Cheers. I'll check it out.
    I accidentally left my puter on all night and haven't refreshed my inbox. So I didn't see your email until now.

    Thank you, much appreciated.

  5. #15
    Administrator Major_A's Avatar
    Join Date
    Jul 2016
    Location
    Huntington, IN USA
    Posts
    299
    Trophies
    Blog Entries
    14
    Those are soooo helpfull on more than one thing btw!
    Just seeing that solution gave me an idea for something!

    My gosh I love this!
    I think I might have to start a script sharing thread!...when I'm not looking for something to eat of coarse...damn I'm hungry, all the corn dogs are gone...[here chick chick chick] easy pickens...there asleep!
    Just kidding...might make some scrambled eggs on the grill in the iron skillet!

    edit:
    holy sh't, ....no butter...wtf....no bacon grease either! this sucks!
    lots of language coming to mind like this lolololol...pieeeece of monkey sh't HAHAHAHAHAHA
    Clearly I've gone insane LMAO

    Last edited by Major_A; 09-16-2017 at 06:57 AM. Reason: no f'king butter!



  6. #16
    Mate, this guy's blood is worth bottling.
    The South jail gate works flawlessly.
    Thank you 1337Smithy, you are exactly what the remaining mapping community has needed for some time now.
    Much appreciated.

    Major: Your blood is worth bottling too, just on a different level such as to pickle meats and fruit or perhaps to remove oil stains from garage floors and driveways. lol

  7. #17
    Haha, looking at Major's reply, his blood would do more than clean a garage floor - it'd melt the concrete. You weren't born out of a rib cage, were you, Major? :P

    But thanks!

  8. #18
    1337Smithy: I've applied your south gate script changes to the other three gates.
    I also gave similar target names to the other triggers.
    I noticed that the triggers repeated (at least twice with every passing) so I gave them the "wait 10" property, added a bit more to their threads and disabled the temp lines you added for debugging.

    Code:
    locksouth:
    	if( parm.other.dmteam == axis)
    	{
    	$trigsouth_close nottriggerable
    	$southgate waitthread togglegate $southshut south close
    	iprintlnbold "Axis jail B is locked"
    	$trigsouth_open triggerable
    	}
    end
    
    opensouth:
    	if( parm.other.dmteam == axis)
    	{
    	$trigsouth_open nottriggerable
    	$southgate waitthread togglegate $southopen south open
    	iprintlnbold "Axis jail B is unlocked"
    	$trigsouth_close triggerable
    	}
    end
    So now only the axis trigger the North and South (open & close) triggers once only.
    And only the allies trigger the East and West (open & close) triggers once only.

    Yeah I was 4 units too high with the script_origins. Not a bad guess as the gates never worked at the time.
    I actually lowered the height of the gates by 8 units (before sending it to you) because they were visible from parts of the map I didn't want to see them.
    They would have been spot-on had I remembered to change the script_origins height too. lol
    All in all I am stoked with the results.

    I still couldn't have done it without your know how.

  9. #19
    That's unusual that they repeated on a single pass as I would have thought the inherent 'wait' that triggers have would be enough for the 'nottriggerable' to kick in. How did you find out they were repeating?

    If you're setting the trigger states at a higher level (on the gate threads) then you can just use my smaller function I commented out in your script :).

    Btw, did you manage to get your flags to hide?

    Edit:

    Just checked and the flags do hide, I think it's just your script wasn't loading before due to some other issue :).

    I'll take the time, seeing as this is a thread for sharing code, to provide another more autonomous method for doing the hide.

    Code:
    prepflags:
    	thread hide_flags allies
    	thread hide_flags axis
    end
    Code:
    //------------------------------------------------------------//
    // Hides flags for a team. Compose flag 
    // names of {teamname}_flag{number} 
    // hide_flags [team] 
    //------------------------------------------------------------//
    hide_flags local.team:
    	for (local.i=1;local.i;local.i++)                                     //start at 1 ; loop infinitely ; increment each loop
    	{
    		if !($(local.team + "_flag" + local.i) == NULL)      //if the current flag exists - could use != also
    			$(local.team + "_flag" + local.i) hide           //hide the existing flag
    		else                                                                 //flag doesn't exist
    			end                                                         //exit the thread - if you needed to do anything after the for loop but inside the thread, use 'break', which exits the loop
    	}
    end
    It isn't a problem on your map as you don't have that many things to hide, but it's worth showing anyway!
    Last edited by 1337Smithy; 09-16-2017 at 02:53 PM.

  10. #20
    Shit mate, sorry. I was only using the hide / show calls because I couldn't get the flags to move. lol
    I will try to raise and lower the flags using a similar method you wrote for the gates.
    I originally had a waypoint at the desired flag height and another under the ground (at all 4 poles).
    But when they didn't work I deleted them and the ground brush before texturing the bottom of skybox as the ground and raising it.

    The only thing not working now is the TOW objectives count.
    I'm sure I could find another TOW map as an example but by all means if you want to exercise your brain cells further then go for it.
    I've already added your name to the credits.

    As they say, "use it or lose it". Well I lost so long ago I forget what "it" was. lol

    As for the triggers repeating, they happened in game... when I triggered them. lol
    Both the trigger_multiple to close the gates and the trigger_use to open them would make the click sound twice and print on screen twice.
    If I walked back and forth through the multiple it would just continue double-clicking.
    Maybe I wasn't holding my tongue on the right side of my mouth when I duplicated stuff?
    No biggie, it was an easy fix.

    I'm off to bed now. As happy as a pig in shite.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •