Home   Help Search Login Register  

Author Topic: Make enemy leader stick to player  (Read 751 times)

0 Members and 2 Guests are viewing this topic.

pazuzu

  • Guest
Make enemy leader stick to player
« on: 18 Aug 2005, 21:04:33 »
I'm making a mission where the players have to fight Amazon women. I'm using the 2 amazon packs.

Anyway, I wanted to give the Amazon leader some special abilities to fight. I wanted to make her behave as the zombies do in the zombie missions I've played. When player gets close to zombie the zombie seems to glue itself to the player and cause dammage.

I've looked at the zombie scripts but I dont understand how they work.

My question is, is there a simple way to get amazon leader to stick (getpos) to player and just loop it or something while creating dammage on the player?

And also make it so it only happens to the player that gets too close?

Thanks.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Make enemy leader stick to player
« Reply #1 on: 18 Aug 2005, 21:41:05 »
2 parts - sensing proximity to player, and gluing to the player within a set distance.

Code: [Select]
#dist_loop
~1
?player distance amazon_name <= 10 : amazon_name domove getpos player
?player distance amazon_name <= 2 : goto "stick"
goto "dist_loop"

#stick
_px = getpos player select 0
_py = getpos player select 1
_pdir = getdir player
_pdam = getdammage player

_ax = getpos amazon_name select 0
_ay = getpos amazon_name select 1
_adir = getdir amazon_name

_dir = (_ax - _px) atan2 (_ay - _py)

amazon_name setdir _dir-180
amazon_name dowatch player
amazon_name setpos [_px + (2*sin(_dir)), _py + (2*cos(_dir))]

~0.01

_pdam = _pdam + 0.001
player setdamage _pdam

? alive amazon_name : goto "stick"

exit

tested, and it does indeed work :P

*bedges goes moderator stylee*

i also get the sense that this is a multiplayer question - if that's the case this belongs in the multiplayer board...  :hmm:
« Last Edit: 18 Aug 2005, 21:58:09 by bedges »

pazuzu

  • Guest
Re:Make enemy leader stick to player
« Reply #2 on: 18 Aug 2005, 21:50:44 »
Thanks for the reply. I'll test this out.

The unit I want this to work on is named "amazonleader"

So when you write amazon_name do I change that to amazonleader? or do I need the _?

Thanks.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Make enemy leader stick to player
« Reply #3 on: 18 Aug 2005, 21:56:04 »
code above edited, and tested. simply replace 'amazon_name' with 'amazonleader'.

pazuzu

  • Guest
Re:Make enemy leader stick to player
« Reply #4 on: 18 Aug 2005, 21:58:56 »
Oh ok, thank you...

pazuzu

  • Guest
Re:Make enemy leader stick to player
« Reply #5 on: 18 Aug 2005, 22:38:08 »
This is beautiful bedges. This is exactly what I wanted. Its gonna freak the players when they get this surprise...

I'll really appreciate you doing this for me.

Thanks again.