PDA

View Full Version : I need help about code to make monsters die in the same sector as the sprite


Zaxtor
04-15-2008, 08:09 PM
I posted it on another forums but didn't understand well or i wasn't specific enough.

I'm making a cannister full of enhanced Ebola virus.

Thing is, when player shoots it or anythings that breaks it. it set a var to activate the invisible effectors in the lab that will kill all monsters in the lab accept monsters outside the lab.
Lab has more than 1 sector.
So what i wanna do is, all monsters within any sector that has the sprite named CONTAMINATING_MONSTERS in it, will die fast or instantly.
I don't wanna make them jib/rupture/gut to piece u know.. I wanna make them drop dead, same as you shoot em with a pistol etc.


Heres the sprite. Where i put the '****' stars is the code to kill,
So does anyone know whats the code to kill ANY monsters within the same sector as the contaminating_monsters effector sprites?
Any monsters outside the lab should not be harmed.
Only monsters in same sectors as the sprite.

useractor notenemy CONTAMINATING_MONSTERS
cstator 32768

ifvare EBOLA_CONTAMINATION 1
{
ifspritepal 3
{
*****
}
ifspritepal 4 { spawn BLOCKINGWALL killit }
}

enda

Dopefish7590
04-15-2008, 08:44 PM
Check distance and subtract health...
Check the sector ID and subtract health...

Zaxtor
04-15-2008, 10:06 PM
I use build so how we check sector ID "its number" with build?


And how i substract health, explain.

The Commander
04-15-2008, 10:09 PM
You really need to read this I think...

http://wiki.eduke32.com/wiki/Main_Page

Dopefish7590
04-15-2008, 10:49 PM
And how i substract health, explain.

http://wiki.eduke32.com/wiki/Addstrength

addstrength -5

This decreases health of the current actor by 5, so if you do this once per click, it will kill them quite quickly.

As for the distances:
http://wiki.eduke32.com/wiki/Ldist

Zaxtor
04-15-2008, 11:20 PM
Are you sure it wont cause monsters to jib ?


I know the code for (player version) to drain his hp to death.

useractor notenemy CONTAMINATING_PLAYER

cstator 32768
ifvare CLEAROTHER_CONPLYR 1 { killit }
ifvare EBOLA_CONTAMINATION 1
{
getactor[THISACTOR].sectnum temp
getplayer[THISACTOR].cursectnum temp2
ifvarvare temp temp2 { spawn PLAYERDYINGOFEBOLA setvar CLEAROTHER_CONPLYR 1 killit }
}

enda



Once player steps on the CONTAMINATING_PLAYER he gets infected, spawns a timer that slowly drain the player's hp.


But thing i wanna know is there a

getactor[THISACTOR].sectnum temp
getplayer[THISACTOR].cursectnum temp2
ifvarvare temp temp2 { }

version for monsters ?

DeeperThought
04-15-2008, 11:43 PM
Oh, for crying out loud, I am tired of hearing about this, and I already posted a suggestion in the other forum but I guess you didn't understand it. Here is the code you wanted (typing it is easier than explaining it). Just spawn this thing and everything in the sector will take a lot of damage. It will probably break objects, too, though, but you can add checks for statnum or picnum or something to prevent that.



useractor notenemy EBOLACLOUD 0

getactor[THISACTOR].sectnum temp

headspritesect temp2 temp
whilevarn temp2 -1
{
setactor[temp2].htextra 5
setactor[temp2].htpicnum SHOTSPARK1
nextspritesect temp2 temp2
}

ifcount 78 killit

enda


By the way, having actors use addstrength -5 is not reliable, because they won't die unless they check ifdead, and they don't usually check that unless hit by a weapon.

Dopefish7590
04-16-2008, 12:08 AM
By the way, having actors use addstrength -5 is not reliable, because they won't die unless they check ifdead, and they don't usually check that unless hit by a weapon.

Heh, that would explain a LOT on my end, Thanks! :D

Zaxtor
04-16-2008, 12:24 AM
My Eduke32 version is 1.4.0 beta 2

Doesn't work

GAME.CON: In actor `EBOLACLOUD':
GAME.CON:29388: error: expected a keyword but found `headspritesect'.
GAME.CON:29388: error: expected a keyword but found `temp2'.
GAME.CON:29388: error: expected a keyword but found `temp'.
GAME.CON:29393: error: expected a keyword but found `nextspritesect'.
GAME.CON:29393: error: expected a keyword but found `temp2'.
GAME.CON:29393: error: expected a keyword but found `temp2'.

Codes are placed exact position as u given them,

Is it my Eduke32?

Dopefish7590
04-16-2008, 12:32 AM
Edit: Nope, I'm wrong.

DeeperThought
04-16-2008, 12:40 AM
Wow, I guess you haven't downloaded a new version of EDuke32 in over a year.

http://eduke32.com/


Support for 1.4.0 beta 2 has been discontinued. Download one of the development snapshots (http://wiki.eduke32.com/stuff/) instead.
The downloads page has been updated to reflect the discontinuation of support for 1.4.0 beta 2.

Zaxtor
04-16-2008, 12:41 AM
Error is attacking game.con only.

Def.con and name.H are fine.

I put the sprite name in def/nameH

Zaxtor
04-16-2008, 12:43 AM
Wow, I guess you haven't downloaded a new version of EDuke32 in over a year.

http://eduke32.com/



Not exacly a year,
Last time i downloaded was its Preceder i think.

Dopefish7590
04-16-2008, 12:45 AM
http://wiki.eduke32.com/stuff

The latest files are always here... Update your stuff... Its ancient.

Zaxtor
04-16-2008, 01:05 AM
I just installed the "newer" Eduke.

only problem is.

The thing kill the player but it doesn't kill any monster.
Just overkill player (drain his hp faster)

DeeperThought
04-16-2008, 01:25 AM
If the monsters are in its sector, it is setting their htextra (damage) and htpicnum (ifwasweapon) which is known to work (I have used this kind of code many times before). You might try adding the line: setactor[temp2].htowner THISACTOR , but I don't see why that would be necessary. Anyway, I have a working sector effector lotag in Duke Plus that uses the same principle.

Zaxtor
04-16-2008, 01:38 AM
Do i need to alter the monster's code?

cause i added the code. Nothing happen.
Just kill the player as soon he walks in without killing monsters inside sectors.


useractor notenemy EBOLACLOUD 0

getactor[THISACTOR].sectnum temp

headspritesect temp2 temp
whilevarn temp2 -1
{
setactor[temp2].htextra 5
setactor[temp2].htpicnum SHOTSPARK1
setactor[temp2].htowner THISACTOR
nextspritesect temp2 temp2
}

ifcount 78 killit

Dopefish7590
04-16-2008, 01:40 AM
Where are you putting the code?

DeeperThought
04-16-2008, 01:44 AM
You don't have to change the monster code. I just tested it and it works perfectly. You are doing something wrong, like maybe the monsters aren't really in the same sector or you left out the enda at the end or something. Good luck with that.

Dopefish7590
04-16-2008, 01:46 AM
I was thinking maybe he put it in aplayer... Only thing I can think of right now...

Zaxtor
04-16-2008, 01:47 AM
Dunno so i just put it below the shoot spark.

I even tried to put above, and nothing happens, no monster dies.

even above the htextra 5.

no monster dies

Zaxtor
04-16-2008, 01:48 AM
You don't have to change the monster code. I just tested it and it works perfectly. You are doing something wrong, like maybe the monsters aren't really in the same sector or you left out the enda at the end or something. Good luck with that.



Monsters are in same sector as the invisible effector that triggers when you destroy the cannister (set a var)

once var is set.

Those EBOLA sprite respond, but only kill player
not monsters

Dopefish7590
04-16-2008, 01:49 AM
We mean all the code DT gave you in the thread... Where did you put it? Make sure it is not in an actor's code... aplayer included.

Zaxtor
04-16-2008, 01:55 AM
When you do a code error it does game.con error.

Mine didn't do any error.
The thing work but doesn't kill monsters in sector, only kill player.

Dopefish7590
04-16-2008, 01:57 AM
Huh? :confused:

DeeperThought
04-16-2008, 02:02 AM
The reason I posted the code was to put an end to this, not to drag it on for another three pages. Lesson learned. Again.

Zaxtor
04-16-2008, 02:06 AM
Maybe a solution.

Like what if i modify the monster and i make somewhere inside monster

Ifcansee (spritename) { cactor LIZTROOPDSPRITE }

when that ebola things spawn a few invisible sprite

If the code exist


like example ifcansee EBOLA { cactor LIZTROOPDSPRITE }

Dopefish7590
04-16-2008, 02:09 AM
*Sigh*

The Commander
04-16-2008, 02:37 AM
Maybe you should go back to basic's,

http://wiki.eduke32.com/wiki/Confaq42

Zaxtor
04-16-2008, 09:32 AM
Some how i fix't it.
When it didn't work i kept messing around, i dunno what was error/problem but i fixed it.

I did very smalls sectors around certain sprites near monsters to prevent the infection from breaking objects.