OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: zip on 20 Oct 2004, 17:42:46

Title: MP: Player surrender!
Post by: zip on 20 Oct 2004, 17:42:46
Hello and thanks for your attention ....

iam faceing some troubles with the MP surrender.... the scripts works excellent in SP ...
but in MP I guess iam doing something wrong .... I use the script wich was done by "unknown author" but you schould find it around here...

what iam doing is that I add a new action to there player there goes like this :

player addaction ["Surrender","captive.sqs"]

the action appears.... but there I get a error :

http://www.andenverdenskrig.dk/error.JPG

anyone that can explain this error ?  :'(
Title: Re:MP: Player surrender!
Post by: zip on 20 Oct 2004, 17:54:25
and yes the german guy got killed a couple of times ... poor him :P
Title: Re:MP: Player surrender!
Post by: Artak on 20 Oct 2004, 18:21:39
allowfleeing syntax is:

Quote
unit allowFleeing courage
Operand types:
    unit: Object or Group
    courage: Number
Type of returned value:
    Nothing
Description:
    Set group courage. The less courage, the sooner will group start fleeing. 0 means maximum courage, 1 means always fleeing.

Example:
    soldierOne allowFleeing 0

So, whatever is passed to the script with _this array's second value, it's wrong. The value should be a number from 0 to 1 and not an object as the error message says it is.
I don't know exactly how you've got the scripts going on there, but remember that in MP the script that's run by the action command, is run only on the client who used the action.
Title: Re:MP: Player surrender!
Post by: zip on 20 Oct 2004, 18:22:24
heheh I just placed it in the units init field :S
Title: Re:MP: Player surrender!
Post by: Artak on 20 Oct 2004, 21:13:35
Ah, so (_this select 1) is a parameter from the action command itself.
If my memory servers me correctly the second value in _this from an action is always 'the one who did the action'.

So if Bob pressed the surrender action (_this select 1) is Bob.

So your line would read _unit allowfleeing Bob when it should say Bob allowfleeing _number-from-zero-to-one or even (group Bob) allowfleeing _number-from-zero-to-one

So earlier in your script define _number-from-zero-to-one = 0-1 depending on what you want it to be, and then just change the line giving the error..


Still I must say, I don't understand what you're trying to accomplish with this allowfleeing command, as it does nothing to players, just the AI groups.  :o
Title: Re:MP: Player surrender!
Post by: zip on 20 Oct 2004, 21:39:14
well this is kind of secret beacuse itÂ's a MP project for inv44....

but my tougth was on that if the player realise that there is no point in to contiune running up and gets more good men killed they can surrender ... and be set in prison and then "die" and return home and respawn
Title: Re:MP: Player surrender!
Post by: Artak on 20 Oct 2004, 21:44:11
Well, then allowfleeing will do no effect anyway.  ;D

[size=0.5](somebody prove me wrong)[/size]
Title: Re:MP: Player surrender!
Post by: zip on 20 Oct 2004, 21:53:31
Yeah maybe it wouldnÂ't pay off ... I wont surrender heheh :P

Just close this subject
Title: Re:MP: Player surrender!
Post by: Kuro on 21 Oct 2004, 05:38:57
Hallo,

i think i am the "unknown author", my surrender script is very beta. But if  you send me a link to your mission i can handle the problem for you.

Greetings
Kuro
Title: Re:MP: Player surrender!
Post by: zip on 21 Oct 2004, 15:51:11
Hi ... nevermind abourt it ... the feature would be lame anyway I dont think no one would use it ... or maybe a trouble maker would join the server surrender with the entire group and leave again ... would piss alot of I think so I leave that out
Title: Re:MP: Player surrender!
Post by: Artak on 21 Oct 2004, 16:33:20
I think it's an excellent idea. The group leader should be able to decide if he wants to be a covard and save lives or go boldly where no man has survived before.  ;D
Just what you want the action to do exactly is another thing. Maybe it could delete all the group's weapons, setcaptive them and move to a prison.. not a bad idea!
Title: Re:MP: Player surrender!
Post by: zip on 21 Oct 2004, 23:06:40
yeah it would add a more realistic touch !