Jump to content
Sign in to follow this  
stegman

Player switching

Recommended Posts

Hi lads,

I have a few questions about 'playable' units.

Lets say that I have three 'playable' units;

Rifleman

Squad leader

Officer

The player will start as a rifleman and when his points reach a certain level he will be promoted to 'Squad Leader' and then to 'Officer'.

How do I prevent the player from using the other units, and then force the player to be one of those units when the time is right?

Also can this new playable unit retain the ammo, name and score of the last?

Share this post


Link to post
Share on other sites

Don't set the squad leader and officer to playable at first, but name them.

Then, when it's time to make one of the playable, use this: http://community.bistudio.com/wiki/setPlayable

To force a change, use this: http://community.bistudio.com/wiki/selectPlayer

Or, if you don't want them to be able to switch back, you might be able to skip the setPlayable command and just switch them, then delete the previous unit.

Share this post


Link to post
Share on other sites
Don't set the squad leader and officer to playable at first, but name them.

Then, when it's time to make one of the playable, use this:  http://community.bistudio.com/wiki/setPlayable

To force a change, use this:  http://community.bistudio.com/wiki/selectPlayer

Or, if you don't want them to be able to switch back, you might be able to skip the setPlayable command and just switch them, then delete the previous unit.

Great! Thanks for that.

What about the gear. Any ideas on that?

Share this post


Link to post
Share on other sites

Using this method the identity will not be transfered properly. Just like the sarani virus (zombie) map. Theres no simple way to transfer identity. In MP the only time a player can transfer to a new type of character with there name + face intact is during a group respawn game when they switch to another unit in there group when they die.

You can not get the number of magazines in a players inventory so you can not transfer them to a new character. You could find his weapons tho.

These are the reasons there are no proper career paths and inventory restoration on death in evolution btw.

Share this post


Link to post
Share on other sites

You can actually find the magazines as well. It's an array, i.e.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">magazines player

will return the magazines for the weapons. You can also find the amount of ammo in each currently loaded magazine as well:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player ammo "weapon"

You're correct about identity. There might be a way to work around it, but when I made Sarani Virus, I didn't really try to figure out how to transfer identity since I wanted dead players inhabiting zombie bodies.

It might be possible to set the mission to group respawn. Then when the game starts, create a zombie group member for each player and set them to playable. Then when a player dies, they'll respawn into the zombie.

Or you could possibly create the new zombie group member and set it to playable the second the player dies, and then the game might transfer the virtual soul into the new group member. That way you'd preserve identity. It'd take some messing around, but it might work.

Share this post


Link to post
Share on other sites

@KaRRiLLioN thanks for the mag info ill look into that

"

Or you could possibly create the new zombie group member and set it to playable the second the player dies, and then the game might transfer the virtual soul into the new group member. That way you'd preserve identity. It'd take some messing around, but it might work."

I tried this method but you can never add the new unit to the group fast enough even when using a killed event handler. Also in my case it messes up the whole dynamic group system to use group respawn unless you can add the new unit at the point of death. If only setIdentity worked in MP we wouldn't have to faff around with buggy tricks. Anyway As it is it works fine for Sahrani virus, I wasent knocking your lack of persistence, just using it as a reference. Great mission.

Share this post


Link to post
Share on other sites

This should be discussed in the "MISSION EDITING & SCRIPTING" forum. Moving...

Share this post


Link to post
Share on other sites
@ Aug. 11 2007,10:24)]Using this method the identity will not be transfered properly. Just like the sarani virus (zombie) map. Theres no simple way to transfer identity. In MP the only time a player can transfer to a new type of character with there name + face intact is during a group respawn game when they switch to another unit in there group when they die.

You can not get the number of magazines in a players inventory so you can not transfer them to a new character. You could find his weapons tho.

These are the reasons there are no proper career paths and inventory restoration on death in evolution btw.

That's not entirely accurate... i did manage to get mp player switching working at one point a month or so back, but got side tracked onto other stuff...

atm i'm snowed under and for the life of me i can't quite remember verbatim what tweaks i had too do...

the method was essentially 'add/removeSwitchableUnit', had some locality issue that i had to scoot around and 'selectPlayer'...

give it another try... i'm sure you can get it working... if you get really stuck pm me and i can possibly revist this next weekend...

Share this post


Link to post
Share on other sites
@ Aug. 11 2007,10:24)]Using this method the identity will not be transfered properly. Just like the sarani virus (zombie) map. Theres no simple way to transfer identity. In MP the only time a player can transfer to a new type of character with there name + face intact is during a group respawn game when they switch to another unit in there group when they die.

You can not get the number of magazines in a players inventory so you can not transfer them to a new character. You could find his weapons tho.

These are the reasons there are no proper career paths and inventory restoration on death in evolution btw.

That's not entirely accurate... i did manage to get mp player switching working at one point a month or so back, but got side tracked onto other stuff...

atm i'm snowed under and for the life of me i can't quite remember verbatim what tweaks i had too do...

the method was essentially 'add/removeSwitchableUnit', had some locality issue that i had to scoot around and 'selectPlayer'...

give it another try... i'm sure you can get it working... if you get really stuck pm me and i can possibly revist this next weekend...

You can change to another unit, even in MP, simply by using selectPlayer.

But strangely units locality is not transfered when doing so, so caracter behavior is still controlled by the server (if the unit was not previously in your own squad). You move around, but the server replace you almost instantly to where you were before moving.

To transfer locality, you'll need to first explicitly transfert it by making the target unit join player's group (thus becoming local to player's PC), then use selectPlayer to transfer player to target unit, and make the new player join the correct group again.

But you'll still run into identity issues, as player will have the original target unit's identity (name, voice, etc...)

If you want to re-create on the fly all the target unit's environnement (weapons, group, etc..) I guess many informations may be lost, like the current behavior and actions, the knowsAbout list for the group, things like that. OTOH it's prolly the only way to transfer identity. A matter of choice.

Share this post


Link to post
Share on other sites

So, it could be done in SP?

If I place the rifleman, squad leader and officer and setidentity all the same, remove the players weapon before promotion, the player will notice nothing exept the model/character change?

Share this post


Link to post
Share on other sites

Found it. You can "saveidentiy" and "loadidentity".

So I could save ID, spawn a new character, load ID, Force switch over and delete the old unit. Hoorah! yay.gif

Share this post


Link to post
Share on other sites

Any news regarding Identity transfer in MP games yet?

I'd like to use it in a mission, but I simply can't even transfer the units name and I'm curious if somebody may have found a way to do it yet..

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×