Scripting for Returnable Obj


(Benfun7) #1

Hi,

I have a team ctf red flag in my map. And I have two trigger_flagonly_multiple entites. Is it possible to make is so the team that gets the object and takes it back to there trigger_flagonly_multiple entite wins?

Thanks,
Fritz


(kAzmEr) #2

Have you tried goldrush.script? There is a good script about this, if I remember good…


(Benfun7) #3

Ok, thanks… I think i figured it out.


(nUllSkillZ) #4

Ifurita has also written a tutorial about it:
http://www.planetwolfenstein.com/4newbies/objective.htm


(Ifurita) #5

The way I read the original post was that he wanted a single objective, that either side could grab and return to their ‘base’ for the win. You could try checking both spawn flags on the objective entity and see if both teams can grab it. If you can, then the scripting should be pretty easy


(Benfun7) #6

I just went ahead and set up a flag for both teams. That were righ next to eachother.

Thanks.
Fritz


(Smeltman) #7

i made this script for both teams. but the script wont work its says script ended line … and it is really the end i alsready but a script_multiplayer with scriptname game_manager… but it just wont work here’s the script…:

game_manager
{
spawn
{
// Set scenario information

	wm_axis_respawntime		15
	wm_allied_respawntime		15
	wm_set_round_timelimit		30
	wm_number_of_objectives		4


	// accum 0 holds status of each flag as a bit
	// capped = set, not capped = reset
	accum 0 set 0
	accum 1 set 0

	// If the round timer expires, no one has won
	// Set the round winner:  0 == AXIS, 1 == ALLIED
	wm_setwinner -1

}

trigger add_axis_goldbar
{
	accum 0 inc 1

	trigger game_manager axis_secured

	wm_teamvoiceannounce 0 "axis_hq_objective_captured"
	wm_teamvoiceannounce 1 "allies_hq_objective_captured"

	trigger gold_axis_full_1 show
	trigger gold_axis_trans_1 hide

	accum 0 abort_if_less_than 2

	trigger gold_axis_full_2 show
	trigger gold_axis_trans_2 hide

	accum 0 abort_if_less_than 3

	trigger gold_axis_full_3 show
	trigger gold_axis_trans_3 hide

	trigger game_manager axis_win				
}

trigger axis_secured
{
	accum 0 trigger_if_equal 1 game-manager axis_secured1
	accum 0 trigger_if_equal 2 game_manager axis_secured2
	accum 0 trigger_if_equal 3 game_manager axis_secured3
}

trigger axis_secured1
{
	wm_announce "Axis team has secured the first Gold Crate!"
}

trigger axis_secured2
{
	wm_announce "Axis team has secured the second Gold Crate!"
}
	
trigger axis_secured3
{
	wm_announce "Axis team has secured the last Gold Crate!"
}

trigger add_allies_goldbar
{
	accum 1 inc 1

	trigger game_manager allies_secured

	wm_teamvoiceannounce 0 "axis_hq_objective_captured"
	wm_teamvoiceannounce 1 "allies_hq_objective_captured"

	trigger gold_allies_full_1 show
	trigger gold_allies_trans_1 hide

	accum 1 abort_if_less_than 2

	trigger gold_allies_full_2 show
	trigger gold_allies_trans_2 hide

	accum 1 abort_if_less_than 3

	trigger gold_allies_full_3 show
	trigger gold_allies_trans_3 hide

	trigger game_manager allies_win					
}

trigger allies_secured
{
	accum 1 trigger_if_equal 1 game_manager allies_secured1
	accum 1 trigger_if_equal 2 game_manager allies_secured2
	accum 1 trigger_if_equal 3 game_manager allies_secured3	
}

trigger allies_secured1
{
	wm_announce "Allied team has secured the first Gold Crate!"
}

trigger allies_secured2
{
	wm_announce "Allied team has secured the second Gold Crate!"
}

trigger allies_secured3
{
	wm_announce "Allied team has secured the last Gold Crate!"
}

trigger allies_win
{
	wm_setwinner	1

	wait 1500
	wm_endround
}

trigger axis_win
{
	wm_setwinner	0

	wait 1500
	wm_endround
}

}

gold_axis_full_1
{
spawn
{
setstate gold_axis_full_1 invisible
}

trigger show
{
	setstate gold_axis_full_1 default
}

}

gold_axis_full_2
{
spawn
{
setstate gold_axis_full_2 invisible
}

trigger show
{
	setstate gold_axis_full_2 default
}

}

gold_axis_full_3
{
spawn
{
setstate gold_axis_full_3 invisible
}

trigger show
{
	setstate gold_axis_full_3 default
}

}

gold_axis_trans_1
{
spawn
{
setstate gold_axis_trans_1 default
}

trigger hide
{
	setstate gold_axis_trans_1 invisible
}

}

gold_axis_trans_2
{
spawn
{
setstate gold_axis_trans_2 default
}

trigger hide
{
	setstate gold_axis_trans_2 invisible
}

}

gold_axis_trans_3
{
spawn
{
setstate gold_axis_trans_3 default
}

trigger hide
{
	setstate gold_axis_trans_3 invisible
}

}

gold_allies_full_1
{
spawn
{
setstate gold_allies_full_1 invisible
}

trigger show
{
	setstate gold_allies_full_1 default
}

}

gold_allies_full_2
{
spawn
{
setstate gold_allies_full_2 invisible
}

trigger show
{
	setstate gold_allies_full_2 default
}

}

gold_allies_full_3
{
spawn
{
setstate gold_allies_full_3 invisible
}

trigger show
{
	setstate gold_allies_full_3 default
}

}

gold_allies_trans_1
{
spawn
{
setstate gold_allies_trans_1 default
}

trigger hide
{
	setstate gold_allies_trans_1 invisible
}

}

gold_allies_trans_2
{
spawn
{
setstate gold_allies_trans_2 default
}

trigger hide
{
	setstate gold_allies_trans_2 invisible
}

}

gold_allies_trans_3
{
spawn
{
setstate gold_allies_trans_3 default
}

trigger hide
{
	setstate gold_allies_trans_3 invisible
}

}

axis_gold_flag
{
death
{
trigger game_manager add_axis_goldbar
}
}

allied_gold_flag
{
death
{
trigger game_manager add_allies_goldbar
}
}

axis_gold_crate
{
spawn
{
accum 0 set 0 // gold counter
}

trigger stolen
{
	setstate axis_gold_crate invisible
}

trigger secured
{
	setstate axis_gold_crate default
}

trigger returned
{

}

//--------------------------------------------------------------------
//-------------------- FENCE --------------------------------------
//--------------------------------------------------------------------
fence // scriptname in func_constructible
{
spawn
{
wait 400

	// targetname "fence" of func_constructible
	trigger ramp setup

	// Sets the type of destructionclass of the contruction, 1 grenade, 2 satchel, 3 dynamite
	constructible_class 2
}

trigger setup
{
	// targetname "build_fence" of func_static
	setstate build_ramp default
	
	// targetname "fence" of func_constructible
	setstate ramp invisible
}

buildstart final
{
	// targetname "build_fence" of func_static		
	setstate build_fence default
	
	// targetname "fence" of func_constructible		
	setstate ramp underconstruction
}

built final
{
	// targetname "build_fence" of func_static		
	setstate build_fence invisible
	
	// targetname "fence" of func_constructible
	setstate ramp default

	// message to all players
	wm_announce "The fence has been built."
}

decayed final
{
	// targetname "build_fence" of func_static		
	setstate build_fence default
	
	// targetname "fence" of func_constructible
	setstate ramp invisible
}

death
{
	// targetname "build_fence" of func_static
	setstate build_ramp default 
	
	// targetname "fence" of func_constructible
	setstate fence invisible 

	// message to all players
	wm_announce "The fence has been destroyed."
}

trigger remove
{
	// targetname "fence_toi" of trigger_objective_info
	setstate fence_toi invisible
	
	// targetname "build_fence" of func_static
	setstate build_fence invisible
	
	// targetname "fence" of func_constructible
	setstate fence invisible

remove
    }

}

fence
{
spawn
{
wait 200

constructible_class 2
}

death
{

wm_announce “^2axis have destroyed the fence!”

}
//--------------------------------------------------------------------
//-------------------- FENCE2 --------------------------------------
//--------------------------------------------------------------------
fence2 // scriptname in func_constructible
{
spawn
{
wait 400

	// targetname "fence2" of func_constructible
	trigger fence2 setup

	// Sets the type of destructionclass of the contruction, 1 grenade, 2 satchel, 3 dynamite
	constructible_class 2
}

trigger setup
{
	// targetname "fence2_materials" of func_static
	setstate build_ramp default
	
	// targetname "fence2" of func_constructible
	setstate fence2 invisible
}

buildstart final
{
	// targetname "fence2_materials" of func_static		
	setstate fence2_materials default
	
	// targetname "fence2" of func_constructible		
	setstate fence2 underconstruction
}

built final
{
	// targetname "fence2_materials" of func_static		
	setstate fence2_materials invisible
	
	// targetname "fence2" of func_constructible
	setstate fence2 default

	// message to all players
	wm_announce "The fence has been built."
}

decayed final
{
	// targetname "fence2_materials" of func_static		
	setstate fence2_materials default
	
	// targetname "fence2" of func_constructible
	setstate fence2 invisible
}

death
{
	// targetname "fence2_materials" of func_static
	setstate fence2_materials default 
	
	// targetname "fence2" of func_constructible
	setstate fence2 invisible 

	// message to all players
	wm_announce "The fence has been destroyed."
}

trigger remove
{
	// targetname "fence2_toi" of trigger_objective_info
	setstate fence_toi invisible
	
	// targetname "build_fence" of func_static
	setstate build_fence invisible
	
	// targetname "fence2" of func_constructible
	setstate fence2 invisible

remove
    }

}

fence2
{
spawn
{
wait 200

constructible_class 2
}

death
{

wm_announce “^2allies have destroyed the fence!”

}
}


(EB) #8

OK…what number does it give you ?


(Smeltman) #9

is says something with error “}” script ended expected line 527


(EB) #10

You need a closing } at the end of ‘fence’

also, at the //------------ ‘parts’
place a space between // and the ---------

If it gives you an error like this, count the lines and find your error.


(Smeltman) #11

u mean fence 1 or fence 2 ??? can u fix the script and paste it again please because i dont understand really …


(Smeltman) #12

then when i fixed that it says unknown command : Fence


(Smeltman) #13

i fixed what u said but i says again script ended and stuff like that … it sucks making a script !!! :angry:


(EB) #14

you need to slow down and learn it.

You have alot of mistakes:

1 of them:
fence
{
spawn
{
wait 200

constructible_class 2
}

death
{

wm_announce “^2axis have destroyed the fence!”

}

} <<<<< this is the thing you needed

  1. you have 2 fence “2” 's

Go to Ifurita’s scripting tutorial and spend the afternoon learning, rather than waste time with nasty quick fixes.


(Smeltman) #15

but in the tutorial it is a PDF file i dont know where to open it with :S


(EB) #16

get the adobe reader, it is free…

Click Here


(CooperHawkes) #17

you dont know how to open pdf files? how did you survive the internet in the past? :-o

get acrobat reader:
http://www.adobe.com/support/downloads/product.jsp?product=10&platform=Windows

Edit:

oops… seems like EB was faster than me


(EB) #18

I just got lucky, Cooper. Lucky with a whole lotta’ speed and quickness…hehehe… :stuck_out_tongue: