Lost + found

Post your scripting questions / solutions here

Moderator: Moderators

Locked
User avatar
Cpt. Duke
Sergeant
Posts: 72
Joined: Sun Feb 13, 2011 4:29 pm
Location: United States of America

Re: Scripting Errors???

Post by Cpt. Duke »

That's funny. I had the same exact problem with my first attempt at scripting! :lol:

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:

Code: Select all

mymapname.scr
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! :oops:
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!
User avatar
17thairborne
Corporal
Posts: 40
Joined: Sat Feb 05, 2011 12:18 pm

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

Image

Any ideas on the "Broken Script" Part?

Thanks, 17thairborne
User avatar
Cpt. Duke
Sergeant
Posts: 72
Joined: Sun Feb 13, 2011 4:29 pm
Location: United States of America

Re: Scripting Errors???

Post by Cpt. Duke »

Oh yes, I get this error very frequently. :roll:

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

Post 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 :roll:

Seriously though, I love UltraEdit but it's not free. Hallways have it notepad++ is decent too :)
Image
User avatar
17thairborne
Corporal
Posts: 40
Joined: Sat Feb 05, 2011 12:18 pm

Post 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
User avatar
Cpt. Duke
Sergeant
Posts: 72
Joined: Sun Feb 13, 2011 4:29 pm
Location: United States of America

You're welcome!

Post by Cpt. Duke »

You're very welcome, 17thairborne! I'm glad to help. :D

By the way, shouldn't this thread be located in the "scripting" forum?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Re: You're welcome!

Post 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 :)
Image
luke9511
Private
Posts: 6
Joined: Mon Feb 15, 2010 9:58 pm

scripting question

Post by luke9511 »

is there a way ti make a auto team balance script or is there already one made for mohaa?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yes to both questions, although I cannot directly point you to an existing script. Google is your friend :)
Image
luke9511
Private
Posts: 6
Joined: Mon Feb 15, 2010 9:58 pm

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

Post by jv_map »

Image
neillomax
Lieutenant General
Posts: 880
Joined: Thu Jun 23, 2005 6:57 am

Post by neillomax »

sir?........ wow, you're moving up.... LOL
knifepoint
Corporal
Posts: 46
Joined: Sat Jul 07, 2007 1:22 pm

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

Post by jv_map »

Sounds like a great opportunity to learn some scripting :wink:

I say sir to anyone who's got more posts than me :)
Image
janiegotagun
Private
Posts: 2
Joined: Sat Sep 03, 2011 2:28 pm

2 bombs script

Post 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
Locked