Forum

> > Stranded II > Scripts > Behavioral scripts
Forums overviewStranded II overview Scripts overviewLog in to reply

English Behavioral scripts

5 replies
To the start Previous 1 Next To the start

old Behavioral scripts

Lion_Hearted
User Off Offline

Quote
When a lion chases you in stranded 2, it keeps the same speed, and doesn't change speed. This is very unrealistic, because in real life, lions mosey around rarely going full speed. But when they hunt, they do run.

Also, deer, they walk around, graze, and when they get scared, they run!

I'm trying to make a script, that will change the unit's speed, and the speed of the walking animation on a unit state such as "hunting player" or "flee".

And then would change it back to normal when that type of behavior stopped.

How would I go about doing that... I have no idea of any commands, or anything else that actually activates when the unit changes into one of those modes. I would also need it to deactivate once the unit left the mode.

old Re: Behavioral scripts

Hurri04
Super User Off Offline

Quote
I think you could use the state 54 - speedmod:
http://www.stranded.unrealsoftware.de/s2_states.php
when a unit has this state it moves with the speed of the value in statevalue 0 instead of the speed from the description.
use the command s2 cmd statevalue to change it.

you could use the command on:ai_attack to detect when the player is attacked by a hostile unit.
in order to detect whether the player is close to non-hostile unit you most likely have to use a s2 cmd timer and the command s2 cmd inrange.

old Re: Behavioral scripts

Lion_Hearted
User Off Offline

Quote
on:ai_attack would be too late, I want the lion to chase after the player so it can attack the player...

And timer idea, it wouldn't work either, cause the second the player got inrange, and the speed increased, there's no garenty the animal will actually flee... Is there?

old Re: Behavioral scripts

Hurri04
Super User Off Offline

Quote
if on:ai_attack is to late then you could use a timer here as well. make the script check whether the player is within a certain radius of the lion once a second but make this radius a little wider than the distance from which the lions usually detects the player.
this is in order to give the player some more time until the lion reaches him with his faster speed.
then use s2 cmd ai_signal or s2 cmd ai_behavioursignal at the timerevent at the player to attract the lion.

you can use the same thing to distract animals that flee if the player comes close to them.

(I'm afraid there are some parameters in the german description that are missing in the english one so best view the command-reference site in german language and translate it with google, it should be understandable.)

otherwise you could wait until Mc Leaf publishes his source code update (date unknown), it has some nice features in it:
http://www.youtube.com/watch?v=agjZlkJ5kXA

old Re: Behavioral scripts

Lion_Hearted
User Off Offline

Quote
I just might take the "behavior Raptor" out of there, and replace with with a jumble of scripts, like my hunting system.

Thank you Hurri!


edit1:

Want about the playerspotted command?

Would that work as well to increase the speed and decrease it?

Place the command on a timer that will most likely be set on 1 sec intervals for each specific unit. And if that playerspotted returns a value higher then 0, then the speed equals 3 times the normal value, if not, then the speed equals the normal value.


Would that also work for shy behavior as well as aggressive behavior?

Also what about stalking?

Can I perhaps on a timer (every 30 sec) run a script, that if random 1 through 40 equals 20 the unit's alpha would be nearly transparent, and he would lower his speed dramatically, and come after the player? That same script would also start a timer that would return the alpha version to normal and the speed to high once he got within a certain distance of the player?
edited 2×, last 07.06.11 10:25:58 pm

old Re: Behavioral scripts

Hurri04
Super User Off Offline

Quote
the problem with the s2 cmd playerspotted command would be that it doesnt work if you're checking the distance between a lion and the player every second when the radius is larger than the normal distance from which the lion usually detects you.

and if you check whether the lion is within a smaller radius, the time for the player to flee would be too small, so it'd be unfair I think.

also, no, the playerspotted command doesnt work for shy units.

further I think it isnt a good idea to turn a unit's alpha value down because in reallife lions also dont turn invisible when they're trying to sneak up to you

but you could e.g. make a scriptkey which'd allow it for the player to sneak while that key is pressed, so when the timer checks once per second whether a lion is inrange in order to give him more speed and attack the player, there might be a chance that this doesnt happen. maybe you could even add a new skill for that so the player has to learn how to sneak (the more he sneakes, the more the skill rises). and the higher the skill, the lower the chance that the player is detected.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview