Jump to content

Changing Of Game Variables "on-the-fly?"


GBHis

Recommended Posts

I'm planning on doing this 3d tic-tac-toe mod for oblivion...

It will feature different levels of AI. (5-year-old, easy, medium, hard, master)

 

The player (and the opponent, the NPC) will be standing on a balcony/platform about 5 metres above the playing grid. (Floating in a black void, methinks.)

 

In order to get the player part to work properly, the player would need to activate the balls on the grid.

Therefore I'll need to change the "Activate Range" variable to some huge number, when the player enters the cell. I/You wouldn't like it to be permanent, ye know!

 

So the big question is:

How do I SCRIPT the change? (And how do I trigger it to load when the player enters the area/cell?)

 

Please help, I have no clue on how to do this. The variable has another name, but I can't remember it at the moment.

 

-GBHis

Link to comment
Share on other sites

I don't think you can set default variables using this method. Even using a quest script to emulate such a variable in order to move pieces to a specific location. would be quite an endevour just in figuring out all the math involved.

 

What you might want to do is use faction rank combined with packages to control the placement of an actor for instance:

____

|123] 0

|456|

|789|

 

Where "]" is a doorway to another room, and 0 is a marker in that room, while 1-9 are markers placed on the game field.

 

setting markers like that for a travel package set on all the actors to work off the faction rank of a specific actor. When the player activates one of the controls the first time changes the rank of their first piece, and they to move to that spot. The next time a player uses the control it changes the rank of their second piece, moving them to another spot. The problem of course is making sure that the player can't move the same piece twice or one piece where another already is, setting up the opponent AI. Gettiing a check to see if there is a winner would also be a problem. But using this method, it would be easier to control the pieces than if using a single variable combined with a group of objects. Also, depending on your choice of actors to portray the pieces, it can be a bit more entertaining. Naturally, you'd want to create a seperate actor for each piece to avoid scripting problems.

 

As for resetting, it would probably be easier to do this when the player activates an object in the cell (IE setting all the pieces ranks to 0, and resetting the controls), so that they can replay without having to change cells.

Link to comment
Share on other sites

I'm not sure, what you're talking about there...

 

I have made the grid (only in my mind) the way I want it.

The layout:

¨¨¨¨¨¨¨¨¨¨ __

¨¨/ */ * / * /_|

/__/__/__/_| |

| * | * | * |_|/

| * | * | * |_/

| * | * | * |/

 

You have three rows of 9 bricks. 3x9 = 27 bricks.

Bricks are using the orb models from the dreamworld. (Element of Perception, etc.)

At the beginning of the game, all the bricks are grey(or red).

The player's color is yellow.

The NPC/AI has green.

The Player starts by activating one of the orbs. If the orb is grey(or red), the orb is replaced by a new orb, the yellow one. The AI registers it, and the AI chooses the one it would like to "live in."

The NPC's chosen orb turns green, and so on.

At the end of the game (either by someone gaining three on a row, or a draw), it is determined who has won. If it's a draw, it's the NPC.

Whenever the player beats a level, he is given some secret.

 

The first one is how to make arrows out of forks. (Yeah, now every fork is usable as an arrow)

 

The second how to make blackjacks of spoons. Now all (large) ladles/spoons can be used as blunt melee weapons. If the original creator of the blackjack lets me do it, I'll use his script as well for "zapping" people on hit in the head.

 

The third is the "Rain of Spoons" spell that causes spoons to fall out of the sky and damage, like meteor shower.

 

The fourth is Leomunds D&D spell pack. (In-game it's called the notebook of Leomund.)

It gives you some nice D&D (3.5) spells:

1. Lemound's Secret Chest

Creates a chest that can be summoned at wish. You can put items and stuff in it as you wish and then "dis"-summon it to it's plane.

2. Leomund's Secure Shelter

Summons a little cottage with Arcane locks on windows and the door.

There is an iron grate blocking the chimney. An unseen servant is also conjured to help mend wounds and bring the player refreshments and drinks.

3. Leomund's Tiny Hut

Summons a tiny hut with white "elemental" walls.

When the player enters the house, he is able to see out, but no-one can see inside it. [unlike the D&D version, arrows, missiles and magic CANNOT pass through the walls. I'm not THAT talented at modding...]

4. Leomund's Trap

"Makes a door, lock or other small mechanism look like it's trapped."

[This one is very unlike the D&D version. It can be cast on ANY activate-able item. (Books, food, doors, locks, almost anything.) When someone tries to activate it, they must wait 5 seconds before opening/activating the item.]

 

Level 5 -- no ideas at the moment, but wait and see.

 

I wanted to know how I can change the activation range at which people are able to activate things, via a script. The default varible is about 4, methinks. Is it possible?

Link to comment
Share on other sites

As far as I've been able to gather, only quest stages and factions can be used to store values that can be accessed and changed from anywhere. My example above was in using factions on a group of actors to move them to a specific location since you can change actor faction ranks rather easily. Quest stages can also work though, now that I think about what you describe, and might be the way to go.

 

If you're stuck on the idea of using orbs, you would probably have to set 9 quests with stages 0, 10, and 20. With repeatable stages. each of them is to record each tile color, 0 being the grey color. When a player activates their related control, it sets the quest stage for that block to 10. When the NPC activates it sets the stage for that block to 20.

 

The problem of lighting the tiles, can be done by putting some sort of group of switchs where the player is, or using a message box function for them to select a block to light. The message box would probably look better, but might be tough trying to work out.

 

In order to control all the main stuff, resetting, and determining a winner, you would need a 10th quest with stages 0, 10, 50, 75, 100, and a script. The script would track the quest stages, and use them to see if if 3 blocks in a row are lit by the same player. I don't have the hours it would take to figure out the script, but I believe it can be done in this manner. The stages here would work as follows:

0 would act as a reset when set by the script it would also set the other 9 quests to 0.

10 would be the standby state for use while the player is playing or when they aren't in the area.

50 is for a losing state, if 3 blocks in a row are set by the opponent.

75 would be if there is no winner. (could be set if blocks 1-9 are all set >=10, but this could cause problems if the last move wins it.) Not needed, but might be supported

100 would be if the player has 3 blocks in a row.

 

Using these settings you can tailor the NPCs dialog to react to the game.

 

The big problem is how you decide to make the NPC select their tiles, for this I have no ideas other than it being random, just make sure to add a conditional so that if that block is already in use, they will decide again.

 

No matter how you look at it, just trying to get the game to work properly would be a task, forget the rewards.

Link to comment
Share on other sites

The game itself is kinda' done.

I have some experiences with AI programming. Especially tic-tac-toe.

You know, I was stuck on a machine with 2MB ddr ram and 5 gB harddisk (without internet, either dial-up or dsl) from I was 8 till I was 12.

Four years of BASIC and Turbo Pascal programming... I made quite an amount of programs.

I think I will just port some AI's from my old BASIC programs.

 

Big Problem >>

If I can't change the GameSetting, I will have to make on of those blasted spells. Or make the game a miniature game instead.

 

Thanks anyway!

Link to comment
Share on other sites

The game itself is kinda' done.

I have some experiences with AI programming. Especially tic-tac-toe.

You know, I was stuck on a machine with 2MB ddr ram and 5 gB harddisk (without internet, either dial-up or dsl) from I was 8 till I was 12.

Four years of BASIC and Turbo Pascal programming... I made quite an amount of programs.

I think I will just port some AI's from my old BASIC programs.

 

Big Problem >>

If I can't change the GameSetting, I will have to make on of those blasted spells. Or make the game a miniature game instead.

 

Thanks anyway!

 

You can't change gamesettings, but you can emulate global variables using faction rank or quest stages. This is kinda where I was going. You just need to think out of the box in regards to what works best. Think of faction rank as more of a local variable and quest stages as a global variable. Since both can be changed and read from anywhere, they can be used to perform various functions, or stand as a logic check.

Link to comment
Share on other sites

The problem with the gamesetting was to get the player to activate the balls. (And the main NPC script to realise that the ball was activated.)

You suggest adding a quest stage for each of them? Like a script entry when changing things:

quest tictactoelvl1 step 0102 "I have chosen field number 1 in the second row."

I think that would work. Thanks!

And a script entry on the NPC that spawned when the tictactoelvl1 quest changed?

 

I could create a tic-tac-toe faction for tracking which levels the player was on. But then I would have to make some of those icons, and I'm bad at anything that relates to graphics... Too bad. I'll have to use the default one, then.

Link to comment
Share on other sites

The problem with the gamesetting was to get the player to activate the balls. (And the main NPC script to realise that the ball was activated.)

You suggest adding a quest stage for each of them? Like a script entry when changing things:

quest tictactoelvl1 step 0102 "I have chosen field number 1 in the second row."

I think that would work. Thanks!

And a script entry on the NPC that spawned when the tictactoelvl1 quest changed?

 

I could create a tic-tac-toe faction for tracking which levels the player was on. But then I would have to make some of those icons, and I'm bad at anything that relates to graphics... Too bad. I'll have to use the default one, then.

 

Don't need to worry about icons, you can set any faction to be hidden from the player. This way, you can use it within your own testing to see what's happening, then disable it from being seen when it's released.

 

The problem with using quest stages or factions in this manner is that they have to store data numerically, and can't handle really high numbers. The difference between them is that factions are a bit more versatile in that they can be changed and read quickly on multiple sources, and are processed less frequently, while quest stages can only be changed and read on a single source, and would be processed more frequently as long as it is running. In this, you could potentially use 9 different actors (different bases), the NPC giving the quest, and the player with only 1 faction to control most processes. The 9 actors as a standin for each of the blocks, the block their associated with changing based on their faction rank. The faction on the NPC controlling the stages of the game, reset, start, middle, and finish. And the faction on the player for controling the difficulty. But that could get a little clumsy. The advantage of using a quest instead is so that you can attach more scripts to do various things when needed.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...