exploder.scr

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

exploder.scr

Post by solar »

I have a couple questions concerning scripting exploders and given the fact that I have no scripting experience, please respond in a manner that my dull mind wil comprehend:

1. I've looked at both tuts on this site (Wombat's and Bjarnes) and in Wombat's tut, the very first thing after main is the
"exec global/exploder.scr" command. it is before level waittill prespawn. Bjarne's doesn't even have that command but has this instead after level waittill prespawn: thread global/exploder.scr::main
He explains that this initializes the exploder subsystem. Do these two commands do the same things? I'm following Bjarne's tut and I don't have wombat's line in my script. Someone please explain this to me.

2. In both tuts, their "level.script =" line refers to the path with a custom or tutorial line. Do I have to put the filename of my script there instead? What is the purpose of that line?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Exec runs a script file starting at the first line until it reaches an end. In this case, a thread command referring to the first label ('main:') does exactly the same. Actually I think it's neater to run a thread than to run a script, but it doesn't matter much as long as you're not using waitexec.

The level.script line has no use at all, except some of the global script use it (which is not good). The original developers used it to cheat and adapt the global scripts to the needs of their maps.

*bah*

These global scripts use level.script:
ai.scr
alarmer.scr
ambience.scr <--- stupid script
barrel.scr
bomber.scr
chainspawner.scr
friendly.scr
loadout.scr <--- stupid script
patrol_path.scr
savenames.scr <--- stupid script
vehicles_thinkers.scr
Image
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

man, I feel like I can go take on the scripting world now!!! Thx again jv_map.
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

OK, I've implemented my exploder objective and guess what... it doesn't work. Below is the script so please take a look at it and show me my errors.

script:
main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none"




level waittill prespawn


//***Precache Dm Stuff
exec global/DMprecache.scr
level.script=maps/obj/cust_obj_test.scr
exec global/ambient.scr cust_obj_test
thread global/exploder.scr::main

level waittill spawn


//obj setup
level.defusing_team = "axis" // Axis like the bombs unplanted
level.planting_team = "allies" // Allies will try to plant the bombs
level.targets_to_destroy = 1 // 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 = 0 // 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
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






I've tested it as an obj map, and as a single player map. Doublechecked all k/v pairs and they are exactly like the tut. I set up my explodersmashed layout, but they are all visible in game. Someone tell me what I'm doing wrong. Thx
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Check your console for errors.
Image
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

ok, it has a whole bunch of these:
^~^~^ Add the following line to the *_precache.scr map script:
cache models/animate/electrical_switch_nopulse.tik
Where exacly do I add them???
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

Also, I read the global exploder script and it says that the explodesmashed script objects have to occuppy the same space as their exploder counterparts. But isn't their away to make debris that lays around the explosion site after the bomb goes off?? That's what I would like to do.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I think you can use explodersmashed objects to create debris, that should work fine.

Don't worry about those precache errors yet. To find out what they mean, do a search ;)

Try to find more useful errors concerning your exploders. Errors might occur when loading your map or when the bomb goes off.
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

No need

Post by tltrude »

For an objective map you don't need to preload the exploder script. That type game calls up the exploder script for you in the obj_dm.scr script when the bomb goes off. You would only need it if you want to make, say, a wall explode when the bomb goes off.

Your script looks right, so it must be something in your map. Does the stopwatch pop up when you use the bomb trigger? The trigger should be named something like "panal_bomb_trigger" and the bomb itself should have key: $trigger_name , value: panal_bomb_trigger.

Yes, anything targetnamed "explodersmashed" will be hidden and will show up when the "exploder" vanishes. It is the destroyed version of what you have targetnamed "exploder". You should also put Key: #set , value: 1 for each script_object entity you add so that the exploder script knows which explosion it is for.

You can targetname rubble as explodersmashed also, but it will pop up as soon as the explosion is triggered. So, you may want to delay it untill your "exploderfire"(s) hide it from view and your "exploderchunk"(s) fall. You can do that by adding key: #pause and value: (time you want in seconds).
Last edited by tltrude on Tue Apr 08, 2003 1:12 pm, edited 3 times in total.
Tom Trude,

Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Before starting the map: Write logfile 1 ( to start a new logfile ) or logfile 2 ( to keep writing in the old one ) in the consol, to get a text file named qconsole.log in main that will contain all printouts in the consol...

Look for something like:

Code: Select all

Spawned ExploderSmashed 1
Spawned ExploderChunk 1
Spawned ExploderChunk 2
Spawned ExploderChunk 3
Spawned ExploderChunk 4
Spawned ExploderFire 1
Spawned ExploderFire 2
Spawned ExploderFire 3
Spawned Exploder 1
in the file, and around ( probably after ) this area there will probably be some errors from the exploder system... these may hint on whats wrong... post them and well see what we can whip up to fix this for you.
Admin .MAP Forums
Image
Head above heels.
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

Thanks for your replies. Specifically my exploder is an oil tank and I have the script model bomb attached to the side on an inverted cap brush. I noticed as I was reviewing it that the bomb was intersecting the cap, not to mention that the trigger use was not completely around the bomb on all sides. So I'm compiling now, and when I get home, I'll see if that was the problem. Still can't see why that would keep my explodersmashed script objects visible, but we'll see. I'll post the results in a few hours.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

That SHOULD ( fingers crossed ) have nothing to do with it... but stranger things have happened :twisted: Try making a log file with the new map... if you understand nothing in it, maby someone here will...
Admin .MAP Forums
Image
Head above heels.
solar
Colour Sergeant
Posts: 99
Joined: Fri Mar 21, 2003 2:40 pm
Location: Toledo, OH

Post by solar »

OK, there was something in a part of my script relating to something else that was screwing it all up. I omitted that section and now it explodes just fine. I'll just work on that other part later.

Next question. I also want to use Bjarne's "Stealing the documents" objective, so how do I change my script so that it allows for both. Eventually, I want three objectives in this map but the win condition comes if you complete any two of them.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

U are in luck: Here is my tutorial on "Multiple multiplayer objectives"
http://www.planetmedalofhonor.com/rjuka ... orial.html
Admin .MAP Forums
Image
Head above heels.
Post Reply