
|
|
Author |
Message |
wolf3dbreaker
I am Death Incarnate


Joined: 09 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
Posted: Thu Dec 30, 2004 6:01 am
Subject: [Tutorial] Just for fun:Invisibility/Notarget (Like in RTCW)
[ IP : Logged ]
|

 
|
|
Hello! breaker here. I just found a new way on how to code invisibility. There are a few drawbacks to it. Though:
-Patrolling guards when this cheat is activated do not move and stay in place (I'm trying to fix this bug)
-Some might say it is a stupid feature and it is dumb.
-Enemies will ONLY attack you if you attack them.
If you are still interested, then let's proceed.
1. In WL_DEF.H look for this line.
::: CODE :::
int faceframe
add this underneath
::: CODE :::
boolean invisible;
2. Also in WL_DEF.H look for this line.
::: CODE :::
extern boolean singlestep,godmode,noclip,invisible;
add the red line.
3. Now go to WL_ACT2.C and look for this part
::: CODE :::
/*
===============
=
= T_Stand
=
===============
*/
void T_Stand (objtype *ob)
{
if (!invisible)
SightPlayer (ob);
}
Add the red line.
4. Now go to WL_STATE.C
::: CODE :::
boolean SightPlayer (objtype *ob)
{
if (invisible)
return 1;
if (ob->flags & FL_ATTACKMODE)
Quit ("An actor in ATTACKMODE called SightPlayer!");
add the red line.
5. Finally, go to WL_DEBUG.C and look for this.
::: CODE :::
else if (Keyboard[sc_I]) // I = item cheat
{
CenterWindow (12,3);
US_PrintCentered ("Free items!");
VW_UpdateScreen();
GivePoints (100000);
HealSelf (99);
if (gamestate.bestweapon<wp_chaingun)
GiveWeapon (gamestate.bestweapon+1);
gamestate.ammo += 50;
if (gamestate.ammo > 99)
gamestate.ammo = 99;
DrawAmmo ();
IN_Ack ();
return 1;
}
Change it to:
::: CODE :::
else if (Keyboard[sc_I]) // I is for Invisibility!!!
{
invisible^=1;
CenterWindow (18,3);
if (invisible)
US_PrintCentered ("Invisibility ON");
else
US_PrintCentered ("Invisibility OFF");
VW_UpdateScreen();
IN_Ack ();
return 1;
}
(The sc_I is just an example. You could use the god mode cheat code, noclip cheat, extra stuff cheat or something else)
That's all. It worked for me at least. Please let me know if there are anymore bugs than the one that I mentioned.
Have fun with the notarget cheat code and credit me if you use it!
-wolf3dbreaker |
_________________ Gone from the community for a while. Will be back on July
|
|
 |
KyleRTCW
DieHard Officer

Joined: 30 Jul 2003
Last Visit: 05 Aug 2018
Topics: 45
Posts: 510
Location: Ohio

|
Posted: Thu Dec 30, 2004 3:33 pm
Subject: Re: [Tutorial] Just for fun:Invisibility/Notarget (Like in R
[ IP : Logged ]
|

  
|
|
wolf3dbreaker wrote:
-Some might say it is a stupid feature and it is dumb.
What do you mean it might be stupid? If you modfied this code not to be a cheat, you could make a uniform object!
like
::: CODE :::
bo_uniform:
if (invisible == 1)
return;
SD_PlaySound(YOURSOUNDSND);
invisible = 1;
break;
and in T_Attack
::: CODE :::
case 1:
[stuff skipped]
GunAttack(ob);
invisible = 0;
gamestate.ammo--;
break;
Nice Job man, just got to fix that bug  |
_________________ Steam: http://steamcommunity.com/id/stormx312
|
|
 |
wolf3dbreaker
I am Death Incarnate


Joined: 09 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
|
 |
BrotherTank
Forum Administrator

Joined: 01 Mar 2003
Last Visit: 13 Sep 2017
Topics: 153
Posts: 2255
Location: Ontario

|
Posted: Thu Dec 30, 2004 11:07 pm
Subject: Re: [Tutorial] Just for fun:Invisibility/Notarget (Like in R
[ IP : Logged ]
|

  
|
|
@Kyle... Close... And exactly the idea I had programmed into the advanced...
See: Click Here for Advanced Discussion
MCS already asked me about the feature and I think I explained it. Your code is close to part of mine, at least for the bonus idea. Mine triggers a countdown timer... and gives the player x amount of seconds in "invisible" mode.
@Wolf3dbreaker:
It's not a dumb feature... That's why I coded it into Advanced a few months ago... It made it even more interesting when I could tie it to Darkone's Raycastor code and the mode he was trying to create in the NewWolf Classic Engine (which was not complete)...
While what you have posted is a start.... It's not practical. Sometimes you have to watch where you are placing the conditions. You had the right idea... But not in the right parts of the code. I achieved a much better result by adding a total of 3 lines of code in total while editing 2 routines elsewhere in the code:
From "wl_state.c"
::: CODE :::
boolean CheckSight (objtype *ob)
{
long deltax,deltay;
// don't bother tracing a line if the area isn't connected to the player's
if (!areabyplayer[ob->areanumber]) return false;
// if the player is real close, sight is automatic
deltax = player->x - ob->x;
deltay = player->y - ob->y;
if (deltax > -MINSIGHT && deltax < MINSIGHT && deltay > -MINSIGHT && deltay < MINSIGHT) return true;
if (gamestate.invisible && !madenoise) return false; // Invisible Mode
switch (ob->dir) // see if they are looking in the right direction
{
case north:
if (deltay > 0)
return false;
break;
case east:
if (deltax < 0)
return false;
break;
case south:
if (deltay < 0)
return false;
break;
case west:
if (deltax > 0)
return false;
break;
}
// trace a line to check for blocking tiles (corners)
return CheckLine (ob);
}
And from "wl_act2.c":
::: CODE :::
void T_Chase (objtype *ob)
{
long move;
int dx,dy,dist,chance;
boolean dodge;
if (gamestate.victoryflag) return;
dodge = false;
if (CheckLine(ob)) // got a shot at player?
{
dx = abs(ob->tilex - player->tilex);
dy = abs(ob->tiley - player->tiley);
dist = dx>dy ? dx : dy;
if (!dist || (dist==1 && ob->distance<0x4000) )
chance = 300;
else
chance = (tics<<4)/dist;
if (gamestate.invisible && dist>1) goto invisible; // Invisible mode
if (US_RndT()<chance)
{
//
// go into attack frame
//
switch (ob->obclass)
{
case guardobj:
NewState (ob,&s_grdshoot1);
break;
case officerobj:
NewState (ob,&s_ofcshoot1);
break;
case mutantobj:
NewState (ob,&s_mutshoot1);
break;
case ssobj:
NewState (ob,&s_ssshoot1);
break;
#ifndef SPEAR
case bossobj:
case gretelobj:
NewState (ob,&s_bossshoot1);
break;
case mechahitlerobj:
NewState (ob,&s_mechashoot1);
break;
case realhitlerobj:
NewState (ob,&s_hitlershoot1);
break;
#else
case angelobj:
NewState (ob,&s_angelshoot1);
break;
case transobj:
NewState (ob,&s_transshoot1);
break;
case uberobj:
NewState (ob,&s_ubershoot1);
break;
case willobj:
NewState (ob,&s_willshoot1);
break;
case deathobj:
NewState (ob,&s_deathshoot1);
break;
#endif
}
return;
}
dodge = true;
}
invisible: // Invisible jump point
if (ob->dir == nodir)
{
if (dodge)
SelectDodgeDir (ob);
else
SelectChaseDir (ob);
if (ob->dir == nodir)
return; // object is blocked in
}
move = ob->speed*tics;
while (move)
{
if (ob->distance < 0)
{
//
// waiting for a door to open
//
OpenDoor (-ob->distance-1);
if (doorobjlist[-ob->distance-1].action != dr_open)
return;
ob->distance = TILEGLOBAL; // go ahead, the door is now opoen
}
if (move < ob->distance)
{
MoveObj (ob,move);
break;
}
//
// reached goal tile, so select another one
//
//
// fix position to account for round off during moving
//
ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;
ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;
move -= ob->distance;
if (dodge)
SelectDodgeDir (ob);
else
SelectChaseDir (ob);
if (ob->dir == nodir)
return; // object is blocked in
}
}
I used code similar to Kyle's GetBonus code and created a timer. What those few additional lines of code do is make sure that guards still react.. In fact, they still hunt the player... but unless they are 1 tile away, they don't recognise you as the enemy and go into attack mode...
If you don't make any sound, and the guards aren't in alert mode (searching / attackmode)... you can walk right past them... as long as you stay 1 tile away from them... get too close and they alert to your presence...
By changing the code the way I did, you don't have to worry about gaurds locking up or freezing when you enter the mode. With a little editing you could even change my code so that guards are sent off in different directions (randomly place the player in various fake positions each time the T_Attack routine is called)...
I'll do a screen grab so that you can see the way my invisible mode looks on the screen and post it in the Image Gallery..
Greg
BrotherTank
PS: My code works without any problems... No lockups, No guards freezing, or anything like that. Combine my code with Kyle's post and you basically have the tutorial. And the pic is posted along with a version of the Advanced "God Mode" look as well. |
|
|
 |
wolf3dbreaker
I am Death Incarnate


Joined: 09 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
Posted: Fri Dec 31, 2004 4:38 pm
Subject: Re: [Tutorial] Just for fun:Invisibility/Notarget (Like in R
[ IP : Logged ]
|

  
|
|
@BT: Hey! That is a nice work of art BT
It's just too bad that my cousin who is a coder is not around so I'm left doing some funny coding.
Anyway I'm glad for your help BT! |
_________________ Gone from the community for a while. Will be back on July
|
|
 |
Zombie_Plan
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 2:38 ago.
Topics: 103
Posts: 1641
Location: A hole in the wall

|
|
 |
BrotherTank
Forum Administrator

Joined: 01 Mar 2003
Last Visit: 13 Sep 2017
Topics: 153
Posts: 2255
Location: Ontario

|
|
 |
andy3012
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008
Topics: 29
Posts: 292
Location: England

|
Posted: Fri Mar 25, 2005 2:00 pm
Subject: Re: [Tutorial] Just for fun:Invisibility/Notarget (Like in R
[ IP : Logged ]
|

  
|
|
just out of curiosity, is their a way so that you can get this to work on specific enemies. Like what i had in mind was, to certain enemies, you could be invisible all the time. And like they could be people on your side. And usually because when you people that are supposed to be good guys they always follow you and its blood annoying espcially in max's untold story. Like you could create a city, and like when you attack them, they could attack you back like anybody would! So is this possible or what? |
|
|
 |
Guest

Last Visit:
|
Posted: Sat Mar 26, 2005 12:54 am
Subject: Re: [Tutorial] Just for fun:Invisibility/Notarget (Like in R
[ IP : Logged ]
|

  
|
|
If you don`t want your friend to follow you just modify the states of the enemy a bit so that it doesn`t include the T_Chase routine. |
|
|
 |
Guest

Last Visit:
|
Posted: Sun Jun 05, 2005 8:25 am
Subject: Re: [Tutorial] Just for fun:Invisibility/Notarget (Like in R
[ IP : Logged ]
|

  
|
|
If one was to disable the t_chase for a non-player character, then that actor wouldn't go anywhere ..
That's kinda pointless.  |
|
|
 |
insurrectionman
DieHard Mutant


Joined: 07 May 2005
Last Visit: 04 Feb 2019
Topics: 87
Posts: 759
Location: Wisconsin

|
Posted: Tue Jan 24, 2006 7:29 pm
Subject: Re: [Tutorial] Just for fun:Invisibility/Notarget (Like in R
[ IP : Logged ]
|

  
|
|
I could se something like this for invisibility in DOOM: Legions of Hell |
_________________ I'm back! I missed this community!
Youtube Channel: TreeSapThief
New Site: http://www.treesapthief.com
Twitter: @treesapthief
|
|
 |
insurrectionman
DieHard Mutant


Joined: 07 May 2005
Last Visit: 04 Feb 2019
Topics: 87
Posts: 759
Location: Wisconsin

|
Posted: Tue Jan 30, 2007 4:20 pm
Subject: [Tutorial] Just for fun:Invisibility/Notarget (Like in RTCW)
[ IP : Logged ]
|

  
|
|
How would you be able to make the accuracy of the enemy less? Like in terms for partial invisiblilty. BrotherTank's version, they never fire at you until they are face-to-face with you. |
_________________ I'm back! I missed this community!
Youtube Channel: TreeSapThief
New Site: http://www.treesapthief.com
Twitter: @treesapthief
|
|
 |
BrotherTank
Forum Administrator

Joined: 01 Mar 2003
Last Visit: 13 Sep 2017
Topics: 153
Posts: 2255
Location: Ontario

|
Posted: Tue Jan 30, 2007 8:15 pm
Subject: Re: [Tutorial] Just for fun:Invisibility/Notarget (Like in RTCW)
[ IP : Logged ]
|

 
|
|
Hmmm... Here's basically what I did:
First - I was using the Raycastor tutorial... So it will do a doom like ivisible with the drawn weapon on the screen... The basic code is like any other pickup item. It's like adding a new healthpack or anything that you can pick up. I then told it that when that item was picked up to use the Timer routine that I have posted here in the forums... it gives a 30 second countdown as to how long the user will basically be "invisible". The user really isn't invisible - but rather camoflaged (spelling sucks with the meds again ).
It's actually quite hard for me to pull out all the code changes because my code is so much more heavily modified... ie: I modified the T_Chase so that all enemies call the same routine rather than having 1 for this enemy and 1 for each of the different boss types... So my T_chase looks like this:
::: CODE :::
/* ============ T_Chase ============= */
void T_Chase (objtype *ob)
{
long move,dx,dy;
int dist,chance;
boolean dodge;
#ifdef ENEMYFLEE
int runpoints=0;
#endif
dodge = false;
switch (ob->obclass)
{
case dogobj:
dodge = true;
#ifndef SPEAR
case ghostobj:
#ifdef GHOSTSTAND
if (! (ob->flags & FL_ATTACKMODE) )
{
T_Stand (ob);
return;
}
#endif
break;
#endif
default:
{
dx = abs(ob->tilex - player->tilex);
dy = abs(ob->tiley - player->tiley);
dist = dx>dy ? dx : dy;
switch(ob->obclass)
{
#ifndef SPEAR
case schabbobj:
case giftobj:
case fatobj:
case fakeobj:
chance = tics<<(ob->obclass == fakeobj?1:3);
break;
#endif
default:
if (gamestate.victoryflag) return;
#ifdef ENEMYFLEE
if (ob->obclass != dogobj && ob->obclass != mutantobj)
runpoints = starthitpoints[gamestate.difficulty][ob->obclass - 3] / ENEMYFLEEDIV;
if (ob->hitpoints <= runpoints) ob->speed = SPDPATROL*5; // enemy run faster
#endif
if (!dist || (dist==1 && ob->distance<0x4000) )
chance = 300;
else
chance = (tics<<4)/dist;
#ifdef INVISIBLE
if (gamestate.invisible && dist>1) goto invisible; // Invisible mode
#endif
break;
}
if (CheckLine(ob)) // got a shot at player?
{
if ( US_RndT() < chance )
{
switch (ob->obclass) // go into attack frame
{
case guardobj:
NewState (ob,&s_grdshoot1); break;
case officerobj:
NewState (ob,&s_ofcshoot1); break;
case mutantobj:
NewState (ob,&s_mutshoot1); break;
case ssobj:
NewState (ob,&s_ssshoot1); break;
#ifndef SPEAR
case schabbobj:
NewState (ob,&s_schabbshoot1); break;
case giftobj:
NewState (ob,&s_schabbshoot1); break;
case fatobj:
NewState (ob,&s_fatshoot1); break;
case fakeobj:
NewState (ob,&s_fakeshoot1); break;
case bossobj:
case gretelobj:
NewState (ob,&s_bossshoot1); break;
case mechahitlerobj:
NewState (ob,&s_mechashoot1); break;
case realhitlerobj:
NewState (ob,&s_hitlershoot1); break;
#else
case angelobj:
NewState (ob,&s_angelshoot1); break;
case transobj:
NewState (ob,&s_transshoot1); break;
case uberobj:
NewState (ob,&s_ubershoot1); break;
case willobj:
NewState (ob,&s_willshoot1); break;
case deathobj:
NewState (ob,&s_deathshoot1); break;
#endif
}
return;
}
#ifndef SPEAR
if (ob->obclass != fakeobj) dodge = true;
#endif
}
break;
}
}
#ifdef INVISIBLE
invisible: // Invisible jump point
#endif
if (ob->dir == nodir)
{
if (dodge) SelectDodgeDir (ob);
else SelectChaseDir (ob);
if (ob->dir == nodir) return; // object is blocked in
}
move = ob->speed*tics;
while (move)
{
if (ob->obclass == dogobj)
{
dx = player->x - ob->x;
if (dx<0) dx = -dx;
dx -= move;
if (dx <= MINACTORDIST)
{
dy = player->y - ob->y;
if (dy<0) dy = -dy;
dy -= move;
if (dy <= MINACTORDIST)
{
NewState (ob,&s_dogjump1);
return;
}
}
#ifdef DOGVANISH
if (ob->distance < 0)
{
if (doorobjlist[-ob->distance-1].action != dr_open) return; // waiting for a door to open
ob->distance = TILEGLOBAL; // go ahead, the door is now opoen
}
#endif
}
#ifndef SPEAR
#ifdef FAKEVANISH
else if (ob->obclass == fakeobj)
{
if (ob->distance < 0)
{
if (doorobjlist[-ob->distance-1].action != dr_open) return; // waiting for a door to open
ob->distance = TILEGLOBAL; // go ahead, the door is now opoen
}
}
#endif
else if (ob->obclass != fakeobj || ob->obclass != ghostobj) // Fake Can't Open Doors
#else
else if (ob->obclass != spectreobj)
#endif
{
if (ob->distance < 0)
{
OpenDoor (-ob->distance-1);
if (doorobjlist[-ob->distance-1].action != dr_open) return; // waiting for a door to open
ob->distance = TILEGLOBAL; // go ahead, the door is now open
}
}
if (move < ob->distance) { MoveObj (ob,move); break; }
// reached goal tile, so select another one
ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2; // fix position to account
ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2; // for round off during moving
move -= ob->distance;
#ifdef ENEMYBONUS
CheckEnemyTile (ob);
#endif
switch (ob->obclass)
{
#ifndef SPEAR
case schabbobj:
case giftobj:
case fatobj:
#else
case willobj:
case angelobj:
case deathobj:
#endif
if (dist <4) SelectRunDir (ob);
else if (dodge) SelectDodgeDir (ob);
else SelectChaseDir (ob);
break;
default:
#ifdef ENEMYFLEE
if (ob->hitpoints <= runpoints)
SelectRunDir (ob); // run away from player
else
{
#endif
if (dodge) SelectDodgeDir (ob);
else SelectChaseDir (ob);
break;
#ifdef ENEMYFLEE
}
#endif
}
if (ob->dir == nodir) return; // object is blocked in
}
}
Now in there you will see the invisible jump... I've told it if the distance to the player is greater than 1 tile, skip and don't fire or shoot... And then I changed the CheckSight routine as well. Again, my code is highly modified and as such, you can't just take these routines and plug them in.
::: CODE :::
boolean CheckSight (objtype *ob)
{
long deltax,deltay;
//
// don't bother tracing a line if the area isn't connected to the player's
//
if (!areabyplayer[ob->areanumber])
return false;
//
// if the player is real close, sight is automatic
//
deltax = player->x - ob->x;
deltay = player->y - ob->y;
if (deltax > -MINSIGHT && deltax < MINSIGHT && deltay > -MINSIGHT && deltay < MINSIGHT)
return true;
#ifdef INVISIBLE
if (gamestate.invisible && !madenoise) return false; // Invisible Mode
#endif
//
// see if they are looking in the right direction
//
switch (ob->dir)
{
case north:
if (deltay > 0)
return false;
break;
case east:
if (deltax < 0)
return false;
break;
case south:
if (deltay < 0)
return false;
break;
case west:
if (deltax > 0)
return false;
break;
}
//
// trace a line to check for blocking tiles (corners)
//
return CheckLine (ob);
}
But, that is the major part of the code and should give you an idea of what I did. It's not much really and actually quite simple. The whole thing is have it check to make sure that you haven't taken a shot - if you have and they can see where you were when you took the shot - then realistically they should be able to shoot in your direction. The other main change is somewhere in the WL_STATE.C file you need to modify the CheckSight routine so that if the distance to the player is less than say 1 map tile, they don't recognise you as something they need to attack. Should the player get within that 1 map tile space with an enemy, the enemy can recognise you and will attack.
Hope that gives you an idea of how I did mine...
Greg
BrotherTank |
|
|
 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum
|
|
You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group
|