3 bombs but trying to require 2 in order to win. HELP

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
carbinecollector
Private
Posts: 2
Joined: Sat Sep 14, 2013 5:03 am

3 bombs but trying to require 2 in order to win. HELP

Post by carbinecollector »

I have spent the last 5 months building and perfecting a new custom map for mohaa, the mapping is finished ! however I can not figure out how to get the script to work the way i need it to. The map has 3 objective bombs and i need the map to end when any of the 2 bombs are destroyed. I have spent the past 2 weeks reading .map and on modT and looking through .scr's to figure out how but with no luck. So here i am begging for help !

as of now all three bombs have to be exploded for the round to end.......

Code: Select all

main:


// set scoreboard messages
	setcvar "g_obj_alliedtext1" " Protect the Mine "
	setcvar "g_obj_alliedtext2" " at all costs!"
	setcvar "g_obj_alliedtext3" " "
	setcvar "g_obj_axistext1" "[]Destroy Power Center"
	setcvar "g_obj_axistext2" "[]Destroy Fan"
	setcvar "g_obj_axistext3" "[]Destroy Substation"	
	setcvar "g_scoreboardpic" "deepmine"

level waittill prespawn

	//*** Precache Dm Stuff
	exec global/DMprecache.scr
	level.script = maps/obj/deepmine.scr

// Initialize the exploder subsystem
   exec global/exploder.scr
   thread global/exploder.scr::main

	thread wallbomb_wait
	thread wallbomb_wait2

   level waittill spawn

   level.defusing_team = "allies
   level.planting_team = "axis"
   level.targets_to_destroy = 2
   level.bomb_damage = 200
   level.bomb_explosion_radius = 2048
   level.dmrespawning = 1 // 1 or 0 (0=no respawn)
   level.dmroundlimit = 7 // round time limit in minutes
   level.clockside = allies // axis, allies, kills, or draw

   // level waittill roundstart

       $substation thread global/obj_dm.scr::bomb_thinker
       $fanbomb thread global/obj_dm.scr::bomb_thinker
       $powercenter thread global/obj_dm.scr::bomb_thinker

   $substation thread axis_win_bomb $substation $fanbomb $powercenter

   $substation thread allies_win_timer

 end // end of main

 // Axis victory test
axis_win_bomb local.bomb1 local.bomb2 local.bomb3:

	while ((local.bomb1.exploded != 1) && (local.bomb2.exploded != 1) && (local.bomb3.exploded != 1))
		wait .1

   teamwin axis
 end


 // Allies victory test
 allies_win_timer:

   level waittill allieswin
 end


	// ----- ----- ----- ----- ----- -----
	// ----- WALL EXPLODER --- ----- -----
	// ----- ----- ----- ----- ----- -----		
	
wallbomb_wait:
	$walltrigger waittill trigger
	$plunger playsound plunger
        exec global/exploder.scr
	$plunger anim "fire"
	wait 0.8
        thread global/exploder.scr::explode 1
        exec global/earthquake.scr .30 12 0 0
        radiusdamage $wallbomb.origin 640 384	
	$wallbomb remove
	$walltrigger nottriggerable
        println "The mine face has been comprimised!"
		iprintlnbold_noloc "The mine face has been comprimised!"	
	end

	// ----- ----- ----- ----- ----- -----
	// ----- WALL EXPLODER 2 - ----- -----
	// ----- ----- ----- ----- ----- -----		

wallbomb_wait2:
	$walltrigger2 waittill trigger
	local.player = parm.other
	$plunger2 playsound plunger
	$plunger2 anim "fire"
	wait 0.8
	thread global/exploder.scr::explode 2
        exec global/earthquake.scr .30 12 0 0
        radiusdamage $wallbomb2.origin 640 384
	$wallbomb2 remove
	$walltrigger2 nottriggerable
        println "The axis have blown holes under the mine!"
		iprintlnbold_noloc "The axis have blown holes under the mine!"	
	end
BatteryAziz
Moderator
Posts: 82
Joined: Tue Jun 15, 2010 4:44 pm

Re: 3 bombs but trying to require 2 in order to win. HELP

Post by BatteryAziz »

i could help you here however i also replied to your thread on modtheater (my username is saaaimen). the main thing is getting the logic behind your statements right FIRST, before worrying about the exact syntax of the script. i assume what it's doing now (with the script you posted here) it immediately goes axis win after 1 bomb has exploded. why? because that's exactly what it says! :P to make it work using bombnum.exploded you'd have to use AND (&&) with OR (||) combined.. while NOT bomb1 AND bomb2 exploded, OR NOT bomb1 AND bomb3 exploded, OR NOT bomb2 AND bomb3 exploded, waitframe. if either of these combinations ARE exploded, teamwin axis. note that you'd need to say if NOT combination of exploded, wait, otherwise it'd go directly onto teamwin axis.
you'll see that this method doesn't scale so well going with more and more bombs/objectives. what makes way more sense is using targets_destroyed as per usual. start at targets_destroyed = 0, do targets_destroyed++ when you blow up an objective. then: WHILE targets_destroyed < targets_to_destroy, waitframe. after that, teamwin axis.

hope this makes sense. worry about the logical statements first, THEN get the syntax right.
carbinecollector
Private
Posts: 2
Joined: Sat Sep 14, 2013 5:03 am

Re: 3 bombs but trying to require 2 in order to win. HELP

Post by carbinecollector »

THANK YOU ! With the help of this post my masterpiece is completed ! I do not see an upload area on .map but if you check ModTh in just a few minutes i will have it uploaded there for download if youd like to look it over. Thanks again batt
BatteryAziz
Moderator
Posts: 82
Joined: Tue Jun 15, 2010 4:44 pm

Re: 3 bombs but trying to require 2 in order to win. HELP

Post by BatteryAziz »

great! looking forward to it.
Post Reply