Page 1 of 2
(hopefully) a simple script question
Posted: Wed Mar 26, 2003 7:46 pm
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"
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
Posted: Thu Mar 27, 2003 12:45 am
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

Posted: Thu Mar 27, 2003 12:47 am
by nuggets
technical error
put iprintlnbold "is it working"
not iprintlnbold (is it working) as previously stated
sorry, drink doesn't help

Posted: Thu Mar 27, 2003 6:42 am
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.
Posted: Thu Mar 27, 2003 7:48 pm
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.
Posted: Thu Mar 27, 2003 8:00 pm
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.
background sound
Posted: Thu Mar 27, 2003 11:55 pm
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.
Posted: Fri Mar 28, 2003 3:06 am
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.
Posted: Fri Mar 28, 2003 1:37 pm
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
Posted: Fri Mar 28, 2003 1:55 pm
by mohaa_rox
What i mean is I used
println "HAHAHA!!!!!"
It had an unknown command error. Cause i left out the
iprintln
Posted: Fri Mar 28, 2003 1:56 pm
by jv_map
println is a valid command.
Posted: Sat Mar 29, 2003 5:15 am
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.
screenshot
Posted: Sat Mar 29, 2003 5:55 am
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.
Posted: Sat Mar 29, 2003 6:53 am
by mohaa_rox
And remember to reduce your image size to 640x480.
Posted: Sat Apr 12, 2003 12:15 am
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.