Home   Help Search Login Register  

Author Topic: Simple Morale Script - Comments Appreciated !  (Read 2308 times)

0 Members and 1 Guest are viewing this topic.

Offline Roni

  • Members
  • *
  • Play the Game !
Simple Morale Script - Comments Appreciated !
« on: 11 Jul 2004, 10:27:09 »
Hello All

After weeks of false starts and dud coding I've finally finished my first Morale script !    ;D:P ;D

To use, simply place the script in the Init field of any unit of the target group.  Full syntax, usage rules and required objects are included in the comments found in the script.

Once assigned, the target group will attempt to move towards its assigned target.  However, if it takes more casualties than its assigned Morale then it will flee directly away from the nearest enemy until it is outside the minimum allowable range.  The minimum allowable range goes up with increasing casualties until the group flees from any enemy within 500m.

If you specify the groups target as "nearest" then it will always seek towards the nearest enemy unit instead of towards a fixed target.  Of course, once it takes casualties it will flee from that same nearest enemy unit if it is too close.

Note that the script is "dynamic" in that it doesn't matter if the assigned unit or its group leader dies - the groups morale is always taken by reference to the present leader of the group.

If you combine this script with a group respawn script (I have one available on request) then you end up with swarms of enemy that charge, get shot up, run away, reform and charge again.   ;D :gunman:

I haven't included a test mission because its too easy to make one from scratch - all you have to do is make one East Infantry group with the default 9 units and in the Init field of any unit write -

[nearest,9,1,1] exec "straightseek.sqs"

Now give the group one waypoint (any type), and place two objects - a Game Logic named server and another object of any type (say - a fountain) and name it nearest.  Put in a trigger "West present" with a radius of say 1000m and finally, one West unit of any type.

The East group will now move directly towards the West unit until it suffers one loss.  It will then move to a point 50m away from the West unit.  As its casualties mount it will move further and further away, but will always follow the West unit at a distance.  As I said - add some sort of respawn script and you have a near endless battle !

This script is intended to be the first in a series.  My next script will be called huntseek.sqs and will have the assigned group move to a point where the nearest enemy is THOUGHT to be.  This will be a circle centred on the units last known position, with a radius based on the time since the unit was last spotted.  The last known position will be updated every time the target is spotted and the circle will widen over time to some maximum radius.

I intend to use this script in an extended guerilla warfare mission that I am writing with group respawns, time dilation (one game day every 20 minutes) and player respawn to group.  It would also be useful for any hunt and seek mission - say prison break out etc.

The last script will be called chainseek.sqs and will make the group do nothing until the next group in the chain spots an enemy unit.  It will then home in on that enemy, and of course if it spots him then he will call in HIS next group and so on and so on.

This should be great for black ops and covert missions - kill all of the enemy without beiing seen or pretty soon all of their buddies in the area will soon be looking for you !

Good luck with the script and as the header says - user comments greatly appreciated !


Roni

FormatC

  • Guest
Re:Simple Morale Script - Comments Appreciated !
« Reply #1 on: 14 Jul 2004, 14:49:09 »
 8) this sounds a great idea..  I  will test it tonight and see if its as easy as you say.   Im hoping to make it so the flee at a certain number will mean I can reinforce the group again on single player with something like [unitname] join leader 'name' triggers.  Ok i know its not the best way to do that.


EDIT:  Tested it and it works, nice work, all I need now is a flee script detection so i can activate a cocky officer saying.. look at those girls run  ;)
« Last Edit: 14 Jul 2004, 17:25:47 by FormatC »

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Simple Morale Script - Comments Appreciated !
« Reply #2 on: 14 Jul 2004, 23:40:25 »
Thans for the feedback.


" . . . all I need now is a flee script detection so i can activate a cocky officer saying.. look at those girls run "  

Easy as !  Simply add a line in the _minRange area that plays the appropriate message (text or sound).  For example, if the minimum range is 50m then the message might be "Keep it up, they're starting to break !", if it was 500m then the text might be "Up and at em boys !".  And so on.

Just for the hell of it I've attached one of my group respawn scripts (spwnEInfantry.sqs).  Add this to the Init fields of the bad guy group leaders along with the Morale script and watch some real fun.  The bad guys will now run when they have taken casualties but will then regroup and start coming back after a few minutes.

Good luk with both of them.



Roni


Offline six6six

  • Members
  • *
Re: Simple Morale Script - Comments Appreciated !
« Reply #3 on: 01 Jun 2009, 21:42:53 »
Sorry about resurecting this, but does anyone have this script anywhere? Sorry again.

Offline schuler

  • Contributing Member
  • **
Re: Simple Morale Script - Comments Appreciated !
« Reply #4 on: 02 Jun 2009, 01:35:18 »
Roni was last active in September 12, 2006, 09:07:39 PM
maybe you can bug him with a email I all ways suppurt that sort of thing
rory@romad.com.au  :D
Semper Fi