Coding

Stare in awe at the fascinating machinations of the TNM team during the last two years of production, this was our private forum.

Moderator: TNM Team

that guy
The Nameless Mod
The Nameless Mod
Posts: 1312
Joined: Mon Apr 26, 2004 1:54 am
Location: Perth, Western Australia

Post by that guy »

ok jim, where can I get the latest one. Does jonas or trestkon have it? is it or our ftp? or should I get it from you?
User avatar
Jonas
Off Topic Productions
Off Topic Productions
Posts: 14224
Joined: Sat Apr 24, 2004 9:21 pm
Location: Hafnia

Post by Jonas »

It's one of the ones he linked to in his first post. Number 2, I reckon.
Jonas Wæver
Chief Poking Manager of TNM

I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
User avatar
Jim
Off Topic Productions
Off Topic Productions
Posts: 301
Joined: Thu Apr 29, 2004 10:12 pm
Contact:

Post by Jim »

Actually they're both new, I'd like them both tested, if that's okay.
I exist within the power lines...for some odd reason.
that guy
The Nameless Mod
The Nameless Mod
Posts: 1312
Joined: Mon Apr 26, 2004 1:54 am
Location: Perth, Western Australia

Post by that guy »

I tried number 2 and the changing of volume part way through a song is workign nicely.
User avatar
Jonas
Off Topic Productions
Off Topic Productions
Posts: 14224
Joined: Sat Apr 24, 2004 9:21 pm
Location: Hafnia

Post by Jonas »

I need a new function in the mission script.

22_GoatTemplae
FirstFrame

// Change alliances if the player is allowed to enter the inner Templae
when ALLIED_CULT_GOAT=True AND QC_CULT_DestroyTheTablets=True
change alliance for "InnerTemplaeGuards" towards "Player" to 1.000000
change alliance for "TemplaeSecurityRoomGuard" towards "Player" to 1.000000
set bNoAlarm=TRUE for "TemplaeSecRoomCam" AND "TemplaeStairsCam2" AND "TemplaeStairsCam1"
Jonas Wæver
Chief Poking Manager of TNM

I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
User avatar
Trestkon
Off Topic Productions
Off Topic Productions
Posts: 2820
Joined: Sat Apr 24, 2004 9:03 pm
Location: Canada
Contact:

Post by Trestkon »

Shane, would you mind fixing these errors when you have a chance, I get them when I try to compile (using fully updated packages)

Error: C:\DeusEx\tnmitems\Classes\UraniumStick.uc(4) : Error, tnmitems.UraniumStick's superclass must be tnmitems.tnmitems, not TNM.tnmitems

Error: C:\DeusEx\TNMDeco\Classes\SubwayMachine.uc(45) : Error, Unrecognized member 'KeyID' in class 'SubwayPass'
-Life does not snap to the x-axis
that guy
The Nameless Mod
The Nameless Mod
Posts: 1312
Joined: Mon Apr 26, 2004 1:54 am
Location: Perth, Western Australia

Post by that guy »

I don't get either of those errors. I probably just forgot to update tnmitems. I'll do so. Check the packages thread.
User avatar
Trestkon
Off Topic Productions
Off Topic Productions
Posts: 2820
Joined: Sat Apr 24, 2004 9:03 pm
Location: Canada
Contact:

Post by Trestkon »

that guy wrote:I don't get either of those errors. I probably just forgot to update tnmitems. I'll do so. Check the packages thread.
Excellent, I'll download those when I get home:D
-Life does not snap to the x-axis
User avatar
Jonas
Off Topic Productions
Off Topic Productions
Posts: 14224
Joined: Sat Apr 24, 2004 9:21 pm
Location: Hafnia

Storing map changes between missions as an integer

Post by Jonas »

Shane,

You may know I'm a bit of a neat freak when it comes to game design. Therefore, the idea of giving each skill award trigger plus certain important pickups in the Goat Templae? its own flag to identify whether or not it should be present in mission 22 does not appeal to me. TOO MANY BLOODY FLAGS. But if we don't implement some sort of check, the crate with the augmentation canister in the crystal cave will mysteriously reappear in mission 22 if you find it and claim the aug after destroying the crate in mission 20. Likewise, if the player finds all the secrets in mission 20, he can just enter them again in mission 22 to get the exploration bonuses again.

So I had this idea, I'm not sure it'd be possible, but it might save us a lot of flags. Of course it might also be complicated to implement, but I'll describe what I have in mind here and then you can see if you like it.

Basically, we'll store an integer on the player called something like Int_GoatTemplaeStatus. The value of integer will tell the level which items the player has grabbed. To be honest, my math isn't good enough to specify exactly how this'd work, but you're a pretty awesome programmer, so hopefully you'll know how to do it. My immediate thoughts is to use some sort of binary or hex or something, but I really don't know.

Say that every time you pick up an important item or claim a skill award, a certain number will be added to this integer. It should be set up in such a way that a given value of the integer can only yield a very specific set of components. That way, the mission script would be able to look at the integer and deduce exactly which items and skill triggers to remove from the map. Is this possible? Because if it is, the only code we need is a trigger that can add a certain number to a certain integer stored on the player, and a function in the mission script that can translate the value of the integer into a set of items/decorations/triggers to remove.

Is that possible? Is it a good idea? What do you think?
Jonas Wæver
Chief Poking Manager of TNM

I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
DDL
Traditional Evil Scientist
Traditional Evil Scientist
Posts: 3791
Joined: Mon Oct 17, 2005 10:03 am

Post by DDL »

You could use a flag_int (save on player vars), and yes: you simply use multiples of two, so:

found secret 1 = +1
found secret 2 = +2
found secret 3 = +4
found secret 4 = +8
found secret 5 = +16

etc

So a value of 1040 can ONLY arise if you find secrets 5 and 11 (1024 + 16).

Admittedly, deciphering the code at the end is a bit of a bitch, but it's entirely doable.
User avatar
Jonas
Off Topic Productions
Off Topic Productions
Posts: 14224
Joined: Sat Apr 24, 2004 9:21 pm
Location: Hafnia

Post by Jonas »

okay, I just talked to my Dutch programmer friend, and he suggested using binary. Basically, say you have 2 skill awards and a crate with an augmentation canister:

Award 1 = +1
Award 2 = +2
Award 3 = +4
Aug canister = +8

So the integer starts out as 0, but if you leave the level after getting award 2 and the canister, the integer will be 10. Upon entering the level again in M22, the MS will then compare the value of the integer with the following table:

1 = Remove Award 1
2 = Remove Award 2
3 = Remove Awards 1 and 2
4 = Remove Award 3
5 = Remove Awards 1 and 3
6 = Remove Awards 2 and 3
7 = Remove Awards 1, 2, and 3
8 = Remove Canister
9 = Remove Canister and Award 1
10 = Remove Canister and Award 2
11 = Remove Canister and Awards 1 and 2
12 = Remove Canister and Award 3
13 = Remove Canister and Awards 1 and 3
14 = Remove Canister and Awards 2 and 3
15 = Remove Canister and Awards 1, 2, and 3

That's the way I would do it (because it's easy and yet fancy). Another - possibly even easier but less fancy - way to do it would be to just make a 4-digit integer, starting out as 0000 and then adding 1, 10, 100, or 1000 to that integer as the player picks these things up. So say he finds all the awards, the integer will be 0111. If he finds the canister too, it will be 1111.

And then a way to make it even fancier would be to commandeer one of the unused fields in the objects' properties to identify them, similar to what we did to put prices on the weapon shop items. That way we wouldn't have to make a specific list of items in the mission script for each map where we have to do this, we could just make one big-ass function that encompasses all these cases and call that from the mission script in FirstFrame. Of course we'd still need a function in the mission script that adds certain numbers to the integer eg. when the player picks up the aug upgrade (because you can't reliably trigger a trigger when an item is picked up).
Jonas Wæver
Chief Poking Manager of TNM

I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
User avatar
Jonas
Off Topic Productions
Off Topic Productions
Posts: 14224
Joined: Sat Apr 24, 2004 9:21 pm
Location: Hafnia

Post by Jonas »

Hey DDL, sorry I missed your post, was typing out my own bigass post while you posted it :oops:

Anyway, your idea corresponds to the Dutchman's, but what do you think of the other methods put forth in my post?
Jonas Wæver
Chief Poking Manager of TNM

I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
User avatar
NVShacker
Off Topic Productions
Off Topic Productions
Posts: 178
Joined: Sun Sep 03, 2006 4:14 am

Post by NVShacker »

Jonas all you're talking about with the powers (not multiples DDL, don't make me get my stick!) of two thing is essentially consolidating flags into one variable. Fortunately UScript does have a bitwise AND operator so this could be done. The math would thus be pretty siimple, just (to check for the second flag):
(1+2+8)=11...11&2...
1011 & 0010 (bitwise AND just compares bits so)
0010 which is equal to 2 or just greater than 0 (either check works)

The other form would be inefficient as it's trying to mimic binary in base 10.

The third method hardly sounds like a solution of a "neat freak" and it might be a bit confusing to try to keep track of everything, though I believe it's doable.

My suggestion would be to use the first method as uscript ints are (according to the the language reference) 32 bit values thus 32 flags per int.

EDIT- smilies in my math >:(
NVShacker
Are you still there?
that guy
The Nameless Mod
The Nameless Mod
Posts: 1312
Joined: Mon Apr 26, 2004 1:54 am
Location: Perth, Western Australia

Post by that guy »

wow I'm AWOL from the forums for like 2 days and everyone thinks they can just muscle in on my coding racket. Not cool guys.
User avatar
Trestkon
Off Topic Productions
Off Topic Productions
Posts: 2820
Joined: Sat Apr 24, 2004 9:03 pm
Location: Canada
Contact:

Post by Trestkon »

Shane, would you mind doing a TNM package update? I want to verify those bug fixes of yours, but I want to make sure I'm doing it with the newest code :)
-Life does not snap to the x-axis
Post Reply