help me please


(nikita) #1

whats wrong in this script cause i am not good at making victory script please help me

game_manager
{

wm_objective_status 1 1 0
wm_objective_status 1 0 0
wm_objective_status 2 1 0
wm_objective_status 2 0 0

wm_set_main_objective 3 1
wm_set_main_objective 3 1
{
//game rules
wm_axis_respawntime 15
wm_allies_respawntime 15
wm_number_of_objectives 2
wm_set_round_timelimit 15
}
}

//objectives
//1:Primary1 : Destroy the 1st tower
//2:Primary2 : Destroy the 2nd tower
//3:Secondary1 : destroy the towers passage
//3:Secondary2 : Destroy the axis passage to tower 2

game_manager
{
spawn
{

wm_mapdescription “Destroy the towers passages and the axis towers”

//we have 2 objectives, destroy the 1st and 2nd tower:
wm_set_objective_status 1 0
wm_set_objective_status 2 0
wm_set_objective_status 3 0

wm_set_defending_team 0
wm_setwinner 0

}
}

game_manager
{
spawn
{
}

trigger objective_counter
{
accum 1 inc 1
trigger game_manager checkgame
}

trigger checkgame
accum 1 abort_if_not_equal 2

wm_setwinner 0
wait 1500

wm_endround
}

}

tower1
{
spawn
wait 200
constructible_class 3
}

death
{

wm_announce “allies have destroyed the 1st tower”
sebstate tower invisible
trigger game_manager objective_counter
}
}

tower2
{
spawn
{
wait 200
constructible_class 3
}

death
{

wm_announce “Allies have the destroyed the 2nd tower”
sebstate tower2 invisible
trigger game_manager objective_counter
}
}


(Schaffer) #2

OK, that script is a real mess!

Dump it and start again. You dont have a mtaching number of start and end braces ({}). There are 12 start braces and 14 end braces. You have three seperate game managers there. I’ve never written a script myself but this looks SO wrong. Dump it and try again.


(Ifurita) #3

So far you’ve told me that all links I’ve given to you were too complicated and you wanted someone to show you step-by-step how to do it (e.g., write it for you). Sorry, I can’t help out here.


(nikita) #4

but i did this script by fellowing ur tutorial iffy:(


(nUllSkillZ) #5

You should start with easy scripts.
And try to understand them.

What do you want to achieve with the above script?
What are the ending conditions of your map?
Which team is offensive / which one defensive?

There has to be only one “game_manager”-sciptblock in the whole script.
You need a scriptblock for every entity the players can interact with.
For example if you want that two things in your maps should be destroyable you need two scriptblocks for the two func_explosive entities (and of course one game_manager-scriptblock).


game_manager
{
	// ...
}

func_explosive_entity_1_scriptname
{
	// ...
}

func_explosive_entity_2_scriptname
{
	// ...
}

(DWM|Commando) #6

look thought the LDR and read up on scripting i learned alot from it and created my script like that. I havnt teste it but i think it’s good. Read to find out what everything does so you’ll know if ur missing anything or if you have un-needed parts


(nUllSkillZ) #7

Try the following script.
It’s for allies attacking / axis defending.
Allies have to destroy two towers with dynamite.

Try to read Ifurita’s Scripting Tutorial.
It’s very well written.

game_manager
{
	spawn
	{
		//game rules
		// spawntime of axis in seconds
		wm_axis_respawntime 15
		// spawntime of allies in seconds
		wm_allies_respawntime 15

		// No. of objectives
		wm_number_of_objectives 2
		// timelimit in minutes
		wm_set_round_timelimit 15

		// No. of primary objectives (<No.> <Team>)
		// Team: 0 = Axis | 1 = Allies
		wm_set_main_objective 1 0
		wm_set_main_objective 1 1
		wm_set_main_objective 2 0
		wm_set_main_objective 2 1

		// wm_objective_status <objective> <team> <status (0=neutral 1=complete 2=failed)
		wm_objective_status 1 0 0
		wm_objective_status 1 1 0
		wm_objective_status 2 0 0
		wm_objective_status 2 1 0

		// sets the team that is defending in stopwatchgamemode
		wm_set_defending_team 0

		// sets the winner if timelimit is hit
		wm_setwinner 0

		// sets the accum (=varaible) No. 1 to 0
		// this accum will hold the No. of fullfilled objectives
		accum 1 set 0

		wait 1500
	}

	// counts the No.'s of objectives that have been fullfilled
	trigger objective_counter
	{
		// adds 1 to the accum No. 1
		accum 1 inc 1

		// calls the checkgame event of the game_manager scriptblock
		trigger game_manager checkgame
	}

	// checks if the winning conditions are fullfilled
	trigger checkgame
	{
		// ends if accum 1 is not 2
		accum 1 abort_if_not_equal 2

		// sets the winner: 0 = AXIS WIN | 1 = Allies WIN
		wm_setwinner 1

		// wait 1500

		// ends the round / map
		wm_endround
	}
}

// first func_explosive (scriptname = tower1)
tower1
{
	spawn
	{
		wait 200
		constructible_class 3 // 3 = dynamit / 2 = satchel charge
	}

	death
	{
		// prints a message to the screen
		wm_announce "allies have destroyed the 1st tower"

		// sets the objective status
		// first objective, team axis, failed
		wm_objective_status 1 0 2

		// first objective, team allies, success
		wm_objective_status 1 1 1

		// sets the tower invisible (I think it's not really necessary)
		setstate tower invisible

		// calls the objective_counter event of the game_manager scriptblock
		trigger game_manager objective_counter
	}
}

tower2
{
	spawn
	{
		wait 200
		constructible_class 3
	}

	death
	{

		wm_announce "Allies have the destroyed the 2nd tower"
		wm_objective_status 2 0 2
		wm_objective_status 2 1 1
		setstate tower2 invisible
		trigger game_manager objective_counter
	}
}

(DAbell) #8

Hey Nikita just to show that i’m not an ignorant bar steward.

I think this is roughly what your script should look like, there are so many things that could be wrong if it doesn’t work.

game_manager
{
	spawn
	{
		remapshaderflush
		
		// Game rules
		wm_axis_respawntime	20	
		wm_allied_respawntime	20
		wm_number_of_objectives	2	
		wm_set_round_timelimit	30

		// Objectives
		//1 Destroy first tower
		//2 Destroy second tower
		
		
		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_objective_status 1 0 0
		wm_objective_status 1 1 0
		wm_objective_status 2 0 0
		wm_objective_status 2 1 0
		
		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	0

		// Winner on expiration of round timer (0=Axis, 1=Allies, -1=no winner at expiration)
		wm_setwinner	0 //Assumes axis defending

		wait 2000
	}

	trigger objective_counter //Counts Allied objectives completed
	{
	accum 1 inc 1
	trigger game_manager checkgame
	}

	trigger checkgame
	{
	accum 1 abort_if_not_equal 2
	wm_setwinner 1
	wait 4000

	wm_endround
	}

}

/
// First Tower Stuff

tower1
{
	spawn
	{
		wait 200
		constructible_class 3
	}
	death
	{
		wm_announce "Allies have destroyed the first tower"

		setstate tower1 invisible

		wm_objective_status 1 0 2
		wm_objective_status 1 1 1

		trigger game_manager objective_counter
	}
}

// Second Tower Stuff

tower2
{
	spawn
	{
		wait 200
		constructible_class 3
	}
	death
	{
		wm_announce "Allies have destroyed the second tower"

		setstate tower2 invisible

		wm_objective_status 2 0 2
		wm_objective_status 2 1 1

		trigger game_manager objective_counter
	}
}

This won’t just work for you because there are some titles for your towers that won’t be right but it will give you something to look at.

If it is completely wrong what i’m telling you i apologise in advance.

<DJ>


(EB) #9

Nikita, rome wasn’t built in a day and these guys sound like they want to help you…I suggest being really patient with yourself. :nod:


(nikita) #10

i am sorry but its just gd hard i am :banghead:

rome didnt have a g script error that wouldnt let them keep working :???:


(Ifurita) #11

but a simple search on this forum would tell you what causes a g_script error and you could fix it with a little effort.


(nikita) #12

if i make the map works and i blow the towers its saying
Warning sebstats set and not found
Warning Entilty used itself… any idea?


(Ifurita) #13

for starters, it’s SETstate


(nikita) #14

TY IFFY NOW I FIGURE OUT THE PROBLEM :cry:


(nikita) #15

I have tried every tutoriial script from pak0 or anything i still get the scriptline error

can some1 help me

there are only 2 integers 4 towers

allies attacking axis defenting

tower2 = 2nd tower
tower3 = 1st tower

game_manager
{
spawn
{
}

trigger objective_counter
{
accum 1 inc 1
trigger game_manager
}

trigger checkgame
{
accum 1 abort_if_not_equal 2

wm_setwinner 0
wait 1500

wm_endround

//tower 1 stuff
tower2
{
spawn
{
wait 200
constructible_class 3
}

death
{
wm_announce “^iThe allies have destroy the first tower”
wm_objective_status 1 0 2
wm_objective_status 1 1 1
setstate tower2 invisible
trigger game_manager objective_counter
}
}

//tower 2 stuff
tower3
{
spawn
{
wait 200
constructible_class 3
}

death
{
wm_announce “^iAllies has destroyed the second tower”
wm_objective_status 2 0 2
wm_objective_status 2 1 1
setstate tower3 invisible
trigger game_manager objective_counter
}
}

trigger victory
{
	wm_announce	"Allies have destroyed the two towers, cheers"
	wm_objective_status 2 0 2 
	wm_objective_status 2 1 1
	wm_setwinner 1
	wait 1000
	wm_endround
}

(Ifurita) #16

Of course you already checked and discovered that you have two more { than } right?


(nikita) #17

i found only 1 iffy


(EB) #18

I hope that this is wearing on you in a good way Nikita…the concept of mapping is not easy especially when all that it contains is unbeknownst by you.
Baby steps is the best way, fully learn 1 aspect and then move to the next.

I think it would be best to re-read Iffy’s scripting tutorial and make notes for yourself as you file through. Remember key things such as routines and their subroutines along with how they interact. Also that an entity may be scripted by it’s own name or correlated through associated scripting.

“game_manager” as an example for scripting:
Every script has to start with “game_manager” <<this would be a (main)routine.
After the start of a routine you will need a “{” to inform the engine of upcoming code.
Then the word “spawn” appears to alert the game-engine to create the value/entity/(many names here).
Another “{” alerts it for any preset values you would like for the game to start the entities value to have…(including accums or constructible level or even the ability to trigger another scripts subroutine/scripting.
Then a “}” closes this area off and alerts the game that anything following that bracket will be of the same setup/or the continuation of the main-scripts subroutines…etc. etc.
Another “}” would close this routine and it’s subroutines(if any)to and end and alert the game to the fact that all of the code between the main routine’s name and the closing bracket is the only code coinciding to that direct portion of scripting.
Knowing all about the brackets is a crucial play in scripting. 1 too many or 1 too few and u’ll get and error…as u know.

An easy finish to game_manager scripting would be like the following:

game_manager
{
	spawn
	{
		
	
// Game rules
		wm_axis_respawntime	"5"         // respawn times
		wm_allied_respawntime	"5"       // respawn times
		wm_set_round_timelimit  "16"    // time limit

                // Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	0

		// Winner on expiration of round timer (0=Axis, 1=Allies)
		wm_setwinner	0

		// If the round timer expires, the Axis have won, so set the current winning team
		// Set the round winner:  0 == AXIS, 1 == ALLIED
	

	}  
}

notice the brackets and how they introduce a section of script and close the section also.
Subroutines are close to the same setup…just look at a larger script setup for example.
*I hope this sheds a little light on this for you. - It makes sense to me as I read it…but I tend to shorthand things sometimes.


(nikita) #19

EB ty very much i also did as iffy told me and now the game load up but seems 2 be the towers not exploding now

i removed =

game_manager
{
spawn
{
}
}

tower3
{
spawn
{
wait 200
constructible_class 3
}
death
{
wm_announce “^iThe Allies team has destroyed the 1st Tower!”
}
}

and replaced by

//tower 1 stuff
tower3
{
spawn
{
wait 200
constructible_class 3
}

death
{
wm_announce “^iThe allies have destroy the first tower”
wm_objective_status 1 0 2
wm_objective_status 1 1 1
setstate tower2 invisible
trigger game_manager objective_counter
}
}

and its stopped working any idea?


(nikita) #20

ITS WORKING FINNALY :clap: :clap: :clap: :clap: :clap: