Alliedassault

Alliedassault (alliedassault.us/index.php)
-   MoH Maps, Mods & Skins (alliedassault.us/forumdisplay.php?f=11)
-   -   scripting help? (alliedassault.us/showthread.php?t=29500)

bluebrooks 08-28-2003 03:37 PM

it's in this thread in red above...^^^^^

chipsdw 08-28-2003 04:01 PM

i see... well i have a more daunting task... can u explain all the code with comments... like repost the script with comments explaining what stuff does.... see im a n00b scripter trying to learn how to do this, so it would be a tremendous help to me. thank you!

bluebrooks 08-28-2003 04:13 PM

randommine1:
(this line names the thread
local.waitformine = (randomint(45) + 10)
(generates a random number between 10 and 55
wait local.waitformine
(delays the thread for x amount of seconds
spawn animate/fx_explosion_mine "targetname" "mine1"
(generates a mine explosion that hasn't yet blown up
$mine1.origin = ( -981 -2998 -63)
(puts the mine in a specific place on the map
$mine1 anim start
(blows up the mine
if ($player == NULL)
local.dudes=0
else
local.dudes = $player.size
(last 4 lines determine how many people are playing on the board
if (local.dudes > 0)
local.dude = exec global/makearray.scr $player
(last 2 lines create a listing of the people playing
for (local.i=1;local.i<local.dudes+1;local.i++)
{
if (vector_length ($mine1.origin - local.dude[local.i].origin) < 300)
local.dude[local.i] exec global/bullethit.scr (0 -1 0) 800 50 1
}
(last 5 lines spin through all the people. if they close to the mine, it kills
(them
wait 4
(waits 4 seconds
$mine1 remove
(takes the old mine off the map
goto randommine1
(starts the thread all over again
end
(marks the end of the thread

chipsdw 08-28-2003 04:21 PM

thanks man! very useful.

chipsdw 08-28-2003 04:25 PM

ok heres what i would like to do... how would i make a varible that makes a random number between 1-1000, and then how do i call up that varible later on.

bluebrooks 08-28-2003 04:38 PM

add a line...
local.yourcrazyassvariable = randomint(1000)

then whenever you need that number later, use the name.
as in (like above)
wait local.yourcrazyassvariable

Dragonwraith 08-28-2003 04:54 PM

y got the 4th mine to work, just had to change the coords. changing the 300 higher increases the "kill area" but is there a way to make the effects bigger? like scale 1.0 is normal, scale 2.0 is 2x bigger and so on? Thanx again for the help and I'm glad the thread ended up helpin another guy!!

bluebrooks 08-28-2003 05:09 PM

don't know about th effects size.
you can go into the animate/fx_explosion_mine.tik file and play with the scale to see what happens.

you might end up having to change other tik files too. like in the mine tiki and see if it references other tiki files when it animates.

I think scale works backwords. As in scale 1.0 is smaller than 0.5. I forget though

Dragonwraith 08-28-2003 05:15 PM

I'll just leave them the stock size. But the scale does go up to male the models larger.

Dragonwraith 08-28-2003 05:47 PM

where in an OBJ .scr would i put this script to add the mines??

newt. 08-28-2003 06:08 PM

waittillspawn

and end has to be after script

chipsdw 08-28-2003 06:39 PM

so... if i wanted to randomize the placement of a mine could i do this?

randommine1:
(this line names the thread
local.waitformine = (randomint(45) + 10)

local.rndnum = randomint(1000)
local.rndnum2 = randomint(1000)
local.rndnum3 = randomint(1000)

wait local.waitformine
spawn animate/fx_explosion_mine "targetname" "mine1"

$mine1.origin = ( -wait local.rndnum -wait local.rndnum2 -wait local.rndnum3)
(puts the mine in a specific place on the map
$mine1 anim start
if ($player == NULL)
local.dudes=0
else
local.dudes = $player.size
if (local.dudes > 0)
local.dude = exec global/makearray.scr $player
for (local.i=1;local.i<local.dudes+1;local.i++)
{
if (vector_length ($mine1.origin - local.dude[local.i].origin) < 300)
local.dude[local.i] exec global/bullethit.scr (0 -1 0) 800 50 1
}

wait 4

$mine1 remove

goto randommine1

end

chipsdw 08-28-2003 07:21 PM

and while were on the subject of scripting... would this work?

if ($player say fuck)
$player takeall

bluebrooks 08-29-2003 08:38 AM

the coordinate thing won't work.
it would be....
$mine1.origin = ( local.num1 local.num2 local.num3)
so leave out the "wait"s

also, although this will work, your mines will be all over the place. as in, under the board, up in the air, off the board completely, etc.
it would work better on a flat board, like snowy park. so you could make the x and y coords random, and keep the z coord constant, so they all blow up around foot level.
but even that, you'd need to find the center of the board and set the x and y's based off that.

for instance, say the center of the board is ( 5000, -4000, 500)
and the board stretches out for 3000 units to hit each side from the center,
then make
local.x = (randomint(6000) + 2000))
local.y = (randomint(6000) - 7000))
that would make x a number from 2000 to 8000 (+ or - 3000 from center)
and y would be a number from -7000 to -1000 (again, + or - 3000 from center)

chipsdw 08-29-2003 09:48 AM

blue brooks do u have AIM cus i have a lot of little questions like what exactly does $player mean and stuff.


All times are GMT -6. The time now is 06:15 AM.

Powered by vBulletin® Version 3.8.12 by ScriptzBin
Copyright ©2000 - 2025, vBulletin Solutions Inc.
© 1998 - 2007 by Rudedog Productions | All trademarks used are properties of their respective owners. All rights reserved.