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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×