Home   Help Search Login Register  

Author Topic: Problem With Zombie Script (Drop Command)  (Read 591 times)

0 Members and 1 Guest are viewing this topic.

Captain Winters

  • Guest
Problem With Zombie Script (Drop Command)
« on: 15 Aug 2003, 05:02:01 »
Code: [Select]
_zombie=_this select 0;
_target =_this select 1;

#main
?(!alive _zombie):goto "dead"
_zombie domove (getpos _target)
? _zombie distance _target <= 1 : goto "attack"
? _zombie distance _target > 1 && _zombie distance _target <= 5 : goto "engage"
? _zombie distance _target > 5 : _zombie doMove getPos _target
~1
goto "main"

#engage
_nX = getPos _target select 0
_nY = getPos _target select 1
_zombie setPos [_nX, _nY]
goto "main"

#attack
_zombie switchMove "FxShow3"
~0.9

_rndc = (random .1)+(random .2)
drop ["cl_fire", "", "Billboard", 0.2, 1, [0,.8,1.6], [0,0,0], 500, 1.275, 1, 0, [.1,3], [[0,0.5-_rndc,0,0.1], [0,0.5-_rndc,0,0.4], [0,0.5-_rndc,0,0.8],[0,0.5-_rndc,0,0.1]], [0,0], 0, 0, "", "",_unit]

_d = 0
#droploop
_rndc = (random .1)+(random .2)
_color = [[0,0.8-_rndc,0,0.1], [0,0.8-_rndc,0,0.4], [0,0.8-_rndc,0,0.8],[0,0.8-_rndc,0,0.1]]
_color2 = [[0.8-_rndc,0.8-_rndc,0,0.1], [0.8-_rndc,0.8-_rndc,0,0.4], [0.8-_rndc,0.8-_rndc,0,0.8],[0.8-_rndc,0.8-_rndc,0,0.1]]
_vel = [0-(random 2)+(random 4),0-(random .5)+(random 1),0-(random 2)+(random 4)]
_vel2 = [0-(random 3)+(random 6),0,0-(random 3)+(random 6)]
drop ["cl_fire", "", "Billboard", 0.2, .1, [0,1,1.6], _vel, 500, 1.275, 1, 0, [.05,.1], _color, [0,0], 0, 0, "", "",_unit]
drop ["cl_fire", "", "Billboard", 0.2, .1, [0,1,1.6], _vel2, 500, 1.275, 1, 0, [.01,.01], _color2, [0,0], 0, 0, "", "",_unit]
~.001
_d = _d + 1
? (_d < 500) : goto "droploop"
goto "main"

#dead
exit

That's a couple of scripts to edit together. When the _zombie gets within a certain distance of the player he sticks out his hand and it looks as if he injects poison. Only thing is, that the 'green fog' doesn't show up?

I have to questions:

1. Why doesn't the green fog Show Up?
2. How can I make to where if the player if X distace from the fog it does dammage over time and then eventually kill the player?

I'm sorry to bug all you scripting gurus yet AGAIN, but do you's have ne ideas?

Tanks!  8)

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Problem With Zombie Script (Drop Command)
« Reply #1 on: 15 Aug 2003, 19:42:36 »
1. You have _unit as the Object in the particle array. It should possible be _zombie. If you want the cloudlets to appear infront of him (or it  ::)). Also the lifetime in #droploop is only .1 seconds. Keep in mind that from the zombies view the cloudlets are too close to be visible.

2. You can use the onTimer element of the array, 3rd last. Insert a script name in quotes. That script is ran at TimerPeriod (4th) intervals, and you get the particles position. Here's how to calc the distance to the player:
Code: [Select]
_pos = _this
_DX = (_pos select 0) - (getPos player select 0)
_DY = (_pos select 1) - (getPos player select 1)
_dist = sqrt ((_DX * _DX) + (_DY * _DY));
The harder thing would be to know the radius of the particle at a given time. I usually resort to simply using half of the biggest it achieves. Now when the distance is less than that, you can run a script that adds damage to the player. To avoid multiple of these scripts running at once, make an array at init where u at this point add the player, and which disables the script running if he is there. U know  ;D ...
in init.sqs:
poisoned = []
in the above particle - player distance script, after the distance is calc'd to be damaging:
? (player in poisoned) : exit
[player] exec "damager.sqs"

Right....
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

Captain Winters

  • Guest
Re:Problem With Zombie Script (Drop Command)
« Reply #2 on: 15 Aug 2003, 20:32:51 »
okay, cool! Thanks everything works so far so good except th inflicting the damage! can you explain again, please, how to do this? thanks a lot bud!

Tanks!  8)

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Problem With Zombie Script (Drop Command)
« Reply #3 on: 15 Aug 2003, 21:12:07 »
Mkay. Start from init.sqs:
Code: [Select]
poisoned = []

dropped contaminating particle
Code: [Select]
drop ["cl_fire", "", "Billboard", 0.2, 1, [0,.8,1.6], [0,0,0], 500, 1.275, 1, 0, [.1,3], [[0,0.5-_rndc,0,0.1], [0,0.5-_rndc,0,0.4], [0,0.5-_rndc,0,0.8],[0,0.5-_rndc,0,0.1]], [0,0], 0, 0, "distance.sqs", "",_zombie]

distance.sqs
Code: [Select]
_pos = _this
_DX = (_pos select 0) - (getPos player select 0)
_DY = (_pos select 1) - (getPos player select 1)
_dist = sqrt ((_DX * _DX) + (_DY * _DY));
? (_dist > .1) : exit
? (player in poisoned) : exit
poisoned = poisoned + [player]
[player] exec "poisoned.sqs"
exit

poisoned.sqs
Code: [Select]
_unit = _this select 0
~60
#damloop
_unit setDammage ((getDammage _unit) + .025)
~10
? (alive _unit) : goto "damloop"

exit

I presume your using the above particle as the "contaminating" one.
I have a similar set of scripts in a mission by Hawkins in the beta testing board, it can process a whole array of targets, not just the player. And an even more advanced thingy in works, just that ofp kneels before it, in a negative way  ;D It replaced the 'nadelaunchers with flame throwers and napalm launchers, I might put it up somewhere soon.

[edit]fGgin ass I'm stoned, 3rd edit[/edit]
« Last Edit: 15 Aug 2003, 21:14:17 by MI_Fred »
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

Captain Winters

  • Guest
Re:Problem With Zombie Script (Drop Command)
« Reply #4 on: 15 Aug 2003, 21:48:09 »
I have a similar set of scripts in a mission by Hawkins in the beta testing board, it can process a whole array of targets, not just the player. And an even more advanced thingy in works, just that ofp kneels before it, in a negative way  ;D It replaced the 'nadelaunchers with flame throwers and napalm launchers, I might put it up somewhere soon.

[edit]fGgin ass I'm stoned, 3rd edit[/edit]


pfft, hell yea man! put that mofo up!  ;D I know my scripting [sometimes] but the drop command i know crap about. K Leme c if it works!

Tanks!  8)

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Problem With Zombie Script (Drop Command)
« Reply #5 on: 15 Aug 2003, 21:59:25 »
Oki, heh, 10kb of premium madness coming your way. Attached. A light mod as you could call it, it is still a wee bit buggy. Well, you can achieve one error by going trigger happy in the example mission  :o but isn't that what you do with 'em zombiaches?

The usage might be awkward. You have to write dis'n'dat in herr'n'derr  ;D So refer to the example mission. This kinda thing is distributed with more easy by a template anyway. The scripts can be used somewhat separately. I'll have to put up a help clinic for teh zombaye addicted if such is needed... but in the meantime ... enjoy  ;)

[edit]Oh yea, edit. Note: no sounds are included, which are in Hawk's mission. Again, if requested, provided[/edit]

now leave me alone, grah
« Last Edit: 15 Aug 2003, 22:05:03 by MI_Fred »
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

Captain Winters

  • Guest
Re:Problem With Zombie Script (Drop Command)
« Reply #6 on: 15 Aug 2003, 23:08:57 »
lol, omg that is cool!

lol and i know youvwe done a lot for me today, and im very apprecative, but i have set everything up like in the xample mission, but when I set the player right infront of the created 'zombies' they do nothing except stand around and look at him! I tried an amount of thing like chnging the players name and what not, any ideas?

thanks for all the help 2 day n lol sory i couldnt leave u alone!

Tanks!  8)

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Problem With Zombie Script (Drop Command)
« Reply #7 on: 15 Aug 2003, 23:32:55 »
Don't leave the init w/o attention like some already have ...  ;)
Other than that, hard to know what it could be. The init has the tgtarray, in which you list all units to be targeted by zombies. Don't forget the alllist (or what was it) trigger, that is needed for their breathing to cause damage.
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

Captain Winters

  • Guest
Re:Problem With Zombie Script (Drop Command)
« Reply #8 on: 16 Aug 2003, 21:03:38 »
okay! this is great! thanks a ton!!  ::) :)

Tanks! 8)