Hmmm, map doesn't follow my script.........

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Hmmm, map doesn't follow my script.........

Post by mohaa_rox »

Whoah! After the mapping prob, now the script errors. They won't follow my commands like hide, or show, or runto, or lookat! Here's the script:

Code: Select all

//Subattack
//mapping by Butch
//Scripting by mohaa_rox

main:

level waittill prespawn

exec global/friendly.scr
exec global/ambient.scr m5l1b
exec global/exploder.scr

level waittill spawn

$player item weapons/bar.tik
$player item weapons/springfield.tik
$player item weapons/colt45.tik
$player item weapons/m2frag_grenade.tik
$player ammo mg 1000
$player ammo rifle 1000
$player ammo pistol 1000
$player ammo grenade 1000
$player useweaponclass mg
end

$tank hide
$tank_trigger hide
$bomb hide
$medic_trigger hide
$save1 hide
end

thread friendly_setup
thread ai_guys_atwork
thread objectives
thread mg
end

objectives:
waitthread global/objectives.scr::add_objectives 1 2 "Locate the rest of your squad." $one.origin
end

mg:
$mg42 thread global/mg42_active.scr::mg42
end

friendly_setup:
level.friendly1.targetname = 1
level.friendly2.targetname = 2
level.friendly3.targetname = 3
$1 thread deathmessage1
$2 thread deathmessage2
$3 thread deathmessage3
$3 thread starting
end

starting:
$3 runto $start
$3 turnto $player
$3 lookat $player
$3 waittill movedone
wait 0.2
$3 exec global/stand.scr
$3 say dfr_m5l1_add01 //come with me sir, the rest of the tank crew is holed up back here
$3 waittill saydone
$3 turnto NULL
$3 lookat NULL
$3 runto $runhere
thread objective1
end

objective1:
$obj1 waittill trigger
waitthread global/objectives.scr::add_objectives 1 3 "Locate the rest of your squad." $one.origin
wait 2
iprintlnbold_noloc "Your medic needs some health supplies before your squad can follow you."
iprintlnbold_noloc "Find him some health supplies."
waitthread global/objectives.scr::add_objectives 2 2 "Find some supplies for your medic." $obj1.origin
end

deathmessage1:
	self waittill death
	iprintlnbold "Sergeant Hammon has been killed in action."
end
deathmessage2:
	self waittill death
	iprintlnbold "T/2 Engineer Campbell has been killed in action."
end
deathmessage3:
	self waittill death
	iprintlnbold "T/4 Medic Glenn has been killed in action."
end

objective2:
$health remove
waitthread global/objectives.scr::add_objectives 2 3 "Find some supplies for your medic." $obj1.origin
wait 2
iprintlnbold_noloc "Now bring back the supplies to your medic."
$medic_trigger show
waitthread global/objectives.scr::add_objectives 3 2 "Bring back the supplies to your medic." $obj2.origin
thread obj3
end

obj3:
$medic_trigger waittill trigger
waitthread global/objectives.scr::add_objectives 3 3 "Bring back the supplies to your medic." $obj2.origin
thread friendlies
end

friendlies:
//making friendlies friendly
if (isAlive $3)
{
	$3 thread global/friendly.scr::friendlythink
	$3.friendtype = 5
	$3.distance = 128
	$3.destination = $player
}
if (isalive $1)
{
	$1 thread global/friendly.scr::friendlythink
	$1.friendtype = 1
	$1.distance = 128
	$1.destination = $player
}
if (isalive $2)
{
	$2 thread global/friendly.scr::friendlythink
	$2.friendtype = 1
	$2.distance = 128
	$2.destination = $player
}
thread obj4
end

obj4:
$save1 show
$tank_trigger show
$tank show
waitthread global/objectives.scr::add_objectives 4 2 "Find the explosives." $obj4.origin
thread tank_start
end

tank_start:
$tank_trigger waittill trigger
$tank.collisionent = $tank.target
$tank waitthread global/vehicles_thinkers.scr::enemy_tank_think 0 panzer
level.playertanktarget = $player
local.Path = $t1
local.TankSpeed = 4
local.Acceleration = 30
$tank drive local.Path local.TankSpeed local.Acceleration
$tank waittill drive
$tank stop
end

objective4:
$explosives remove
waitthread global/items.scr::add_item "explosives" 
waitthread global/objectives.scr::add_objectives 4 3 "Find the explosives." $obj4.origin
wait 2
waitthread global/objectives.scr::add_objectives 5 2 "Use the explosives to destroy the fence." $obj5.origin
$bomb show
end

objective5:
$bomb model "animate/explosive.tik"
$bomb playsound explosive
$player loopsound bombtick
$player stopwatch 10
wait 10
$player stoploopsound bombtick
$bomb playsound explode_tank
$bomb remove
exec global/exploder.scr::explode 1
radiusdamage $hurtobject 256 384
waitthread global/objectives.scr::add_objectives 5 3 "Use the explosives to destroy the fence." $obj5.origin
end

ai_guys_atwork:
$crateguy1 waitthread global/movecrate.scr::movecrate crate1_start crate1_end
$crateguy1 waitthread global/movecrate.scr::movecrate crate2_start crate2_end
$crateguy1 waitthread global/movecrate.scr::movecrate crate3_start crate3_end
$crateguy1 waitthread global/movecrate.scr::movecrate crate4_start crate4_end

$crateguy2 waitthread global/movecrate.scr::movecrate crate5_start crate5_end
$crateguy2 waitthread global/movecrate.scr::movecrate crate6_start crate6_end
$crateguy2 waitthread global/movecrate.scr::movecrate crate7_start crate7_end
$crateguy2 waitthread global/movecrate.scr::movecrate crate8_start crate8_end

$crateguy3 waitthread global/movecrate.scr::movecrate crate9_start crate9_end
$crateguy3 waitthread global/movecrate.scr::movecrate crate10_start crate10_end
$crateguy3 waitthread global/movecrate.scr::movecrate crate11_start crate11_end
end
It's not fully scripted yet.
Live to map, not map to live.
-mohaa_rox, .map
moderator
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

just a quick suggestion, can't really see the script that well (my monitors facing the sun :( )

anyway if you add to your script,

//level waittill spawn //after this line
wait 5
iprintlnbold "is it working." // this'll show you onscreen whether it's running any of the script,
//if this doesn't appear after the 5 second wait after spawning then you know that there is something wrong with the script
//otherwise if this appears you know that the entities are named wrong or a similar problem :D
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

Tried that, didn't work.

When I spawn, my objective doesn't add at all.
Live to map, not map to live.
-mohaa_rox, .map
moderator
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

If U are running the map in a pk3, and there is an equal *.scr file in the maps dir: MOHAA will run the file in the maps dir... thus ignoring the one in the *.pk3.

Only thing I can think of.

No, one more thing: write logfile 1 in the consol berfore starting the map ( this will write all consol text to a file named qconsole.log in the main folder )
Admin .MAP Forums
Image
Head above heels.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I did notice one thing
$player item weapons/bar.tik
$player item weapons/springfield.tik
$player item weapons/colt45.tik
$player item weapons/m2frag_grenade.tik
$player ammo mg 1000
$player ammo rifle 1000
$player ammo pistol 1000
$player ammo grenade 1000
$player useweaponclass mg
end

$tank hide
$tank_trigger hide
$bomb hide
$medic_trigger hide
$save1 hide
end

thread friendly_setup
thread ai_guys_atwork
thread objectives
thread mg
end
do these belong here? No thread labels .
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

Ok, will try.
Live to map, not map to live.
-mohaa_rox, .map
moderator
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

//Subattack
//mapping by Butch
//Scripting by mohaa_rox

main:

level waittill prespawn

exec global/friendly.scr
exec global/ambient.scr m5l1b
exec global/exploder.scr

level waittill spawn

$player item weapons/bar.tik
$player item weapons/springfield.tik
$player item weapons/colt45.tik
$player item weapons/m2frag_grenade.tik
$player ammo mg 1000
$player ammo rifle 1000
$player ammo pistol 1000
$player ammo grenade 1000
$player useweaponclass mg
thread setup_1
thread setup_2

end
//you have an end here? the only reason you will want this is for play testing and if you have a this thread before it, when testing your scripts 2 decide which parts aren't working it's easier to disable a thread rather than disabling imparticular lines, hopefully that makes sense

setup_1:

$tank hide
$tank_trigger hide //you don't need to hide a trigger
$bomb hide
$medic_trigger hide
$save1 hide
end

setup_2:
thread friendly_setup
thread ai_guys_atwork
thread objectives
thread mg
end

objectives:
waitthread global/objectives.scr::add_objectives 1 2 "Locate the rest of your squad." $one.origin
end

mg:
$mg42 thread global/mg42_active.scr::mg42
end

friendly_setup:
level.friendly1.targetname = 1
level.friendly2.targetname = 2
level.friendly3.targetname = 3
$1 thread deathmessage1
$2 thread deathmessage2
$3 thread deathmessage3
$3 thread starting
end

starting:
$3 runto $start
$3 turnto $player
$3 lookat $player
$3 waittill movedone
wait 0.2
$3 exec global/stand.scr
$3 say dfr_m5l1_add01 //come with me sir, the rest of the tank crew is holed up back here
$3 waittill saydone
$3 turnto NULL
$3 lookat NULL
$3 runto $runhere
thread objective1
end

objective1:
$obj1 waittill trigger
waitthread global/objectives.scr::add_objectives 1 3 "Locate the rest of your squad." $one.origin
wait 2
iprintlnbold_noloc "Your medic needs some health supplies before your squad can follow you."
iprintlnbold_noloc "Find him some health supplies."
waitthread global/objectives.scr::add_objectives 2 2 "Find some supplies for your medic." $obj1.origin
end

deathmessage1:
self waittill death
iprintlnbold "Sergeant Hammon has been killed in action."
end
deathmessage2:
self waittill death
iprintlnbold "T/2 Engineer Campbell has been killed in action."
end
deathmessage3:
self waittill death
iprintlnbold "T/4 Medic Glenn has been killed in action."
end

objective2:
$health remove
waitthread global/objectives.scr::add_objectives 2 3 "Find some supplies for your medic." $obj1.origin
wait 2
iprintlnbold_noloc "Now bring back the supplies to your medic."
$medic_trigger show
waitthread global/objectives.scr::add_objectives 3 2 "Bring back the supplies to your medic." $obj2.origin
thread obj3
end

obj3:
$medic_trigger waittill trigger
waitthread global/objectives.scr::add_objectives 3 3 "Bring back the supplies to your medic." $obj2.origin
thread friendlies
end

friendlies:
//making friendlies friendly
if (isAlive $3)
{
$3 thread global/friendly.scr::friendlythink
$3.friendtype = 5
$3.distance = 128
$3.destination = $player
}
if (isalive $1)
{
$1 thread global/friendly.scr::friendlythink
$1.friendtype = 1
$1.distance = 128
$1.destination = $player
}
if (isalive $2)
{
$2 thread global/friendly.scr::friendlythink
$2.friendtype = 1
$2.distance = 128
$2.destination = $player
}
//you may find it easier to use self thread commands here if multiple targets are using the same script

thread obj4
end

obj4:
$save1 show
$tank_trigger show//not sure as to what the trigger is for but just hiding and showing it won't disable the trigger, you will need "$tank_trigger triggerable" or "$tank_trigger nottriggerable" respectively (note the "" surround the script, the whole sentence isn't script)
$tank show
waitthread global/objectives.scr::add_objectives 4 2 "Find the explosives." $obj4.origin
thread tank_start
end

tank_start:
$tank_trigger waittill trigger
$tank.collisionent = $tank.target
$tank waitthread global/vehicles_thinkers.scr::enemy_tank_think 0 panzer
level.playertanktarget = $player
local.Path = $t1
local.TankSpeed = 4
local.Acceleration = 30
$tank drive local.Path local.TankSpeed local.Acceleration
$tank waittill drive
$tank stop
end

objective4:
$explosives remove
waitthread global/items.scr::add_item "explosives"
waitthread global/objectives.scr::add_objectives 4 3 "Find the explosives." $obj4.origin
wait 2
waitthread global/objectives.scr::add_objectives 5 2 "Use the explosives to destroy the fence." $obj5.origin
$bomb show
// would you not need "thread objective5" in here
end

objective5:
$bomb model "animate/explosive.tik"
$bomb playsound explosive
$player loopsound bombtick
$player stopwatch 10
wait 10
$player stoploopsound bombtick
$bomb playsound explode_tank
$bomb remove
exec global/exploder.scr::explode 1
radiusdamage $hurtobject 256 384
waitthread global/objectives.scr::add_objectives 5 3 "Use the explosives to destroy the fence." $obj5.origin
end

ai_guys_atwork:
$crateguy1 waitthread global/movecrate.scr::movecrate crate1_start crate1_end
$crateguy1 waitthread global/movecrate.scr::movecrate crate2_start crate2_end
$crateguy1 waitthread global/movecrate.scr::movecrate crate3_start crate3_end
$crateguy1 waitthread global/movecrate.scr::movecrate crate4_start crate4_end

$crateguy2 waitthread global/movecrate.scr::movecrate crate5_start crate5_end
$crateguy2 waitthread global/movecrate.scr::movecrate crate6_start crate6_end
$crateguy2 waitthread global/movecrate.scr::movecrate crate7_start crate7_end
$crateguy2 waitthread global/movecrate.scr::movecrate crate8_start crate8_end

$crateguy3 waitthread global/movecrate.scr::movecrate crate9_start crate9_end
$crateguy3 waitthread global/movecrate.scr::movecrate crate10_start crate10_end
$crateguy3 waitthread global/movecrate.scr::movecrate crate11_start crate11_end
end

// hope this helps but removing the 2 ends as BDBODGER said should fix the problem (should)
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

There's still some probs. I can't trigger my triggers.
Live to map, not map to live.
-mohaa_rox, .map
moderator
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

objective1:
$obj1 waittill trigger
waitthread global/objectives.scr::add_objectives 1 3 "Locate the rest of your squad." $one.origin
wait 2
iprintlnbold_noloc "Your medic needs some health supplies before your squad can follow you."
iprintlnbold_noloc "Find him some health supplies."
waitthread global/objectives.scr::add_objectives 2 2 "Find some supplies for your medic." $obj1.origin
end
$obj1.origin is the compass isn't it if you use " $obj1 waittill tigger " won't it point at your current location ? and don't you need a thread objective2 at the end of this thread? And a start for objective 5 and or a trigger?
It seems to me to be something about the triggers are they trigger_multiples ? . I guess you know you can use a trigger_multiple with a key of setthread and a value of objective1 to trigger the thread instead of useing $obj1 waittill trigger .
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

$obj trigger is my first objective trigger, which is to find the soliders. It's origin is $one.origin
$obj1.origin is my second objective's origin. And "objective2" is a setthread used in this case.
Live to map, not map to live.
-mohaa_rox, .map
moderator
Post Reply