Help changing player name...

In my game there will be certain parts where the player will take control of an NPC. Just for added realism I wanted to make sure that the player's name would change along with the map icon. So I set up a global for storing the Hero's name (gb_hero_name), and make sure that within the main.cet the global gb_hero_name will be set to the value 'Name'.

Then I made the event to change the player icon and player name (using the attribute wizard I choose 'Player Name' and have it set to '&&gb;_hero_name'). All seems well and good.

Then i start up the game to test it all out and switching to the NPC is flawless - the icon changes and the name changes - as it should. But when I switch back to the hero the name becomes literally '&&gb;_hero_name' not whatever the player sets it to in the begining.

Can anybody help me? Did I screw up somewhere? Or is this a bug?

P.S. A similar system could be set up for a sort of party system where the player would switch characters via a map button or keydown - I think this method of making a party has been discussed before....so I won't blab anymore about it. 😄

------------------
(url="http://"http://jankostar.net/sanko")my Page of Garbage(/url)

(This message has been edited by sanko (edited 09-06-2002).)

Quote

Originally posted by sanko:
**So I set up a global for storing the Hero's name (gb_hero_name), and make sure that within the main.cet the global gb_hero_name will be set to the value 'Name'.

Then I made the event to change the player icon and player name (using the attribute wizard I choose 'Player Name' and have it set to '&&gb;_hero_name'). All seems well and good.

Then i start up the game to test it all out and switching to the NPC is flawless - the icon changes and the name changes - as it should. But when I switch back to the hero the name becomes literally '&&gb;_Hero_name' not whatever the player sets it to in the begining.**

Mr. Sanko,

Make sure that your use of your global is consistant. In your above post you stated that you stored the name into "&&gb;_hero_name" and then later recalled the name out of "&&gb;_Hero_name"

Globals are case sensitive, so if the above was not a typo then CGE is replacing the characters name with "&&gb;_Hero_name" because there is no global named that. The global that has the characters name has a small "h" in hero, not a capital "h."

If the above is just a typo, and you are setting and recalling from the same global, then I would look to see where you are setting the global. When you save the characters name originally, and then change the player's name, call a dialog where you output &&gb;_hero_name so you can check right away what its value is, and make sure it is being set correctly.

Good luck.

(edit) Fixed a typo of my own (/edit)
------------------
What's The Difference Between Roast Beef And Pea Soup?
Anyone Can Roast Beef.
------------------
(url="http://"http://www.avalon.net/~honda/pog/pogwalkthrough2a.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://www.ambrosiasw.com/cgi-bin/vftp/dl-redirect.pl/PoG_Dev_Tools_Source.sit?path=coldstone/resources&file;=PoG_Dev_Tools_Source.sit")PoG Dev Tools(/url)

(This message has been edited by Stark Bledfast (edited 09-06-2002).)

The gb_hero_name vs. gb_Hero_name in my original post was a typo - thanks for pointing it out. 🙂

So, I followed your advice and made a dialog that said: "the value you set to gb_hero_name is: &&gb;_hero_name" and verified that it did save the proper name into the global.

Next I opened up the event that switches characters and double checked that I was calling on the gb_hero_name variable and setting that as the attribute "Player Name" in with the Atribute Wizard.

Saved everything - relaunched. Still the same problem - after switching characters once when I switch back to the main character his name changes to "&&gb;_hero_name." I even set off the event that brings up the dialog telling me what that global is set to and it was still correct...

------------------
(url="http://"http://jankostar.net/sanko")my Page of Garbage(/url)

It sounds like a bug to me, (although I'm not really very experienced with the CGE.) because the Engine isn't reading the tag as a global, its just reading it as a value (I hope I got that jargon right.). I think the problem lies in the engine, not in any mistake Sanko made. Sorry I couldn't be more help, I think yoiu might just have to wait till 1.0.2.

------------------
Poor little Johnny, of whom we'll see no more, for what he thought was H2O was H2SO4.

Sorry for changing your topic, but you're doing something that I was thinking of doing, but my question is as follows...

How are you getting the game to store the first hero's weapons/spells inventory and then recalling it to set it back for him when the player becomes him again???

Thanks in advance!

------------------
Here's my site! There is art, music, movies, and games are on there way!
(url="http://"http://www.sinthesisent.com")http://www.sinthesisent.com(/url)

I actually haven't gotten that far yet - I was hoping somebody had already figured that much out. My companion characters will be easier - they are limited to one weapon of their own that nobody else can use. So when the player switches to the NPC it will run Item Wizards to give and equip that character's special weapon - then take it away again when they switch back. I don't know how to re-equip what the main character had equiped before the change...

I'm sleepy so forgive any typos, and the lack of coherence.

------------------
(url="http://"http://jankostar.net/sanko")my Page of Garbage(/url)

I just figured out how to make sure the same weapons/armor are re-equiped...I'm still sleepy - so my logic may be off (which means everything I'm about to type could be dead wrong).

Here is an example for 2 characters named Joe-Bob and Mary-Anne. It requires 3 global variables: a global to keep track of which player is active (gb_active_player), one for Joe-Bob's weapon (gb_Joe-Bob_equiped), and one for Mary-Anne's weapon (gb_Mary-Anne_equiped). It also requires you to make a list of the weapons in the game and assign each one a different number. Here goes.

-Joe-Bob equips a Long Sword

First the linked event checks gb_active_player to see if it is Joe-Bob or Mary-Anne who has equiped it. After seeing that it is Joe-Bob it then sets the gb_Joe-Bob_equiped varialbe to 33 (the arbitrary number I assigned to the Long Sword).
Now the player decides to switch from Joe-Bob to Mary-Anne. So, in the event that switches characters it will set gb_active_player to 1 (0 is Joe-Bob, 1 is Mary-Anne). It also checks the gb_Mary-Anne_equiped variable to see which weapon she used last - it sees that it was number 21 which is a Poisoned Dagger. It then uses the item wizard to equip the Poisoned Dagger. So when our player finally changes back to Joe-Bob it'll check the gb_Joe-Bob_equiped variable and set his equipment accordingly.

I really hope that makes sense.

I'm also hoping that helps...but all that garbage is just making sure the same weapons/armor stay equiped. As far as keeping seperate inventories for each character that would be a big mess I think. I hadn't planned on keeping seperate inventories myself

I wonder if this will still make sense to me in the morning... 🙂

------------------
(url="http://"http://jankostar.net/sanko")my Page of Garbage(/url)

(This message has been edited by sanko (edited 09-07-2002).)

It makes sense - kinda! 🙂

It does make sense, but I guess that keeping seperate inventory would be a hassle. I could swear that i saw something on seperate inventorys somewhere, but I can't remember.

Oh, well I guess that I'll have to do a little rewriting and BAM you have the character loose all his inventory which he will find the key items somewhere stored away - I guess.

Thanks for the help though!

------------------
Here's my site! There is art, music, movies, and games are on there way!
(url="http://"http://www.sinthesisent.com")http://www.sinthesisent.com(/url)