Page 6 of 11
Re: Scripting Errors???
Posted: Tue Jul 26, 2011 11:20 pm
by Cpt. Duke
That's funny. I had the same exact problem with my first attempt at scripting!
Here's what you do:
- 1. Open your script file with notepad.
2. Select File/Save As.
3. When the Save As window appears, look for "Save as Type" and select "All Files".
4. Give your script file a new name (it must be the same as your .bsp) and give it the .scr extension.
Example:
And there you have it!
Just be sure you fix those entity parameters before you test your map. Otherwise, you may experience many more complications.
During my early mapping days, I tried to add a script to the worldspawn. This, however, erased my entire map, forcing me to basically rebuild it entirely!
In order to avoid any devastating mistakes, make sure you have plenty of copies before you start experimenting. Ok?
I usually like to keep at least four copies of my map in My Documents and a copy on a disc and/or thumb drive. When it comes to protecting hours of hard work, you could never be too careful!
Posted: Wed Jul 27, 2011 2:41 pm
by 17thairborne
I did that and created a .scr, then I opened it up in MOHAAB and when It was loading, it went black and returned to the main menu, giving me this:
Any ideas on the "Broken Script" Part?
Thanks, 17thairborne
Re: Scripting Errors???
Posted: Wed Jul 27, 2011 6:25 pm
by Cpt. Duke
Oh yes, I get this error very frequently.
I fixed the errors and cleaned up your script. The major changes are shown in orange.
- main:
setcvar "g_obj_alliedtext1" "Survive and Win!!!!"
setcvar "g_obj_axistext1" "Survive and Win!!!!"
level waittill prespawn
exec global/DMprecache.scr
level waittill spawn
wait .5 //Gives the game some extra time.
thread TrappingPit1
// level waittill roundstart <---This needs to be disabled unless you have more than one player!
thread MineCarTest
end
MineCarTest:
local.player = parm.other
if (local.player isTouching $MineCarSeat)
{
goto lorerun
$MineCarEject nottriggerable
$MineCarHurt nottriggerable
}
end
lorerun:
$MineCar playsound lorestart
local.player = parm.other
$MineCarHurt triggerable
$MineCarSeat bind $MineCar
local.player glue $MineCarSeat
local.player.sitdown = 1
$MineCar loopsound lorerun
local.player thread lore_sitdown
local.player thread lore_dead
$MineCar followpath $MineCarStart
$MineCar waitmove
local.player.sitdown = 0
local.player unglue
$MineCarEject triggerable
$MineCar followpath $MineCarReset
$MineCar waitmove
$MineCar stoploopsound
$MinecarHurt nottriggerable
end
lore_sitdown:
while(self.sitdown == 1)
{
self forcelegsstate CROUCH_IDLE
wait .1
}
end
lore_dead:
while (isalive self)
{
wait .1
}
self.sitdown = 0
self unglue
end
TrappingPit1:
local.player = parm.other
if (local.player isTouching $Trap1Floor)
{
goto trap
}
end
trap:
$TrappingDoor1 moveto $TrappingDoor1Floor
$TrappingDoor1 time 3
$TrappingDoor1 move
waitthread crush
wait 2
$TrappingDoor1 moveto $TrappingDoor1Roof
$TrappingDoor1 time 3
$TrappingDoor1 move
end
crush:
$Crusher1 moveto $Crushed1
$Crusher1 time 10
$Crusher1 waitmove
wait 3
$Crusher1 moveto $CrusherUp1
$Crusher1 time 5
$Crusher1 move
end
As you may notice, I added some space between each thread to allow easy reading.
Notify me if you encounter any more errors.
Good Luck!
Posted: Wed Jul 27, 2011 7:56 pm
by jv_map
17thairborne wrote:Is there a better text editor out there for Windows XP?
Probably. I doubt anyone could name a
worse text editor than notepad
Seriously though, I love UltraEdit but it's not free. Hallways have it notepad++ is decent too

Posted: Thu Jul 28, 2011 11:50 pm
by 17thairborne
Thanks all for your help! I have been through a lot of the problems and found out much more about the game. I will be mapping more and hope to have a map soon! Also, I haven't gotten any replies on my thread "Invisible ammo boxes". I am having a lot of trouble with that. my first test map is usable, but it is not as realistic with invisible ammo boxes and mgs (also player wepons). Thank you all!
Thanks,
17thairborne
You're welcome!
Posted: Thu Jul 28, 2011 11:56 pm
by Cpt. Duke
You're very welcome, 17thairborne! I'm glad to help.
By the way, shouldn't this thread be located in the "scripting" forum?
Re: You're welcome!
Posted: Sat Jul 30, 2011 9:28 am
by jv_map
Cpt. Duke wrote:By the way, shouldn't this thread be located in the "scripting" forum?
Haha you're right, completely overlooked it. Moved

scripting question
Posted: Thu Aug 25, 2011 2:46 pm
by luke9511
is there a way ti make a auto team balance script or is there already one made for mohaa?
Posted: Thu Aug 25, 2011 7:52 pm
by jv_map
Yes to both questions, although I cannot directly point you to an existing script. Google is your friend

Posted: Thu Aug 25, 2011 9:32 pm
by luke9511
sir you dont know how long i have been searching google am up to page 112 of google and so far only stuff i have found is dead links or something not related at all
Posted: Fri Aug 26, 2011 3:44 pm
by jv_map
Posted: Sun Aug 28, 2011 3:10 am
by neillomax
sir?........ wow, you're moving up.... LOL
Posted: Sun Aug 28, 2011 8:43 pm
by knifepoint
From my experience most auto-balance mods don't even work properly anyway. I have tried several ones over the years and they have unbalanced the teams unnecessarily and/or had ridiculous delays
Posted: Mon Aug 29, 2011 7:08 pm
by jv_map
Sounds like a great opportunity to learn some scripting
I say sir to anyone who's got more posts than me

2 bombs script
Posted: Sun Sep 04, 2011 2:25 pm
by janiegotagun
i want to make a script for 2 bombs objective. the script for one bomb was working fine but cant make the second bomb work. my script file goes like this , someone please point out the mistakes. then name of 1st bomb is panel_bomb, and second is panel_bomb2
main:
setcvar "g_obj_alliedtext1" "Destroy the fuckin jeep"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" "" setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ":S save that jeep"
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none"
level waittill prespawn
exec global/DMprecache.scr
level.script = maps/obj/cust_obj_test.scr
exec global/ambient.scr cust_obj_test
thread global/exploder.scr::main // Initialize the exploder subsystem
level waittill spawn
level.defusing_team = "axis" // Axis like the bombs unplanted
level.planting_team = "allies" // Allies will try to plant the bombs
level.targets_to_destroy = 2 // Number of targets in this map
level.bomb_damage = 200 // Default damage of the bomb
level.bomb_explosion_radius = 2048 // Default radius of bomb blast
// Set the parameters for round based match
level.dmrespawning = 1 // 1 or 0 (0=no respawn)
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw
//level waittill roundstart // Comment out this line using '//' before it to be able to set the bomb when alone on the map ( just for testing )
$panel_bomb thread global/obj_dm.scr::bomb_thinker // "panel_bomb" is the targetname set on the bomb in MOHRadiant
thread allies_win_bomb // Start the win check thread for allies
$panel_bomb thread axis_win_timer // Start the win check thread for axis
$panel_bomb2 thread global/obj_dm.scr::bomb_thinker // "panel_bomb" is the targetname set on the bomb in MOHRadiant
thread allies_win_bomb // Start the win check thread for allies
$panel_bomb2 thread axis_win_timer // Start the win check thread for axis
end // end of main
// Allied victory test
allies_win_bomb:
while(level.targets_destroyed < level.targets_to_destroy) // While undestroyed objectives left
waitframe // chill out
teamwin allies // No objectives left allies win
end // end allied victory test
// Axis victory test
axis_win_timer:
level waittill axiswin // At the end Axis win
end // end axis victory test