Weapon mod...its a hard one

Post your scripting questions / solutions here

Moderator: Moderators

HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Weapon mod...its a hard one

Post by HeavenBound »

Ok, so I don't even come close to knowing how to do this, but here's what I want.

I have a rifles mod already that does what I want, but on Stalli I want something different. I want sniper only on Stali, but the rest to go back to my rifles mod....So $or or any other smart person, how do I do that? :?
HeavenBound

I'm new at this :)
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

* Sees an opportunity to shamelessly push own mod *

Get squadmaker :)

http://medalofhonor.filefront.com/file/Squadmaker;69103

It's not difficult to make squad configs for rifle only and sniper only, and you can tell the server to use a particular config for a specific map.
Image
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

Looks interesting, BUT....Couldn't I just do a waitthread global/rifle.scr::sniper if i make a thread in my rifles mod to give snipes instead of rifles?
HeavenBound

I'm new at this :)
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Show what's in that rifle script.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

Code: Select all

if !(getcvar "rifle") {end}  

waitframe
waitframe
local.n = randomint 99999
self weaponcommand mainhand targetname ("w" + local.n)
local.weapon = $("w" + local.n).model
self weaponcommand mainhand targetname ""

switch(local.weapon)
{
case "models/weapons/springfield.tik":
case "models/weapons/thompsonsmg.tik":
case "models/weapons/bar.tik":
case "models/weapons/bazooka.tik":
                self takeall
                self give "models/weapons/kar98.tik"
		self give "models/weapons/m2frag_grenade.tik"
		self give "models/weapons/colt45.tik"
                waitframe
                self use "models/weapons/kar98.tik"
                break

case "models/weapons/kar98sniper.tik":
case "models/weapons/mp40.tik":
case "models/weapons/mp44.tik":
case "models/weapons/panzerschreck.tik":
                self takeall
                self give "models/weapons/m1_garand.tik"
		self give "models/weapons/steilhandgranate.tik"
		self give "models/weapons/p38.tik"
                waitframe
                self use "models/weapons/m1_garand.tik"
                break    
}

...
HeavenBound

I'm new at this :)
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Keep the script, but change it to:

Code: Select all

main:
if (self == NULL)
     end

waitframe
waitframe
local.n = randomint 99999
self weaponcommand mainhand targetname ("w" + local.n)
local.weapon = $("w" + local.n).model
self weaponcommand mainhand targetname ""

if (getcvar "rifle" == "1")
{
     switch(local.weapon)
     {
              case "models/weapons/springfield.tik":
              case "models/weapons/thompsonsmg.tik":
              case "models/weapons/bar.tik":
              case "models/weapons/bazooka.tik":
                self takeall
                self give "models/weapons/kar98.tik"
                self give "models/weapons/m2frag_grenade.tik"
                self give "models/weapons/colt45.tik"
                waitframe
                self use "models/weapons/kar98.tik"
                break

              case "models/weapons/kar98sniper.tik":
              case "models/weapons/mp40.tik":
              case "models/weapons/mp44.tik":
              case "models/weapons/panzerschreck.tik":
                self takeall
                self give "models/weapons/m1_garand.tik"
                self give "models/weapons/steilhandgranate.tik"
                self give "models/weapons/p38.tik"
                waitframe
                self use "models/weapons/m1_garand.tik"
                break   
     } 
}
else if ( (getcvar "sniper") == "1")
{
              case "models/weapons/springfield.tik":
              case "models/weapons/thompsonsmg.tik":
              case "models/weapons/bar.tik":
              case "models/weapons/bazooka.tik":
                self takeall
                self give "models/weapons/KAR98sniper.tik"
                self give "models/weapons/m2frag_grenade.tik"
                self give "models/weapons/colt45.tik"
                waitframe
                self use "models/weapons/KAR98sniper.tik"
                break

              case "models/weapons/kar98sniper.tik":
              case "models/weapons/mp40.tik":
              case "models/weapons/mp44.tik":
              case "models/weapons/panzerschreck.tik":
                self takeall
                self give "models/weapons/springfield.tik"
                self give "models/weapons/steilhandgranate.tik"
                self give "models/weapons/p38.tik"
                waitframe
                self use "models/weapons/springfield.tik"
                break   
     } 
}
end
Now set the "rifle" cvar to 0 and the "sniper" cvar to 1 on that specific map (in that mapscript after prespawn)
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

Your so smart :lol: :P
HeavenBound

I'm new at this :)
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

Cept...its not working....


When I add it to the map script, Freeze-Tag doesn't work....
HeavenBound

I'm new at this :)
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Why in the world would you add it to the mapscript?? :? Of couse it won't work, scripts unload when there are 2 duplicate labels.

I told you to replace the rifle.scr with this new script (keep the name) and put this after waittill spawn/prespawn on the map you want snipers instead of rifles:

Code: Select all

setcvar "rifle" "0"
setcvar "sniper" "1"
:)
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

oh, i read it wrong....
but how in the world would i do it automatically?

I mean, its rifles only the whole time, but 1 map. Can i do that w/ mefy's ext gametype in my cfg? ex.:

Code: Select all


set g_extgametype_mohdm2 ft set rifle 1
set g_extgametype_mohdm6 ffa set sniper 1
set g_extgametype_mohdm3 ft set rifle 1
set g_extgametype_mohdm1 ffa set rifle 1
set g_extgametype_mohdm7 ft  set rifle 1

I know that won't work, but how can I do it automatically? lol
HeavenBound

I'm new at this :)
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Automatically? Well I just told you twice (3 times now); add these 2 lines after prespawn in stalingrad's mapscript:

Code: Select all

setcvar "rifle" "0"
setcvar "sniper" "1"
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

ahhh im blind, stupid, and well anything but smart @ the moment. :oops: :oops: Sorry Sor.
HeavenBound

I'm new at this :)
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

well...now that i've done everything u said..it still does not work. The rifle part of it doesn't even work. but its ok, apperently the other Clan Leader just wants a seprate server to run Stali 24/7 lol

Thanks anyway =)
HeavenBound

I'm new at this :)
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

I'm not sure to have understood very well...
Why don't ya seply run a script from your maps, where you set the weapons..or make your own script to be exec from dmprechace that exploit the map cvar and select different mods dipending on it...
should be easyer in my opinion then use other peopple mods..if you're not the maker(almost for me), it's hard to use a mod with all his functions... :?
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

That's why I never use someone else's scripts.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
Post Reply