Page 1 of 2

Usable static weapons added to existing MOHAA DM maps?

Posted: Thu Jun 26, 2003 7:55 pm
by IvanTheTerrible
Is it possible to add usable static weapons to existing MOHAA DM maps using only scripting? For example: adding a usable flak88 to Southern France. Please understand that I am a scripting noob so detailed responses would be greatly appreciated. I am familiar with editing files to incorporate and modify prewritten script. Also, any suggestions on learning reasources for begining scriptors would be welcome.

Posted: Thu Jun 26, 2003 8:19 pm
by Alcoholic
i think its possible. you'd have to spawn the weapon, give it an origin, and then spawn a trigger or something. the trigger would have to be axial though. dont really have the time to write out how though, working on a map.

Thanks Alki

Posted: Thu Jun 26, 2003 10:43 pm
by IvanTheTerrible
I know how to add static objects to a map so I will attempt to do the same thing with the existing trigger entity.

Posted: Thu Jun 26, 2003 11:07 pm
by stuffmess2001
when you add the thing to the scrpit what script do you add it too

Posted: Fri Jun 27, 2003 1:24 am
by Krane
As far as I know yes, you can do it. For that you'll have to modify the original script of the map (I mean, create another script based on the original but w/ your Flakk88). You'll have to save it with the same name of the previous script and make a pk3 file that will "override" the original script. That will make your new map conflict with the original maps, so when playing normal maps, you'll have to remove your pk3 file.

If you want all this, I'm sure someone will help you here (I'm a noob for that).

That part I understand...but...

Posted: Sun Jun 29, 2003 9:06 am
by IvanTheTerrible
I understand how the scripting in the pk3 file overrides the scripting in the original file. The problem is how to spawn a trigger using scripting instead of drawing it into a map like in Radient.

Posted: Sun Jun 29, 2003 9:15 am
by Alcoholic
local.trigger = spawn trigger_multiple
local.trigger.origin = (type in coords of where you want to spawn it)
local.trigger setsize = (specify size) x y z axis.

How I hate the Flak 88

Posted: Sun Jun 29, 2003 6:12 pm
by IvanTheTerrible
As always I appreciate the help Alki. Unfortunately, as soon as I add the local.trigger lines the entire pk3 file gets ignored. Here is the script as I entered it for a test:

//Add Usable Flak88
local.flak = spawn script_model
local.flak model "statweapons/flak88turret.tik"
local.flak.origin = ( 225.00 -400.00 30.00)
local.flak.angles = ( 0 90 0 )
local.flak.scale = 1.0
local.trigger = spawn trigger_multiple
local.trigger.origin = ( 170 -560 20)
local.trigger setsize = ( 100 100 100 )

Posted: Sun Jun 29, 2003 8:23 pm
by nuggets
copy all the script from the .pk3 into your script

as for the spawning you'll need some more things

local.trigger = spawn trigger_multiple "setthread" "my_thread"
local.trigger.origin = (type in coords of where you want to spawn it)
local.trigger setsize = (specify size) x y z axis.

then have my_thread local.flak.etc... :P

Posted: Mon Jun 30, 2003 8:12 am
by mohaa_rox
maybe save ur pk3 as zzzuser-myflak.pk3

Posted: Tue Aug 19, 2003 8:12 pm
by Bjarne BZR
How about this instead:

local.flak = spawn turretweapon_german_88mmflakturret

?

Posted: Tue Aug 19, 2003 8:16 pm
by Bjarne BZR
Correct me if I'm wrong here:

If we knew how the mg42 can work directly when you spawn it ( how it connects to the mg42.scr ) with triggers and stuff, then: shurely it wont be a problem to make a Flak88 usable in the same way...

Or?

Posted: Tue Aug 19, 2003 9:58 pm
by Alcoholic
oh yeah, i got the setsize syntax wrong. :oops:

you have to set the x y z starting vector, then the xyz ending vector. so if you want it to be 100^3, you would type "local.thing setsize (0 0 0) (100 100 100)"

Posted: Wed Aug 20, 2003 12:29 am
by Bjarne BZR
Muahahaha!

Here you go, a firable flak88, only by scriting...

have the line

Code: Select all

thread spawn_a_flak88
in main ( after level waittill prespawn )

and insert these methods after main:

Code: Select all

spawn_a_flak88:

	local.flak = spawn script_model "targetname" "flak88"
	local.flak model "statweapons/flak88turret.tik"
	local.flak.origin = ( 0.0 -100.0 0.0 )
	local.flak.angles = ( 0.0 0.0 0.0 )
	local.flak.scale = 1.0
	local.trigger = spawn trigger_use "setthread" "fire_flak88"
	local.trigger.origin = ( 0.0 0.0 0.0 ) 
	local.trigger setsize ( -50 -50 -50 ) ( 50 50 50 )
	
end

fire_flak88:
	iprintlnbold_noloc "Bang!"
	local.target = ( 0.0 100.0 0.0 )
	// Start the main gun fire animation.
	$flak88 anim fire_scripted

	// Random wait to give time to the shell to get to the target. 
	wait 1


	// Spawn the explosion animations. 
	local.Exp1 = spawn "fx/scriptbazookaexplosion.tik"
	local.Exp2 = spawn "animate/fx_mortar_dirt.tik"
	local.Exp3 = spawn "animate/fx_mortar_higgins.tik"

	// Shake the ground hard.
	exec global/earthquake.scr .23 4 0 0

	// Get the animations going.
	local.Exp1.origin = local.target
	local.Exp1 anim start

	local.Exp2.origin = local.target
	local.Exp2 anim start

	local.Exp3.origin = local.target
	local.Exp3 anim start

	wait 1

	// Remove the animations.
	local.Exp1 remove
	local.Exp2 remove
	local.Exp3 remove

end
- There is no fire sound when the flak88 fires.
- It is only activateable by the trigger, not really usable as an mg42.
- But that, you can probably work out for your self.

This is just to tell you it can be done. Hope that helps.

This was funny :D

Posted: Wed Aug 20, 2003 3:05 am
by Bjarne BZR
Oops! I did it again...

... a new tutorial: Creating a triggerable Flak88 in a multiplayer map