Problems with triggers

Post your scripting questions / solutions here

Moderator: Moderators

Carnivora
Lance Corporal
Posts: 10
Joined: Sun Nov 07, 2004 5:20 am

Problems with triggers

Post 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
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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.
Image
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

Post 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.. :)
Carnivora
Lance Corporal
Posts: 10
Joined: Sun Nov 07, 2004 5:20 am

Post 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
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

script

Post 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

//-----------------------------------------------------------------------------
Tom Trude,

Image
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post 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
Image
Carnivora
Lance Corporal
Posts: 10
Joined: Sun Nov 07, 2004 5:20 am

Post 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:
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post 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 :?
Image
Carnivora
Lance Corporal
Posts: 10
Joined: Sun Nov 07, 2004 5:20 am

Post by Carnivora »

It works, THX again !!!!

:D :lol:
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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
Image
User avatar
Deutsche Dogge
First Lieutenant
Posts: 183
Joined: Wed May 07, 2003 11:50 pm
Location: Quebec
Contact:

Post 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:
Image
Click sig to visit the alternation modding community
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I agree... the while is much better :)
Image
User avatar
Deutsche Dogge
First Lieutenant
Posts: 183
Joined: Wed May 07, 2003 11:50 pm
Location: Quebec
Contact:

Post by Deutsche Dogge »

jv_map wrote:I agree... the while is much better :)
'goto' is kind of... 'basic' :lol:

:wink:
Image
Click sig to visit the alternation modding community
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post 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:
Image
Post Reply