Difference between revisions of "Talk:Grenade"

From UFOpaedia
Jump to navigation Jump to search
Line 34: Line 34:
  
 
:::Thanks very much, Seb76! I actually wouldn't mind some more examples, with more detailed comments :) But can I interest you in dropping me an e-mail? I have some non-grenade-related ideas I've been working on, and I could use some advice from someone with even a little understanding of the source code. [[User:Phasma Felis|Phasma Felis]] 21:53, 2 June 2008 (PDT)
 
:::Thanks very much, Seb76! I actually wouldn't mind some more examples, with more detailed comments :) But can I interest you in dropping me an e-mail? I have some non-grenade-related ideas I've been working on, and I could use some advice from someone with even a little understanding of the source code. [[User:Phasma Felis|Phasma Felis]] 21:53, 2 June 2008 (PDT)
 +
::OK, I finally set up a user page, so you can reach me on the talk page :) [[User:Seb76|Seb76]] 13:27, 4 June 2008 (PDT)
  
 
:: I've been planning to create a new article to cover and explain all the little itty bitty things about how grenades (in general) function. The timer and the dead-man-switch definitely need to be explained.  
 
:: I've been planning to create a new article to cover and explain all the little itty bitty things about how grenades (in general) function. The timer and the dead-man-switch definitely need to be explained.  

Revision as of 20:27, 4 June 2008

When using a grenade to remove terrain you can set the timer to 1 instead of 0. The aliens will move before the grenade explodes, giving you first use of the cleared terrain. -Egor


There's a trick you can perform with a 1 turn grenade with UFO doors if you know an alien will be walking through. By placing the 1-turn grenade in front of the UFO door, the alien will walk through, open the door, and end its turn. By then the grenade will explode and hit the alien. And because it's exploding before the doors are closed again, it can send a small wave into the UFO and strike any aliens that are behind the door.

It won't always work, but it's something that you can do.

- NKF

Timers

I thought I had found a bug but it's just my misunderstanding I think. I was setting timers to 3, carrying the grenade around, then it would go off when I dropped it. From this article it looks like the timer counts down while you are carrying it, but "holds" at zero. Is that true? If so we can put a clarification in for dummies like me. (I thought the timer countdown would start when I throw/drop the grenade).

PS this is a silly way for grenades to work and it's hard to think of a realistic equivalent. The timer, once set, ought to start when you release the grenade. Oh well :)

Spike 05:51, 25 March 2008 (PDT)

That is indeed a misunderstanding. Once a grenade is set, the game starts counting down the turns; as soon as it reaches 0, the grenade will explode IF IT IS ON THE GROUND. If it is not on the ground, it does indeed 'hold' at 0, and will detonate at the end of the next turn that it is sitting on the ground, regardless of how it got there. (This is the behavior used by people who want their soldiers to have dead-man switches; AKA, soldier dies, drops live grenade, blows up nearby aliens at tend of turn.) Arrow Quivershaft 09:47, 25 March 2008 (PDT)
If you want to add some difficulty in your games, you can do so that the primed grenades will detonate on due time even if handed. I did only a few tests so it may cause trouble, particularly if the soldier survives the explosion - the code should remove the grenade from its hand, but I make no promise ;). Simply patch at offset 0x1E095:
0F 85 E4 00 00 00
into
90 90 90 90 90 90
and your done. Now you should really make sure you have enough TUs to throw those nades :) Seb76 16:08, 18 May 2008 (PDT)
Seb, can you give any details about how you figure this stuff out? I'm a fairly accomplished programmer, but I only have a little experience with assembler, and this is all a mystery to me. I'd love to learn more. :) Phasma Felis 14:47, 2 June 2008 (PDT)
Actually this is possible thanks to the best disassembler in town... I started by cross-checking error messages (e.g. "couldnt allocate craftlist") with malloc/fread calls to identify the main datastructure pointers (every xxx.dat file has an equivalent in memory). Then with crossing with information from this site (offsets and stuff), I could identify some higher level functions. From there you can start analysing strange behaviors. Luck is also a factor, the disassembly is quite huge, and sometimes I just wander around and find some interesting stuff ^^ I'll post more explicit screenshots later. Seb76 15:55, 2 June 2008 (PDT)
Here you go, I "circled" the lines that check if the grenade on the floor or in a soldier inventory:

Detonate.png

This is quite huge so I'll stop for now. I have the UFO Power Source explosion sequence and unitref offset 0x3c explanation ready if you want more examples ;-) Seb76 16:14, 2 June 2008 (PDT)

Thanks very much, Seb76! I actually wouldn't mind some more examples, with more detailed comments :) But can I interest you in dropping me an e-mail? I have some non-grenade-related ideas I've been working on, and I could use some advice from someone with even a little understanding of the source code. Phasma Felis 21:53, 2 June 2008 (PDT)
OK, I finally set up a user page, so you can reach me on the talk page :) Seb76 13:27, 4 June 2008 (PDT)
I've been planning to create a new article to cover and explain all the little itty bitty things about how grenades (in general) function. The timer and the dead-man-switch definitely need to be explained.
Any suggestions on what the section should be called? I can't think of an appropriate article name for it except perhaps Grenade Mechanics or How Grenades Work. -NKF 21:52, 25 March 2008 (PDT)

Sounds like a great idea. For a title how about just "Using Grenades" or "More On Grenades and Explosives"? Spike 13:23, 26 March 2008 (PDT)

Thought I'd go with Understanding Grenades. We can always rename it later to something more appropriate. It's taken me a bit of time because I've had a lot of difficulty in trying to write it in a manner that even I could understand (and failing every time). I've decided to just throw up what I've managed to put together so far to get the ideas out there.
I realize the potential for a fence-post problem with my explanation on the grenade's time trigger (equal-or-greater than vs. greater-than), but hopefully the idea will still get across. - NKF 00:17, 4 April 2008 (PDT)