Page 1 of 2

Problems with triggers

Posted: Tue Dec 07, 2004 7:30 pm
by Carnivora
Hi again !

I have a few problems with my map, I added a minefield, random explodes and damaging flames to my map. Now when I am trying to load the map it`s sending me back to the briefing room. Console says : Developer, your script is broken. I just can`t figure out what is wrong ?
Here is my script:

// talvisota
// ARCHITECTURE: Carnivora
// SCRIPTING: Carnivora

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Talvisota"
setcvar "g_obj_alliedtext2" "By Carnivora"
setcvar "g_obj_alliedtext3" "(TeurasCompany)"
setcvar "g_obj_axistext1" "Talvisota"
setcvar "g_obj_axistext2" "By Carnivora"
setcvar "g_obj_axistext3" "(TeurasCompany)"

setcvar "g_scoreboardpic" "talvisota"

//call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr

exec global/minefield.scr

level.script = maps/dm/talvisota.scr

//exec global/ambient.scr mohdm2

//$world farplane 5000
//$world farplane_color (.333 .333 .329)

level waittill spawn
//hurt script by blue60007

my_hurt_trigger:

$my_hurt_trigger volumedamage 100 //hurts the player

end

thread random_explode1

end

random explode_1:

wait (randomfloat 13+23)


$random_explode anim start
radiusdamage $random_explode 256 384

goto random_explode1

end

//-----------------------------------------------------------------------------
roundbasedthread:

// TeurasCompany

level waittill prespawn

level waittill spawn

// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw

level waittill roundstart

end

Posted: Tue Dec 07, 2004 8:22 pm
by jv_map
wait (randomfloat 13+23)

should be

wait ((randomfloat 13)+23)

I think that's what giving you the fatal error. Apart from that you also have numerous other errors like 'end's at wrong places.

Posted: Tue Dec 07, 2004 8:54 pm
by Grassy
As JV said :) also you need an end just below these lines;

level waittill spawn
//hurt script by blue60007
end //this marks the end of the main method here

also....

random_explode_1: // <------ you had a space in the label.
while (1)
{
wait ((randomfloat 13) +23)
$random_explode anim start
radiusdamage $random_explode 256 384
}
//goto random_explode1 ---JV dont like goto's :) this looks nicer now
end

also...

remove the end from the middle of the thread that calls the random_explode_1 thread......

and....... :)

thread random_explode1 //this dosnt match the thread label you had below. Easy to do, I have done it myself when using complicated label names, the best thing to do is use copy and paste if label names are long and complex, it elimenates the chance of typos sneaking in.. :)

Posted: Tue Dec 07, 2004 9:42 pm
by Carnivora
Sorry for writing this in to mapping, should have written it in to scripting.
The flame is working fine but the explosions arent`t. Every time I enter the minefield I hear "a clikc", but nothing happens. The "mines" won`t explode.
So there is still something wrong ?
:? Thx for quick reply :?

// talvisota
// ARCHITECTURE: Carnivora
// SCRIPTING: Carnivora

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Talvisota"
setcvar "g_obj_alliedtext2" "By Carnivora"
setcvar "g_obj_alliedtext3" "(TeurasCompany)"
setcvar "g_obj_axistext1" "Talvisota"
setcvar "g_obj_axistext2" "By Carnivora"
setcvar "g_obj_axistext3" "(TeurasCompany)"

setcvar "g_scoreboardpic" "talvisota"

//call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr

exec global/minefield.scr

level.script = maps/dm/talvisota.scr

//exec global/ambient.scr mohdm2

//$world farplane 5000
//$world farplane_color (.333 .333 .329)

level waittill spawn
//hurt script by blue60007
end//

my_hurt_trigger:

$my_hurt_trigger volumedamage 20 //hurts the player

end


random_explode_1://
{
wait ((randomfloat 13)+23)
$random_explode anim start
radiusdamage $random_explode 256 384
}
//goto random_explode1
end

//-----------------------------------------------------------------------------
roundbasedthread:

// TeurasCompany

level waittill prespawn

level waittill spawn

// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw

level waittill roundstart

end

script

Posted: Wed Dec 08, 2004 1:04 am
by tltrude
This script should work. Is there a "setthread" in the map that runs the my_hurt_trigger thread?

//-----------------------------------------------------------------------------

// talvisota
// ARCHITECTURE: Carnivora
// SCRIPTING: Carnivora

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Talvisota"
setcvar "g_obj_alliedtext2" "By Carnivora"
setcvar "g_obj_alliedtext3" "(TeurasCompany)"
setcvar "g_obj_axistext1" "Talvisota"
setcvar "g_obj_axistext2" "By Carnivora"
setcvar "g_obj_axistext3" "(TeurasCompany)"

setcvar "g_scoreboardpic" "talvisota" // requires an image and shader file to work

// next two lines call additional stuff if the game is round based

if(level.roundbased)
thread roundbasedthread

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr
thread global/minefield.scr::minefield_setup
level.script = maps/dm/talvisota.scr
//exec global/ambient.scr mohdm2 // adds background sound (not turned on)

//$world farplane 5000 // fog distance (not turned on)
//$world farplane_color (.333 .333 .329) // fog color (gray) (not turned on)

level waittill spawn

thread random_explode_1 // this line executes the thread named

end

//-------------------------------->
// Round based Thread
//-------------------------------->

roundbasedthread:

// Can specify different scoreboard messages here--
// otherwise it will use the ones up top.

level waittill prespawn

level waittill spawn

// set the parameters for a round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw

level waittill roundstart

end

//-------------------------------->
// New Threads
//-------------------------------->

my_hurt_trigger:

wait .2
$my_hurt_trigger volumedamage 20 //hurts the player

end

random_explode_1:

wait (randomfloat 13 + 23) // this line is right out of obj_team3 and is correct
$random_explode playsound arty_leadinmp
wait 1
$random_explode anim start
radiusdamage $random_explode 256 384
goto random_explode_1 // this line makes the thread loop

end

//-----------------------------------------------------------------------------

Posted: Thu Dec 09, 2004 2:51 am
by Green Beret
when mine clicked and didnt blow up,it was cause my mines were to close to each other,i spaced them out better and,i heard the click,and did a flip...lol

Posted: Thu Dec 09, 2004 8:05 pm
by Carnivora
Hi,
First little backroun for my mapping, this is the first map I`m doing. So please have pation with me :D

Tom, I made a script exactly the way you told me to do but it didn`t work. Console says: wait.2 unknown line or something. I took it away and then all worked fine, minefield, hurttriggers and explodes. I even figured out how to add more explotions.

But now I have a new problem.
I added some my_hurt_trigger`s. One is in the flames, and first it worked fine. But then I added 2 trigger`s in to 2 different barbwires and now none of the trigger`s works. I tryed to name them as:

my_hurt_trigger_1
$my_hurt_trigger volumedamage 20 //hurts the player

my_hurt_trigger_2
$my_hurt_trigger volumedamage 5 //hurts the player

my_hurt_trigger_3
$my_hurt_trigger volumedamage 5 //hurts the player

Have I named them wrong ?

THX to all who helped me with these questions.
:oops:

And Green Beret, I like the "click" but players don`t :lol:

Posted: Thu Dec 09, 2004 8:19 pm
by Green Beret
my_hurt_trigger_1
$my_hurt_trigger volumedamage 20 //hurts the player

my_hurt_trigger_2
$my_hurt_trigger volumedamage 50
//give the trigger a targetname other than the one you already used

my_hurt_trigger_3
$my_hurt_trigger volumedamage 5 //hurts the player

example below:

Code: Select all

my_hurt_trigger_1
$my_hurt_trigger volumedamage 20

my_hurt_trigger_2
$my_hurt_trigger2  volumedamage 20

my_hurt_trigger_3
$my_hurt_trigger3 volumedamage 20
now name the other two triggers to match the script?
does that sound right :?

Posted: Thu Dec 16, 2004 2:24 am
by Carnivora
It works, THX again !!!!

:D :lol:

Posted: Thu Dec 16, 2004 1:17 pm
by bdbodger
Console says: wait.2 unknown line or something.
you needed a space between wait and .2 that is why it didn't work .

wait .2

Posted: Thu Dec 16, 2004 3:31 pm
by Deutsche Dogge
Hi, this has nothing to do with making something work that doesn't but i just thought i'd post anyway.

This thread:

Code: Select all

random_explode_1:

wait ((randomfloat 13) + 23) // this line is right out of obj_team3 and is correct
$random_explode playsound arty_leadinmp
wait 1
$random_explode anim start
radiusdamage $random_explode 256 384
goto random_explode_1 // this line makes the thread loop

end 
Could also be coded like this:

Code: Select all

random_explode_1:

	while(1)	//infinite loop instead of goto 'label'
	{
		wait ((randomfloat 13) + 23)
		$random_explode playsound arty_leadinmp
		wait 1
		$random_explode anim start
		radiusdamage $random_explode 256 384
	}
end 
But it's all up to you :wink:

Posted: Thu Dec 16, 2004 3:35 pm
by jv_map
I agree... the while is much better :)

Posted: Thu Dec 16, 2004 3:39 pm
by Deutsche Dogge
jv_map wrote:I agree... the while is much better :)
'goto' is kind of... 'basic' :lol:

:wink:

Posted: Fri Dec 17, 2004 12:05 am
by lizardkid
i gotta say goto has some seriously good uses... it's hard to control where the focus is sometimes.

but for loops, while, for, do-while are the better. for basic jumping goto is best.

Posted: Fri Dec 17, 2004 3:09 am
by Green Beret
is there a list of commands and meanings,because i just pick up what i see in other scriots so far,

example
$object rotateup

i know its pretty explanatory but do yoou just try diff commands till you find one?
you know how ubersound has a list of sounds to use,is yhere a .scr or anything with useable commands? :oops: