Is this complicated? pick up object and increment++
by Sean Brady · in Technical Issues · 02/27/2009 (1:22 pm) · 3 replies
Sorry, my name is Sean Brady and I need to get some advice from the gg community. I trying to create a simple enough mechanism. The sequence of actions are as follows;
- player enters world
- player collects 3 items
- registers on gui
(Note: I got a rough version of the level up to here done using the 'getting started' pdf helper thing but anytime I go back to the main menu and load the mission again the gui control = 3, i need it to go back to 0 at the mission end automatically)
- if object count = 3 then next level loads
help please!???!????
Sean
- player enters world
- player collects 3 items
- registers on gui
(Note: I got a rough version of the level up to here done using the 'getting started' pdf helper thing but anytime I go back to the main menu and load the mission again the gui control = 3, i need it to go back to 0 at the mission end automatically)
- if object count = 3 then next level loads
help please!???!????
Sean
About the author
Professional mouth!, getting projects complete is the only problem.
Torque Owner Mike Rowley
Mike Rowley
In your items script, you would add a function to place the number on the screen thru a gui.
You would also need to code a check to see if the number of items is =3 and if true, switch missions.
Go into server/scripts/ and make a copy of item.cs and rename it to something that is realitive to your objects.
If you look thru the code, you'll find "function ItemData::onPickup"
You'll see where torque already adds a comment on the screen when you pick up an object. You would change this to put the number up.
// Inform the client what they got. if (%user.client) messageClient(%user.client, 'MsgItemPickup', '\c0You picked up %1', %this.pickupName);Just above that code is this code:%count = %obj.count; if (%count $= "") if (%this.maxInventory !$= "") { if (!(%count = %this.maxInventory)) return; // Change this to start your next mission. ( cycleGame(); ) } elseHope that helps you.