Home   Help Search Login Register  

Author Topic: Stamina script...possible?  (Read 3933 times)

0 Members and 2 Guests are viewing this topic.

Offline Blanco

  • Former Staff
  • ****
Re:Stamina script...possible?
« Reply #15 on: 13 Apr 2005, 09:40:38 »
What about traveldistance (only when he's on foot) to define his fatigue?  The distance can be updated every 20m so it won't take much CPU resources and it only counts distance in x,y coords not in z
There is a mileagecalculator script in the editordepot from pablo123. You can make a pedometer... (is that a word?  :) )
And I should slightly reduce his skill instead of his damage to simulate fatigue.

Just my 2 cents.

« Last Edit: 13 Apr 2005, 14:34:58 by Blanco »
Search or search or search before you ask.

wi77ard

  • Guest
Re:Stamina script...possible?
« Reply #16 on: 13 Apr 2005, 11:51:38 »
the script looks good, and easy way to tell the distance each guy has travelled, should working in MP too, I hope :)

but how do i add some sort of stamina value to this, it would be great to have it so if the guy has travelled ..... distance he begins to loose health and needs to be sitting down to restore his stamina. How do add this to the script??

cheers for help

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Stamina script...possible?
« Reply #17 on: 13 Apr 2005, 15:16:08 »
Hi wiz

I hate to butt in but once again I think that the idea should be to set up some sort of stamina rating for each unit at start, then reduce this rating each step of the cycle according to distance moved, magazines carried (a piss poor but passable approximation of weight carried) and alert status (an approximation of mental fatigue).

To determine the appropriate distance covered effect a simple test is to create a one man mission with a single script that records the man's position at start, then his position at the end of each cycle then works out his distance moved.  Like this -

; pedometer.sqs

#loop
_startPos = getPos loon1
~20
_endPos = getPos loon1

_distanceCovered = sqrt ((startPos * startPos) + (endPos * _endPos))
hint format ["Distance covered = %1", _distanceCovered]

goto "loop"



Try running, sprinting and walking your man with weapon slung to get a rough average of the distances covered.  Now use these values as your "benchmark" for your stamina loss or gain rates.

Example - Pretend that you discover that every 20 second cycle your man can sprint 80m, run 50m or walk 20m.  All you do is set your stamina variation rate to something like

_distanceFatigue = 30 - _distanceCovered

This means that if you walk you will gain back stamina VERY slowly, if you run you will lose it over time and if you sprint then you fatigue like a fatiguing thing with a degree in fatiguing from Fatigue University.

Chuck in a magazine effect, like so -

_weightFatigue = 10 * (count magazines _this)

and an Alert Status effect like so -

_alertFatigue = -20
? behaviour _this == "Safe" : _alertFatigue = -10
? behaviour _this == "Aware" : _alertFatigue = 0
? behaviour _this == "Combat" : _alertFatigue = 10
? behaviour _this == "Stealth" : _alertFatigue = 20



Then you simply bring it all together like so -

_stamina = _stamina + _ distanceFatigue + _weightFatigue + _alertFatigue


Of course, if you use the above group stamina script then you need to use an array of staminas for each group member and set up the starting values accordingly.

I think that the basic idea is to create a simple script regime that loops once for each and every man in the group.  It may be a bit of coding, but the end result is that the script should be simply point and shoot, ie - put in to init field of group leader and fuggedaboutit !

Hope that this helps !



roni

wi77ard

  • Guest
Re:Stamina script...possible?
« Reply #18 on: 13 Apr 2005, 16:00:08 »
again looking great, seems to be the kinda thing i want.

adding it all together looks hard though. could you get it to check for a weapon like a law launcher or backpack and make the unit loose stamina faster if they have one of these. also would it still decrease the stamina say if i have a dude who had a backpack but wasnt moving, coz in reality you would still get tired from just having it on your back.

thanks for help, this thing is drving me mad!  ???

wi77ard

  • Guest
Re:Stamina script...possible?
« Reply #19 on: 13 Apr 2005, 16:02:17 »
oh and i dont want it to work on a group, just each single player. hopefully so i can add a stats hint, to let each person know what their stamina and health is. I dont have the players linked in groups in multiplayer mission.

Offline SEAL84

  • Members
  • *
  • Always lurking
Re:Stamina script...possible?
« Reply #20 on: 14 Apr 2005, 16:02:43 »
Roni, I'm pretty sure the script (which was created by Spinor, btw) already accounts for distance and combat state.  Those two determine how much of a deduction the man's stamina rating will take - the stamina rating is set at the beginning and measured in minutes.

When a team is running around - depending on how fast and in what combat mode - their skill levels are slowly decreased as their stamina drops.  They are not actually being injured.

The problem with running the script on players is that there really is nothing that you can to do a human-controlled player to achieve the same thing.  Injuring the player is certainly not analagous to being fatigued...being fatigued should have no effect on how much damage you can take.  Your best bet is to use the reverse-setdammage trick - negative dammage makes the crosshairs extremely wobbly.  Perhaps also some audio files could be played.

Your best bet is to talk to Spinor.

wi77ard

  • Guest
Re:Stamina script...possible?
« Reply #21 on: 14 Apr 2005, 17:01:01 »
thanks for reply

yeh something like making aiming harder and possibly blackouts for extreme fatigue.
All i'm really trying to achieve is something that will make gaming more realistic, like the need to have a LUP during misisons. And also removing the ability to lug a heavy bergen 60k and not feel any effect. I want people to know they have carried their bergen, and this also gives rise to the fact when a contact does happen, dumping the bergen might be a good idea, though it might not too. lol

anyhow, enough about me babbling. .............. i love the script that spinor wrote, i really want to use that if possible. It works fab in single player. i just need it adapting to fit multiplayer, so that each player can keep watch of his own levels, not relying upon a group leader.

I've sent a pm to spinor in the hope he will read this and be able to help out. I've tried to remove the group side of things, but to be honest it is too complex a script for me to mess about with ......... :D

wi77ard

  • Guest
Re:Stamina script...possible?
« Reply #22 on: 17 Apr 2005, 22:42:30 »
*bump*

please can anyone help

Offline Spinor

  • Members
  • *
  • I'm a llama!
    • The chain of command
Re:Stamina script...possible?
« Reply #23 on: 24 Apr 2005, 13:04:16 »
Hello, I have attached the stamina script you requested, i.e. it works on a single unit rather than a group. It is executed analogously:

[ unit,toughness ] exec "stamina_unit.sqs"

It is a straightforward conversion and, as pointed out by SEAL, it is currently rather useless on a player, as fatigue is modelled by reducing the (AI) skill. If you want to properly convert it to use it on players, you would have to implement something like a wobbly crosshair or blackouts.

As for the influences on stamina, the script takes into account:
- combat mode and behaviour
- speed (travelled distance)
- role of unit: on foot, vehicle crew, vehicle passenger (crews will also suffer fatigue)
- weight, in a crude way; total "weight" is measured as #weapons + 0.5*#magazines

wi77ard

  • Guest
Re:Stamina script...possible?
« Reply #24 on: 26 Apr 2005, 00:16:18 »
thanks so much for that

how do i implement blackouts and crosshar effects?


Offline Roni

  • Members
  • *
  • Play the Game !
Re:Stamina script...possible?
« Reply #25 on: 26 Apr 2005, 01:13:40 »
Hi Wiz

Wobbly crosshairs can be done via a negative setDammage rating or a very fast loop implementing a tiny random setDir change.  Blackouts can be simulated using a black fadeout titleCut.

If you'd like I could throw something together tonight - I'm working on a mission which needs a fatigue type script and I already have a script that works like this but that needs updating.  It won't be as good as Spinor's  :-\ but it should do what you want.

Cheers



Roni


wi77ard

  • Guest
Re:Stamina script...possible?
« Reply #26 on: 26 Apr 2005, 08:47:00 »
anything would be good

when i used blackout in multiplayer it made everyone blackout not just the one dude, might have been coz the script was running on the group instead of the single unit.