(hopefully) a simple script question

Post your scripting questions / solutions here

Moderator: Moderators

nihilo
Sergeant Major
Posts: 107
Joined: Thu Mar 13, 2003 6:07 am

(hopefully) a simple script question

Post by nihilo »

I'm attempting to make an objective level. The basic idea is that allies must destroy the radio in the church. I've made the level, and with the help of tutorials placed a radio and a bomb, but MOHAA doesn't recognize my script. I'm not sure what's going on, so I'll throw a bunch of information at you. Here's my script:

"advance.scr"

Code: Select all

main:

//set scoreboard messages
setcvar "g_obj_alliedtext1" "Destroy the radio"
setcvar "g_obj_alliedtext2" "in the church"
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "Defend the radio"
setcvar "g_obj_axistext2" "in the church"
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none"


level waittill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/ambient.scr m4l1

level.script = maps/obj/advance.scr
exec global/ambient.scr advance

level waittill spawn

level.bomb_damage = 200
level.bomb_explosion_radius = 320
level.defusing_team = "axis"
level.planting_team = "allies"
level.targets_to_destroy = 1
level.dmrespawning = 1
level.dmroundlimit = 5
level.clockside = axis

//level waittill roundstart

$radio_explosive1 thread global/obj_dm.scr::bomb_thinker

$radio_explosive1 thread axis_win_timer

thread allies_win_bomb


end

axis_win_timer:

level waitillaxiswin

end

allies_win_bomb:

while(level.targets_destroyed < level.targets_to_destroy)
wait frame

teamwin allies

end

here's my precache script "advance_precache.scr"

Code: Select all

exec global/DMprecache.scr
note: radio_explosive1 is the bomb, and I commented out
level waittill roundstart
so that I could set the bomb without having another person in the level.

So yeah, any input you might have would be helpful. I don't think it's using my script at all because the message doesn't show up on the scoreboard.

Thanks
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 »

put under your scirpt after

level waittil spawn
iprintlnbold (is it working)

that way you will know if it is really reading the script, if not then i'll have a closer look 2moro, i'm a little bit drunk right now :D
hope this helps, prob not cos it's all foreign 2 me :-/
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 »

technical error :P

put iprintlnbold "is it working"

not iprintlnbold (is it working) as previously stated

sorry, drink doesn't help :P
hope this helps, prob not cos it's all foreign 2 me :-/
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

You need to be careful with spaces in scripts ;), it's notlike regularwrit ing.

level waitillaxiswin

should be

level waitill axiswin

or even better: miss out the axis_win_timer thread completely.

wait frame

should be

waitframe

Also, I'm not quite sure if you can use 'exec' in your precache script.
Image
nihilo
Sergeant Major
Posts: 107
Joined: Thu Mar 13, 2003 6:07 am

Post by nihilo »

Ahh.. I gotta admit, I know C++, but I'm sorta picking up java as I go. Looks like the same old stupid errors I always get. If I was to get rid of the axis_win_timer thread (function, in my mind), would it still work? I mean, by setting it up so that defusing_team = "axis", do the axis automatically win if time runs out?

Secondly, what do you mean about removing the exec from my precache script? According to the Basic Script file that comes with MOHRadiant, that's the only line that goes in there. In another .pk3 I made, I set it up like that and it worked just fine. Am I calling dmprecache twice by calling it in the advance.scr script too?

Anyway, I'll make those changes and tell you how it turns out.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

axis_win_timer is not a function as it doesn't return a value (it doesn't do anything at all actually).

The team that wins when the timelimit is hit is set by the level.clockside variable. If you set level.clockside = axis, Axis will win when the time has expired. You can also set it to allies, kills or draw.

I was a bit worried about the 'exec' command in the precache script as precache scripts are not real scripts. Only a few commands are allowed and for some reason syntaxis is a little different.

For example:
println hello
will work just fine,
println "hello world"
will cause an error :?.

You are calling the precache script twice, but that's not a serious problem. Cache commands are ignored if the resource is already cached.
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

background sound

Post by tltrude »

One way to tell if your srcipt is running is if you hear the background sound after the map loads. In your case I don't think you'll hear anything because you have it looking for a file named "advance.mus" for the sound.

exec global/ambient.scr advance

Try using this line:

exec global/ambient.scr mohdm7

the mohdm7.mus file plays a brackground sound that is just wind and no battle sounds. Also make sure your BSP file is named advance.bsp--dumb, but it happens.

Ps: Just noticed you have two lines for background sound: exec global/ambient.scr m4l1 . Take one out.
Tom Trude,

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

Post by mohaa_rox »

jv_map wrote: For example:
println hello
will work just fine,
println "hello world"
will cause an error :?.
Yeah, that time i forgot the "i" infront of the print and it had an "unknown command" error.
Live to map, not map to live.
-mohaa_rox, .map
moderator
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

mohaa_rox wrote:Yeah, that time i forgot the "i" infront of the print and it had an "unknown command" error.
Not sure what you mean :?.

Available commands:
println -> prints to console
$player iprint -> prints to player screen
iprintln(bold)(_noloc) -> prints to all player's screens
Image
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

What i mean is I used

println "HAHAHA!!!!!"

It had an unknown command error. Cause i left out the

iprintln
Live to map, not map to live.
-mohaa_rox, .map
moderator
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

println is a valid command.
Image
nihilo
Sergeant Major
Posts: 107
Joined: Thu Mar 13, 2003 6:07 am

Post by nihilo »

Good news, I made the changes and now the script works (you can blow up the radio in the church). I took out the Axis_win_timer thread (not sure why I had it either, given what you told me), and I'm starting play testing with my friends. When I've tweaked it until I'm satisfied, I'll spread the wealth, so to speak. Question 'cause I'm an idiot: what the key for screenshot? Is it print screen? I'd like to take some pictures and show it off a bit.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

screenshot

Post by tltrude »

F12 makes screenshots in a folder in main, but they are TGA format images that are too big to post on the net. If you can, convert them to lower quality JPG images and reduce the size by around 50%. The print scrn key will store a single image in your windows clipboard, waiting for you to paste it to a graphics program--like Windows Paint, or even better, PaintShop.
Tom Trude,

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

Post by mohaa_rox »

And remember to reduce your image size to 640x480.
Live to map, not map to live.
-mohaa_rox, .map
moderator
nihilo
Sergeant Major
Posts: 107
Joined: Thu Mar 13, 2003 6:07 am

Post by nihilo »

Hmm, hate to revive an old post, but I seem to be running into difficulties again. I played the map (for real, this time) with my friends and was embarassed to discover that even though the radio blows up, the allies don't win for doing it. As well, anyone standing beside the bomb as it goes off doesn't die. Any ideas? The bomb goes off and the radio destroys, but nothing else happens.
Post Reply