script error

Post your scripting questions / solutions here

Moderator: Moderators

dietje_schietje
Corporal
Posts: 29
Joined: Wed Nov 19, 2008 8:20 pm

script error

Post by dietje_schietje »

i get my litle SP map but my script file don't works somebody want to corrigate my script file please?
thanks


this is my script file:
main:

exec global/loadout.scr maps/test_assassination.scr

level waittill prespawn

exec global/alarmer.scr
exec global/ambient.scr

level waittill spawn

$player item weapons/colt45.tik
$player item weapons/thompsonsmg.tik
$player ammo pistol 1000
$player ammo smg 1000
$player useweaponclass smg
end

thread objectives
thread hints
thread disquise
thread music1
end

objectives:
waitthread global/objectives.scr::add_objectives 1 1 "Find a disguise." $suit.origin
waitthread global/objectives.scr::add_objectives 2 1 "Kill the officer." $obj2.origin
set_objective_pos $officer // this makes the officer to be killed an objective
waitthread global/objectives.scr::add_objectives 1 2 "find a disquise." $suit.origin
waitthread global/objectives.scr::current_objectives 1
end

music1:
$player stufftext "tmstart sound/music/mus_14a_action"

disguise:
$trigger waittill trigger //the trigger used in above
$suit remove //removes the suit
$papers remove //removes the papers
$player playsound pickup_papers //sound
$player playsound pickup_uniform //sound
waitthread global/items.scr::add_item "papers_level1" //gives you
//level 1 papers
waitthread global/items.scr::add_item "uniform" //gives you
//uniform
end

objective1:
waitthread global/objectives.scr::add_objectives 1 3 "Find a disguise." $suit.origin

//////////
hints:
local.key = getboundkey1 "Holster"
iprintlnbold_noloc (loc_convert_string "Press the ( ") local.key (loc_convert_string " ) key to holster your weapon.")
wait 1
iprintlnbold "If your weapon is not holstered"
iprintlnbold "your cover will be blown."
wait 2
iprintlnbold "Show your papers when asked."
local.key = getboundkey1 "toggleitem"
iprintlnbold_noloc (loc_convert_string "Press the ( ") local.key (loc_convert_string " ) key to show your papers.")
end

objective2:
waitthread global/objectives.scr::add_objectives 2 2"Kill the officer."
waitthread global/objectives.scr::current_objectives 1

blowcover:
$blowcover waittill trigger
waitthread global/items.scr::remove_item "uniform" //removes
//uniform
iprintlnbold "Somebody has found the dead bodie! You cover has been blown!"
end

levelend:
if (IsAlive $officer) // the "if" must be a lower case, MOHAA is case sensitive
$officer waittill death // if the officer is killed, then the mission will complete
global/objectives.scr::add _objectives 2 3 "Kill the officer." $obj2.origin
global/objectives.scr::current_objectives 0
wait 2
exec global/missioncomplete.scr test_assassination
end

alarm_player_reset: //our setthread value
thread global/alarmer.scr::alarm_player_reset
end
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Code: Select all

$player item weapons/colt45.tik 
$player item weapons/thompsonsmg.tik 
$player ammo pistol 1000 
$player ammo smg 1000 
$player useweaponclass smg 
end 

thread objectives 
thread hints 
thread disquise 
thread music1 








should be

Code: Select all

$player item weapons/colt45.tik 
$player item weapons/thompsonsmg.tik 
$player ammo pistol 1000 
$player ammo smg 1000 
$player useweaponclass smg 


thread objectives 
thread hints 
thread disquise 
thread music1 

END is not welcomed here!
dietje_schietje
Corporal
Posts: 29
Joined: Wed Nov 19, 2008 8:20 pm

Post by dietje_schietje »

is it for the rest good? it still don't works
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Code: Select all

objective2: 
waitthread global/objectives.scr::add_objectives 2 2"Kill the officer." 
waitthread global/objectives.scr::current_objectives 1 

ITS ENDS TIME!

Code: Select all

objective2: 
waitthread global/objectives.scr::add_objectives 2 2"Kill the officer." 
waitthread global/objectives.scr::current_objectives 1 
end

Code: Select all

objective1: 
waitthread global/objectives.scr::add_objectives 1 3 "Find a disguise." $suit.origin 
HERE SHOULD BE END TOO! Andafter music... every thread must have end beforenew start!
Example:

Code: Select all

adsdasdas:
thread aaaa2
end

aaaa2:
$target waittill death
println $target.targetname "is dead with hp " $target.health
thread bbb23
end

bbb23:
$player.origin = &nowhere.origin
end
Every script start with "<threadname>:" and end with "end"!!
dietje_schietje
Corporal
Posts: 29
Joined: Wed Nov 19, 2008 8:20 pm

Post by dietje_schietje »

still don't works maybe i have do something wrong in my map or it is vista
it have works a time but something was wrong so i chanched it and no it's don't works :(
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

main:

////////////////////////////// YOU MAP NAME .SCR
exec global/loadout.scr maps/test_assassination.scr

level waittill prespawn

exec global/alarmer.scr
exec global/ambient.scr

level waittill spawn

$player item weapons/colt45.tik
$player item weapons/thompsonsmg.tik
$player ammo pistol 1000
$player ammo smg 1000
$player useweaponclass smg

//END IS NOT WELCOMED HERE!!
/////end


///message for player
dprintln "SCRIPT LOADED SUCCESFULLY"

thread objectives
thread hints
thread disquise
thread music1
end

objectives:
waitthread global/objectives.scr::add_objectives 1 1 "Find a disguise." $suit.origin
waitthread global/objectives.scr::add_objectives 2 1 "Kill the officer." $obj2.origin
set_objective_pos $officer // this makes the officer to be killed an objective
waitthread global/objectives.scr::add_objectives 1 2 "find a disquise." $suit.origin
waitthread global/objectives.scr::current_objectives 1
end

music1:
$player stufftext "tmstart sound/music/mus_14a_action"

///NEED END HERE
end

disguise:
$trigger waittill trigger //the trigger used in above <- TRIGGER USE
$suit remove //removes the suit
$papers remove //removes the papers
$player playsound pickup_papers //sound
$player playsound pickup_uniform //sound
waitthread global/items.scr::add_item "papers_level1" //gives you
//level 1 papers
waitthread global/items.scr::add_item "uniform" //gives you
//uniform
end

objective1:
waitthread global/objectives.scr::add_objectives 1 3 "Find a disguise." $suit.origin
/////////ENDHERE?
end

//////////
hints:
local.key = getboundkey1 "Holster"
iprintlnbold_noloc (loc_convert_string "Press the ( ") local.key (loc_convert_string " ) key to holster your weapon.")
wait 1
iprintlnbold "If your weapon is not holstered"
iprintlnbold "your cover will be blown."
wait 2
iprintlnbold "Show your papers when asked."
local.key = getboundkey1 "toggleitem"
iprintlnbold_noloc (loc_convert_string "Press the ( ") local.key (loc_convert_string " ) key to show your papers.")
end

objective2:
waitthread global/objectives.scr::add_objectives 2 2"Kill the officer."
waitthread global/objectives.scr::current_objectives 1

//ENDENDE ND
end

blowcover:
$blowcover waittill trigger
waitthread global/items.scr::remove_item "uniform" //removes
//uniform
iprintlnbold "Somebody has found the dead bodie! You cover has been blown!"
end

levelend:
if (IsAlive $officer) // the "if" must be a lower case, MOHAA is case sensitive
$officer waittill death // if the officer is killed, then the mission will complete
global/objectives.scr::add _objectives 2 3 "Kill the officer." $obj2.origin
global/objectives.scr::current_objectives 0
wait 2
exec global/missioncomplete.scr test_assassination
end

alarm_player_reset: //our setthread value
thread global/alarmer.scr::alarm_player_reset
end
dietje_schietje
Corporal
Posts: 29
Joined: Wed Nov 19, 2008 8:20 pm

Post by dietje_schietje »

still don't works i don't know what it is :(
i have no weapons and nothing works.
:(
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

MAP SHOULD BE mohaa/main/maps/test_<name>.bsp and script should be test_<name>.scr SCRIPT MUST BE PURE TEXT FILE!! Copy script from here to NOTEPAD, then save it with .scr !
dietje_schietje
Corporal
Posts: 29
Joined: Wed Nov 19, 2008 8:20 pm

Post by dietje_schietje »

grrrr stil don't works and if i look he creates a test_assassination.min and a test_assassination.pth
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Aprop, your CAPS lock and your exclamation marks makes it seem you are annoyed or angry. He's just asking help, so please stop. Before thinking he doesn't know how to make a script, notice this HUGE error in his script:

Code: Select all

global/objectives.scr::add _objectives 2 3 "Kill the officer." $obj2.origin
global/objectives.scr::current_objectives 0 
The game doesn't know what to do with this and unloads the script.


Dietje check the console when the script isn't working, it'll show you what's wrong.



And this script works, cheers :)

Code: Select all

main:

exec global/loadout.scr maps/test_assassination.scr

level waittill prespawn

exec global/alarmer.scr
exec global/ambient.scr

level waittill spawn

$player item weapons/colt45.tik
$player item weapons/thompsonsmg.tik
$player ammo pistol 1000
$player ammo smg 1000
$player useweaponclass smg

thread objectives
thread hints
thread disquise
thread music1
end

objectives:
waitthread global/objectives.scr::add_objectives 1 1 "Find a disguise." $suit.origin
waitthread global/objectives.scr::add_objectives 2 1 "Kill the officer." $obj2.origin
set_objective_pos $officer // this makes the officer to be killed an objective
waitthread global/objectives.scr::add_objectives 1 2 "find a disquise." $suit.origin
waitthread global/objectives.scr::current_objectives 1
end

music1:
$player stufftext "tmstart sound/music/mus_14a_action"

end

disguise:
$trigger waittill trigger //the trigger used in above <- TRIGGER USE
$suit remove //removes the suit
$papers remove //removes the papers
$player playsound pickup_papers //sound
$player playsound pickup_uniform //sound
waitthread global/items.scr::add_item "papers_level1" //gives you
//level 1 papers
waitthread global/items.scr::add_item "uniform" //gives you
//uniform
end

objective1:
waitthread global/objectives.scr::add_objectives 1 3 "Find a disguise." $suit.origin
end


hints:
local.key = getboundkey1 "Holster"
iprintlnbold_noloc (loc_convert_string "Press the ( ") local.key (loc_convert_string " ) key to holster your weapon.")
wait 1
iprintlnbold "If your weapon is not holstered"
iprintlnbold "your cover will be blown."
wait 2
iprintlnbold "Show your papers when asked."
local.key = getboundkey1 "toggleitem"
iprintlnbold_noloc (loc_convert_string "Press the ( ") local.key (loc_convert_string " ) key to show your papers.")
end

objective2:
waitthread global/objectives.scr::add_objectives 2 2"Kill the officer."
waitthread global/objectives.scr::current_objectives 1

end

blowcover:
$blowcover waittill trigger
waitthread global/items.scr::remove_item "uniform" //removes
//uniform
iprintlnbold "Somebody has found the dead bodie! You cover has been blown!"
end

levelend:
if (IsAlive $officer) 
{
$officer waittill death // if the officer is killed, then the mission will complete
}
waitthread global/objectives.scr::add _objectives 2 3 "Kill the officer." $obj2.origin
waitthread global/objectives.scr::current_objectives 0
wait 2
exec global/missioncomplete.scr test_assassination

end

alarm_player_reset: //our setthread value
thread global/alarmer.scr::alarm_player_reset
end
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
dietje_schietje
Corporal
Posts: 29
Joined: Wed Nov 19, 2008 8:20 pm

Post by dietje_schietje »

thanks it works but i can't pick up the papers and disquise
and there is no music
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Make trigger use around papers, give it "targetname" "trigger"
dietje_schietje
Corporal
Posts: 29
Joined: Wed Nov 19, 2008 8:20 pm

Post by dietje_schietje »

it works but if i pick it up the next objective don't comes
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Your music should be this:

Code: Select all

$player stufftext "tmstart sound/music/mus_14a_action.mp3" 
But if you don't want the music to stop, you should use music in another way. Make a new file called: test_assassination.mus
Open with wordpad and add this:

Code: Select all

path sound/music

normal mus_14a_action.mp3 // Plays over entire level

!normal volume 0.8
!normal loop
Save and put this in the /music directory. Now in your map script replace:

Code: Select all

exec global/ambient.scr
with

Code: Select all

exec global/ambient.scr test_assassination
And you're done!

For the next objective, put this command very last in the trigger's setthread:

Code: Select all

thread objective2
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
dietje_schietje
Corporal
Posts: 29
Joined: Wed Nov 19, 2008 8:20 pm

Post by dietje_schietje »

ok now it works thanks
but on the end of my map if i killed the officer the objective is not completed but the mission complete screen comes

i chanched a little bit and this is my script file:

Code: Select all

main: 

exec global/loadout.scr maps/test_assassination.scr 

level waittill prespawn 

exec global/alarmer.scr 
exec global/ambient.scr test_assassination

level waittill spawn 

$player item weapons/silencedpistol.tik 
$player ammo pistol 1000 
$player useweaponclass smg 

thread objectives 
thread hints 
thread disguise 
thread enemymove
thread blowcover
thread objective2 
end 

objectives: 
waitthread global/objectives.scr::add_objectives 1 1 "Find a disguise." $suit.origin 
waitthread global/objectives.scr::add_objectives 2 1 "Kill the officer." $obj2.origin 
set_objective_pos $officer // this makes the officer to be killed an objective 
waitthread global/objectives.scr::add_objectives 1 2 "find a disquise." $suit.origin 
waitthread global/objectives.scr::current_objectives 1
thread objective1 
end 

objective1:
$trigger waittill trigger 
waitthread global/objectives.scr::add_objectives 1 3 "Find a disguise." $suit.origin 
thread objective2
end

disguise: 
$trigger waittill trigger //the trigger used in above <- TRIGGER USE 
$suit remove //removes the suit 
$papers remove //removes the papers 
$player playsound pickup_papers //sound 
$player playsound pickup_uniform //sound 
waitthread global/items.scr::add_item "papers_level1" //gives you 
//level 1 papers 
waitthread global/items.scr::add_item "uniform" //gives you 
//uniform 
local.key = getboundkey1 "Holster" 
iprintlnbold_noloc (loc_convert_string "Press the ( ") local.key (loc_convert_string " ) key to holster your weapon.") 
wait 1 
iprintlnbold "If your weapon is not holstered" 
iprintlnbold "your cover will be blown." 
wait 3
iprintlnbold_noloc "Show your papers when asked." 
local.key = getboundkey1 "toggleitem" 
iprintlnbold_noloc (loc_convert_string "Press the ( ") local.key (loc_convert_string " ) key to show your papers.")
end 

objective2: 
waitthread global/objectives.scr::add_objectives 2 2 "Kill the officer." $obj2.origin 
set_objective_pos $officer // this makes the officer to be killed an objective 
waitthread global/objectives.scr::current_objectives 2 
thread levelend
end 

blowcover: 
$blowcover waittill trigger 
waitthread global/items.scr::remove_item "uniform" //removes 
//uniform 
iprintlnbold_noloc "Somebody has found the dead bodie! You cover has been blown!"
iprintlnbold_noloc "Somebody has found the dead bodie! You cover has been blown!" 
iprintlnbold_noloc "Somebody has found the dead bodie! You cover has been blown!"   
end 

levelend: 
if (IsAlive $officer) 
{ 
$officer waittill death // if the officer is killed, then the mission will complete 
} 
wait 2 
exec global/missioncomplete.scr test_assassination 
end 

alarm_player_reset: //our setthread value 
thread global/alarmer.scr::alarm_player_reset 
end
Post Reply