Blatantly dysfunctionally TOW function!

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
sysQuik
Corporal
Posts: 25
Joined: Fri Feb 07, 2003 9:54 am

Blatantly dysfunctionally TOW function!

Post by sysQuik »

The "TakeOver" function is documented in the sdk as being able to accept 0,1 or 2 as a value; 2 being neutral. Well if you do set an objective to 2, it doesn't change anything. If the objective is owned by the Axis it will continue to be owned by the Axis. I would have thought that 2 would set the objective to neutral and neither side would have the check mark next to it. Am I missing something here, or is it not possible to set an objective to neutral after a round has begun? If you set the TOW object as neutral in radiant, the map will start without either team owning the objective. Is there anyway to do this during the round? I tried setting the controlledby var, but it's read only.

I think it would be interesting to be able to set objectives so that neither team owns them during a match. It could make for a different game dynamic that I haven't seen before. What do you guys think?

Have a good weekend,
SysQuik
sysQuik
Corporal
Posts: 25
Joined: Fri Feb 07, 2003 9:54 am

Post by sysQuik »

I can see how a neutral team taking over the objective might not cause ownership to change, in which case this isn't a problem with the fuction at all. It still leaves how to change an objective to neutral so that no team is listed as owning it during a match, not just at the start of a round. Do any of you mapping gurus have any ideas? Or a possible direction to turn, like some other resource?

Thank you very much for your help! It is greatly appreciated!

Sysquik
Slyk
Lieutenant Colonel
Posts: 361
Joined: Sun Jul 14, 2002 12:42 am
Location: Elizabethtown, PA

Post by Slyk »

I will try to add some thoughts that might help you. I've been doing a lot with TOW objectives, but mostly implementing them into TDM play as hybrids where both teams fight to 'own' a switch and by doing so they advance their spawns/push the other team back. It is very dynamic and works great...setting them up is a pain sometimes. I have several maps using this logic. Two out now are 'Gun Assault' and 'Streets of Stalingrad-1" I've got two more nearly finished in beta testing and my final Mohaa map sequel to 'GA' coming this month.

Anyway. You'll have to do some scripting work to get the 'neutral' setting to work right. Are you setting up the switches in your 'waittil spawn', like so:

//////////////////////////
level waittill spawn
//////////////////////////


// set the parameters for this round based match
level.bRoundStarted = 0
level.dmrespawning = 1 // 1 or 0
level.clockside = kills // set to axis, allies, kills, or draw
level.dmroundlimit = 20 // round time limit in minutes
level.numObjectives = 5 // Number of objectives needed to win

level.obj1_switch_up = 1 //1=up, 2=down
level.obj2_switch_up = 1 //1=up, 2=down
level.obj3_switch_up = 1 //1=up, 2=down
level.obj4_switch_up = 1 //1=up, 2=down
level.obj5_switch_up = 1 //1=up, 2=down


The 'level.xxxx_up' statement will be the name of your switch entity, which I assume you already know. Set each 'ControlledBy' statement to '2'. Then I'd edit my 'level.xxx_up' statements as such:

level.obj1_switch_up = 3 //1=up, 2=down, 3=neutral

Then when you set up the switch brushes I would make it sort of in the 'middle'. In my maps I use a single brush or group of brushes to be the handle. In your script logic you need something like this:

//----------------------------------------------------------
// TAKE CONTROL OF OBJECTIVE 1 - - AXIS BASE
//----------------------------------------------------------
obj1:
if( parm.other.dmteam == allies )
{
if( $obj1.ControlledBy != 1 )
{
//Flip the switch
thread moveobj1

//Take the objective
$obj1 TakeOver 1

//Update team current objectives
thread set_objectives
}
}
else if( parm.other.dmteam == axis )
{
if( $obj1.ControlledBy != 0 )
{
//Flip the switch
thread moveobj1

//Take the objective
$obj1 TakeOver 0

//Update team current objectives
thread set_objectives
}
}
end

//--------------------------------------------------------------
// Move the switch handle - OBJ1
//--------------------------------------------------------------
moveobj1:
$obj1_switch_trigger nottriggerable
$obj1_switch bind $obj1_switch_origin
if( level.obj1_switch_up == 1 )
{
$obj1_switch_origin speed 1.0
$obj1_switch_origin rotatezdownto 180
$obj1_switch_origin waitmove
$obj1_switch_origin playsound switchbox
level.obj1_switch_up = 2
}
else
{
$obj1_switch_origin speed 1.0
$obj1_switch_origin rotatezupto 0
$obj1_switch_origin waitmove
$obj1_switch_origin playsound switchbox
level.obj1_switch_up = 1
}
$obj1_switch_trigger triggerable
end



Ok, next you should position the switch 'handle' so that it is at a 90 degree angle to the box or whatever it is attached to. UP would be equal to '1' in your statement above or the "rotateupto 0" statement. '2' would be equal to the 'rotatedownto 180' statement. So, your switch, if neutral would start in the '3' or 90 degree position. When the Allies hit it, it would 'rotateupto 0' and if the Axis get it first, it would 'rotatedownto 0'. There after changing by 180 degrees as it will never go back to neutral.

Hope that helps a bit. Once you understand these concepts and if you've got or learn some concepts quickly, you can do a lot of dynamic stuff with your maps. Ask if you don't understand me, hope it helps.
sysQuik
Corporal
Posts: 25
Joined: Fri Feb 07, 2003 9:54 am

Post by sysQuik »

First off, thanks for your response! I like what you've done with the switch animation, quite cool.

I looked through your script and as far as I can tell, the objectives will start the round out as neutral, but then as soon as a team takes an objective, the objective will always be controlledby axis or allies.

What I'm trying to do is have an objective set to neutral during a round, after it has been controlled by an axis or allies. As far as I can tell your level.xxx_up var refers to animating the switch itself. I'd like to be able to control the switch animation, as well as being able to set the objective to neutral. Making it so neither team has a check mark next to the objective, simular to starting a match with controlledby = 2 for the entity, but changing it back to neutral in the middle of the match after a team has previously won the objective. Does that make sense?

So for instance a single switch could make it's obj go to controlledby axis as well as making another obj controlledby neutral. I think this could be very interesting. I would have thought takeover = 2 would do this, but it doesn't change the objective back to neutral after a team has already controlled it.

Thanks again, I really appreciate it!

Sysquik
Slyk
Lieutenant Colonel
Posts: 361
Joined: Sun Jul 14, 2002 12:42 am
Location: Elizabethtown, PA

Post by Slyk »

Well, sounds like what you need to do is allocated for an "=3" statement and and if/else comment. If the switch is going to reset ITSELF to neutral, you would have to script it to do something like:

$obj1_switch rotateupto 90
$obj1_switch_up = 3


then try this adding this next:

$obj1.ControlledBy !=2

Your could try to simplify the numbering by setting your "level.xxx" statements to 0, 1 and 2 so that they correspond to the position AND ownership of the switch. That way if it is '0' then it's Axis control AND in the Axis control position; '1' is Allies and in their control position and '2' is in the neutral switch position of 90 degrees and 'neutral'.

I have never tried that setup, but it looks like it should work out. IF the logic is there to start as 'neutral', then the logic should be there to be SET to 'neutral' once the round starts....should, mind you....no promise there.
sysQuik
Corporal
Posts: 25
Joined: Fri Feb 07, 2003 9:54 am

Post by sysQuik »

The first part about changing the numbering makes sense, but I don't see how $obj1.ControlledBy !=2 would help change the objective back to neutral. Even if it doesn't equal 2, I haven't been able to find away to assign the objective back to neutral after the round has begun.

I agree that there should be a way and the SDK says that TakeOver 2, should work, but it doesn't do anything that I can tell.

Thanks for your input,
Sysquik
Post Reply