• Shoutbox
    Active Users: 0
     
  • Notice: N/A
    Loading...
 
  • Active Users
     
  • There are currently no users chatting.
 
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1

    Anyone here up to speed with creating TOW objectives?

    G'day,
    I have tried to follow the Tug of War Tutorial found in the Spearhead Radiant "SDK\tutorials" folder.
    To me it sounded like I had to change my script_objects to func_TOWObjectives but that just turned ugly real fast. lol

    I have 4 flagpoles each with an allies flag and an axis flag that are script_objects.
    They are all supposed to hide upon pre-spawn. They did at one point but currently don't.
    When a player hits the trigger at any given flagpole the player's team flag is shown.
    If the opposing team flag was showing prior to the player triggering it that team flag would now be hidden.

    I had this working (to a degree) in the very earliest stages of the script but as I included more scripting it killed everything.
    The inclusions were to ensure that the correct flag was shown for the respective team player at the flagpole trigger.

    I have something like this X4 (times four) flagpoles.

    Code:
    flagpole1:
    	$flag_pole1 nottriggerable
    	if( parm.other.dmteam == allies)
    	{
    		if( $Obj_pole1.ControlledBy == 2)
    		{			
    			$Obj_pole1 TakeOver 1	
    			level.numAlliedObjectives--
    		}
    		if( $Obj_pole1.ControlledBy == 0)
    		{			
    			$Obj_pole1 TakeOver 1				
    			level.numAxisObjectives++
    			level.numAlliedObjectives--
    		}
    		$axis_flag1 hide
    		$allies_flag1 show
    		iprintlnbold "Allies Control Base 1"
    	}
    	else if( parm.other.dmteam == axis)
    	{
    		if( $Obj_pole1.ControlledBy == 2)
    		{			
    			$Obj_pole1 TakeOver 0				
    			level.numAxisObjectives--
    		}
    		if( $Obj_pole1.ControlledBy == 1)
    		{			
    			$Obj_pole1 TakeOver 0				
    			level.numAxisObjectives--
    			level.numAlliedObjectives++
    		}
    		$allies_flag1 hide
    		$axis_flag1 show
    		iprintlnbold "Axis Control Base 1"
    	}
    	//Update team current objectives
    	thread set_objectives
    	waitthread Check_End_Match
    	$flag_pole1 triggerable
    end
    This was the best I could make of limited tutorials on the subject.

    Any help would be greatly appreciated (including your name in the credits) plus you'll be a part of history creating the very first Capture The Flag, Tug Of War, LIBeration map all rolled into one.
    Not only that but I'll put you down for 5 X $20 tickets to the "Get AccA Drunk" raffle.
    All entries include a "lucky door prize"
    (to the value equal to or less than a few beers.
    Tickets are not refundable or redeemable under pisshead law section RU18, subsection 21inUSA)


    Cheers.

  2. #2
    Okay I've found that the flagpole script I posted below actually works well.
    The problem was / is either in the initiate objectives part or set objectives. It seems odd to me to have both but they're just thread names.


    Code:
    init_objectives:
    	$Obj_pole1.ControlledBy == 2)
    	$Obj_pole2.ControlledBy == 2)
    	$Obj_pole3.ControlledBy == 2)
    	$Obj_pole4.ControlledBy == 2)
    end
    
    set_objectives:	
    	//First lets do the allies
    	if( $Obj_pole1.ControlledBy == 1)
    	{			
    		$Obj_pole1 SetCurrent 1
    	}	
    	else if( $Obj_pole2.ControlledBy == 1)
    	{
    		$Obj_pole2 SetCurrent 1
    	}
    	else if( $Obj_pole3.ControlledBy == 1)
    	{	
    		$Obj_pole3 SetCurrent 1
    	}
    	else if( $Obj_pole4.ControlledBy == 1)
    	{
    		$Obj_pole4 SetCurrent 1
    	}
    
    	//Now the Axis	
    	if( $Obj_pole1.ControlledBy == 0)
    	{			
    		$Obj_pole1 SetCurrent 0
    	}
    	else if( $Obj_pole2.ControlledBy == 0)
    	{
    		$Obj_pole2 SetCurrent 0
    	}
    	else if( $Obj_pole3.ControlledBy == 0)
    	{	
    		$Obj_pole3 SetCurrent 0
    	}
    	else if( $Obj_pole4.ControlledBy == 0)
    	{
    		$Obj_pole4 SetCurrent 0			
    	}	
    end
    I've tried a process of elimination (disabling one part at a time) and both cause problems with the rest of the script.

  3. #3
    Have you tried checking the console (scroll up near top)? You'll find the offending code that will be breaking the script.

    I did notice you had some parts that broke it e.g. 'thread debugtext' because there was no debugtext thread in the code. Make sure the script is loading as everything else will be failing (e.g. flags not hiding etc).

    Should

    Code:
    init_objectives:
    	$Obj_pole1.ControlledBy == 2)
    	$Obj_pole2.ControlledBy == 2)
    	$Obj_pole3.ControlledBy == 2)
    	$Obj_pole4.ControlledBy == 2)
    end
    Be

    Code:
    init_objectives:
    	$Obj_pole1.ControlledBy = 2
    	$Obj_pole2.ControlledBy = 2
    	$Obj_pole3.ControlledBy = 2
    	$Obj_pole4.ControlledBy = 2
    end
    And even then, ControlledBy is readonly so it can't be set. Do you need this thread?

    You need to populate the 'level.gametype' variable too:
    Code:
            //If this is a tug of war game then we init all the TOW stuff	   
    	level.gametype = int( getcvar( g_gametype ) )
    	if( level.gametype == 5 )
    	{
    		//init the objectives
    		//thread init_objectives
    		
    		//Setup the team objectives	
    		thread set_objectives
    
    		level.bRoundStarted = 1
    	}
    For set_objectives you can use a loop if you wish, but not required:
    Code:
    set_objectives:
    	for (local.i=1;local.i;local.i++)
    	{			
    			local.flagpole = $("Obj_pole" + local.i)
    			if !(local.flagpole == NULL)
    			{
    				local.controlledby = local.flagpole.ControlledBy
    				switch (local.controlledby)
    				{
    					case 0:
    						local.flagpole SetCurrent 0 //do these need swapping? e.g. .ControlledBy == 0 so SetCurrent = 1 ???
    					case 1:
    						local.flagpole SetCurrent 1
    				}				
    			}
    			else
    				break
    	}
    end
    Just to confirm, the 'obj_flagpoles' are func_TOWObjectives?
    Last edited by 1337Smithy; 09-16-2017 at 06:45 PM.

  4. #4
    Sorry mate, I was totally lost with trying to follow the tutorial, had a few too many birthday beers with my family yesterday.
    I have looked at the tut again just now and I think I am closer to understanding it.

    First off, I have to make func_TOWObjectives by right-clicking the 2D grid without anything selected.
    That's where I got it wrong on my earlier attempt.
    I've done that and entered the value as instructed then linked the TOWObjective to the flagpole trigger.

    Although the lines:
    Code:
    $Obj_pole1.ControlledBy == 2 )

    Were written correctly the way I had them, they shouldn't have been there as you've pointed out.
    They are indeed read only that require the "IF" statement.
    I just couldn't see where the initial Controlledby fitted in with everything.
    I now see that it is a part of the TOWObjective properties entered by the Entity window. Sorry about that.

    I will add TOWObjectives to the remaining three poles and take another look at the script side of things again.

    This morning cup of coffee has magical powers. lol
    Last edited by AccadaccA; 09-16-2017 at 09:58 PM.

  5. #5
    Shit mate, we are so close.
    I've added the func_TOWObjectives and given them target names as they are written in the script:
    $Obj_pole1, $Obj_pole2, $Obj_pole3 & $Obj_pole4.

    I also added the rest of the TOWObjective properties as directed by the tut.

    I added the line you mentioned:
    Code:
    level.gametype = int( getcvar( g_gametype ) )
    I don't know how I missed that one.

    Everything is looking sharp. I can see the light at the end of the tunnel and its not far away.
    I'm almost too scared to add the "set-objectives" in case I break something. lol

    If at all possible, I want all flag poles to be neutral at the start (Controlledby = 2).

  6. #6
    Good to hear! Are they set to neutral in Radiant? What is their default state?

    I haven't looked at any tutorials for TOW stuff so I don't know for sure about set_objectives portion, but I'm sure it's easily modified.

  7. #7
    Yes, they are all "Key"= Controlledby and "Value" = 2
    The SDK folder of SH Radiant has a TOW tutorial.

    I'm about to send you another email with the link of the latest map and script.
    I tried to work with the flags; lower (prior to hide) and raise (after show) but the buggers are still ignoring me. lol

  8. #8
    Haha, OK. Will take a look tomorrow. You're nearly there!

    Time for bed

  9. #9
    Just a quick note before I go to bed.
    I thought to add it here rather than in an email to you (1337Smithy) in case it can help others.

    The map ends properly when the objectives are completed by adding two lines.

    In the thread
    Check_End_Match:


    First omit the lines:
    //thread AlliesWon & //thread AxisWon
    Because we don't have those threads.

    and replace them with:
    "teamwin allies" & "teamwin axis"
    This way when all required objectives are completed it shows the scores then starts the game over again.

    Unless of course you want to write up something different in threads.
    Last edited by AccadaccA; 09-18-2017 at 01:10 PM.

  10. #10
    OK, cool.

    I didn't have time to check much of the code around the objectives logic so didn't have anything in mind . Well done getting it working!

Posting Permissions

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