Author Topic: is_tagged fixed!  (Read 7685 times)

0 Members and 2 Guests are viewing this topic.

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
I made a simple two line fix for the is_tagged SEXP. The source code changes are shown below. :cool:

Code: [Select]

Where: Code\Parse\SEXP.cpp, sexp_is_tagged() function.
The original code:

if(Ships[sindex].tag_left > 0.0f)
return 1;

The fixed code:

object *caller = &Objects[Ships[sindex].objnum];
if(ship_is_tagged(caller)) // This line and the one above were added.
// if(Ships[sindex].tag_left > 0.0f) The broken code. Changed by EdrickV@HLP
return 1;


The ship_is_tagged() function call is the same one used by the HUD code. The line above that which gets object* info from a ship object was borrowed from the sexp_special_warp_dist() function in the same file. (That being the first ship->object conversion I found.)
Vrodic, feel free to put this into your CVS copy. :)
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Oh, and if you're wondering why I fixed this when has-been-tagged-delay already works, this doesn't do the same thing. This is true while the ship is tagged then goes false when the tag wears off. has-been-tagged-delay is true once a ship has been tagged. Period. It doesn't go back to false, except maybe when the ship departs or is destroyed. With this you could see if the player tags a ship multiple times. (Using chains.) And who knows what else.
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
This might be useful for some of those special missions; good work. :)

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
It was surprisingly easy to do. Makes me wonder why :v: didn't do it. Maybe they didn't know it was broken? Or maybe they didn't care or just didn't think of using the HUD code. (My original idea was to dig into the HUD code and find where it tells if a ship is tagged or not. I expected code in there like the code that was in the sexp. But that function call was better and now I know how to get object* data from a ship struct object so it was a learning experience too. :) Now I should work on making my basic config program, so I can control my FS2X.exe's config.
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline DTP

  • ImPortant Coder
  • 28
    • http://www.c4-group.dk
The way V did it makes perfect sense. It is you who are asking the wrong Question.

The right Question is.

Is the ship tagged at this very moment with an active TAG missile?

and not

Has the ship been tagged at all?.

you should use a Variable that is set to 1 in FRED2, once the ship has been tagged,instead of rewriting the SEXP, maybe corrupting backward compatibility with the missions written in the past.:wink:
VBB member; reg aug 1999; total posts 600.
War is a lion, on whos back you fall, never to get up.
Think big. Invade Space.

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Quote
Originally posted by DTP
The way V did it makes perfect sense. It is you who are asking the wrong Question.

The right Question is.

Is the ship tagged at this very moment with an active TAG missile?

and not

Has the ship been tagged at all?.

you should use a Variable that is set to 1 in FRED2, once the ship has been tagged,instead of rewriting the SEXP, maybe corrupting backward compatibility with the missions written in the past.:wink:  


You're thinking of the wrong SEXP. has-been-tagged-delay is the one that does "has the ship been tagged at all" the one I fixed (which did not work) is is_tagged. The way is_tagged should have worked is to return true while the ship is tagged.
But the :v: code doesn't work. They probably changed the ship or tag code and broke is_tagged but didn't notice because they didn't use it. They didn't use has-been-tagged-delay either. They did use turret-tagged-only. (In SM02-02.fs2, grep is handy at times like these.)
I didn't touch has-been-tagged-delay since it works, though it doesn't do what some might want it to. Once it's true it stays true.
On the other hand, is_tagged goes back to being false when the tag wears off. I have a mission I have used it in to prove it. That mission won't work with the :v: exe, but with the modified exe it works fine.
And I just tested it again with both exes. (Right before I got kicked off by AOL for the second time while writing this dang post.)

Edit: Forgot the link to the Most Useless SEXP thread where I initially learned about is_tagged which I hadn't tried using before: http://www.hard-light.net/forums/index.php/topic,6242.0.html
« Last Edit: May 13, 2002, 01:43:13 am by 657 »
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline DTP

  • ImPortant Coder
  • 28
    • http://www.c4-group.dk
now i cant recall the mission name or filename, but;

I seem to remember that I tagged some fighters with the dummy TAG A in the nebula, in that test TAG A dumb fire missile mission.

And the minute i did that the Fighter got pulverized by AAA´s, flak, missiles.

EDIT-seems i misunderstood something about the tagged events.

Will be testing something.

« Last Edit: May 14, 2002, 06:25:19 pm by 508 »
VBB member; reg aug 1999; total posts 600.
War is a lion, on whos back you fall, never to get up.
Think big. Invade Space.

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Quote
Originally posted by DTP
now i cant recall the mission name or filename, but;

I seem to remember that I tagged some fighters with the dummy TAG A in the nebula, in that test TAG A dumb fire missile mission.

And the minute i did that the Fighter got pulverized by AAA´s, flak, missiles.

EDIT-seems i misunderstood something about the tagged events.
Will be testing something.
 


It's SM2-02.fs2, and it uses turret-tagged-only which doesn't do what I'd thought it did. (I had wondered about the same thing myself, but grep doesn't lie. :) )

turret-tagged-only
   Makes turrets target and hence fire strictly at tagged objects
   1: Ship name
   NOTE: Will not stop a turret already firing at an untagged ship
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline DTP

  • ImPortant Coder
  • 28
    • http://www.c4-group.dk
yeah, i just figured out the same thing.

Tested an freindly Deimos, a hostile fighter and a Hostile Cruiser.

Non of them jumped out when they where hit by a tag A missile, what they should have, according to events.

nice Fix, I will build it into my Version if you dont mind. When i get the time i will write everything down what I have done so far of fixes and so, and make it public.

EDIT:He i Forgot, I wonder who made that broken code was it by any chance AL?. the same dude who where / is  responsible for the NEXT BANK WITH AMMO INHERITS EMPTY BANK FIRE_WAIT TIME.
« Last Edit: May 14, 2002, 06:54:54 pm by 508 »
VBB member; reg aug 1999; total posts 600.
War is a lion, on whos back you fall, never to get up.
Think big. Invade Space.

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
I'm not quite sure, but it looks like Dave may have done that code. And it looks like it may have worked. I'm not entirely sure why it doesn't.
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline Solatar

  • 211
I know this is kind of digging up an old thread, but could somebody compile a version of fs2_open3.3 with this feature? You won't believe how useful it will be in a few of my missions. PLEASE!!!

Whoever does it can have a TVWP avatar, and can be a tester (access to all the latest TVWP stuff, WAY before anybody else gets it)

EDIT: A little OT - If somebody can compile this, can anybody put in the little piece of code that fixes the weapon techdatabase crashes thing?
« Last Edit: November 18, 2002, 04:44:17 pm by 691 »

 

Offline Inquisitor

Sticky-ing till we find a volunteer :)
No signature.

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Dang, I thought this would be in fs2_open by now. DTP, or anyone else with CVS write access, you're welcome to put this into fs2_open 'cause looking at the sexp.cpp file through the CVS browser shows that it's not in there for revision 2.3. :)
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline Solatar

  • 211
Quote
Originally posted by Inquisitor
Sticky-ing till we find a volunteer :)


Thanks a lot!

 

Offline Sesquipedalian

  • Atankharz'ythi
  • 211
Send me the files, EdrickV.  I'll put them in. :)
While we're at it, did you (or anyone) ever get a working end-mission sexp?
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

The Scroll of Atankharzim | FS2 syntax highlighting

 

Offline Solatar

  • 211
I think somebody did, anyway, Goober5000 really wants one for the Unification War also. Thanks Sesquipedalian.

 

Offline Inquisitor

Thanks Sesqui :)
No signature.

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
I think the following code would work to actually end a mission, but I don't have the tools to make a SEXP for it to test it:
Code: [Select]

// we have a special debriefing screen for multiplayer furballs
if((Game_mode & GM_MULTIPLAYER) && (The_mission.game_type & MISSION_TYPE_MULTI_DOGFIGHT)){
gameseq_post_event( GS_EVENT_MULTI_DOGFIGHT_DEBRIEF);
}
// do the normal debriefing for all other situations
else {
gameseq_post_event(GS_EVENT_DEBRIEF);
}


That code is, IIRC, run when the player's ship has finished it's warpout animation so it ought to work.
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline Solatar

  • 211
For the end-missin sexp, I will use it like so:
Player faces fighterbay of target ship, once he/she is inside (No_collide_invisible tag will be on all carriers) the fighterbay, the player presses Alt-J, and then the mission ends. No warpout, no charge-up.

  

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
You only need no_collide_invisible if you're using a ship that has a hangarbay with an invisible wall. (Like the Orion.) If you're making your own ships, just don't put invisible walls in the hangar. And you can do almost everything you want now without source changes. (Everything except the no-charge up sound.)
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers