Duke4.net Forums: EDuke32 Scripting - Duke4.net Forums

Jump to content

  • 124 Pages +
  • « First
  • 6
  • 7
  • 8
  • 9
  • 10
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Chip 

#211

View PostXThX2, on Aug 15 2009, 05:00 PM, said:

ifmove YOURMOVE nullop else move YOURMOVE <commands>


That will solve your problem about continuous move calls.


OK, it all works. As for setactor.xvel, it appears that it only works if the actor was already moving. I had it apply a value to xvel when it was stationay and although it had a possitive xvel (and addlogvar confirmed this) it still wouldn't move an inch no matter how many times it was applied - it had to be jump started with a move command first.

This post has been edited by Chip: 16 August 2009 - 04:24 AM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#212

I guess once there is no speed value, it has no geth getv flags.



Hmm, I have checked the command getticks that give you how much miliseconds have passed since the game started. It was supposed so that 1 second = 26 tics. Although on a difference of 1000 miliseconds there have passed 30 or 31 (varies) tics. I not surprised that the value is not precise every second, but it's more than 26 tics per second... does the game run faster due to my computer?

This post has been edited by Ilovefoxes: 16 August 2009 - 06:58 PM

0

User is offline   Japes 

#213

Had a pretty aggravating morning trying to hammer out a teleport effect. I'd coded this about four or five months ago, and it's essentially a dumbed down version of DT's sleeper code. Now the annoying thing is that this code was pretty much a prototype that I'd made and stashed off in my CON file till I could put it to good use, and it worked after I'd made it. Now five months down the line, I'm finally ready to use it and for whatever reason it won't work anymore. I've made tons of alterations to my con files since I made this, but I'm almost certain I didn't delete anything that was integral to this effect working, and I've spent all morning trying to figure out what's wrong with it, to no avail.


  
useractor notenemy TSTART 0 cstat 32768 ifpdistl 2000 ifhitspace {  
getactor[spriteid].picnum picnum
getactor[spriteid].hitag hitag
ifvare picnum TEND { ifvare hitag 1 { 
getactor[spriteid].x x 
getactor[spriteid].y y  
getactor[spriteid].z z 
setplayer[THISACTOR].posx x 
setplayer[THISACTOR].posy y 
setactor[THISACTOR].z z 
subvar z 8192
setplayer[THISACTOR].posz z
getactor[spriteid].sectnum cursect
changespritesect THISACTOR cursect
setplayer[THISACTOR].cursectnum cursect
starttrack 3
}
}
}
enda


the actor "TSTART" is what teleports you when you hit space. "TEND" is where you get teleported to. Can anybody take a look at this and tell me what I'm missing, here?
0

User is offline   Danukem 

  • Duke Plus Developer

#214

No offense, but it's obvious you have no clue.

Your code only works if the hitag of the teleporter sprite is 1. I can pretty much guarantee you that the hitag is 0. Even if you set hitag on the sprite, hitag would be 0 in game unless the sprite is a SE or one of the other special effect sprites. I guess you were trying to copy some code you saw where the hitag variable was being used, but it doesn't make any sense here to do that. Just make the thing work without hitag.

Also, you have "spriteid" where you should have "THISACTOR", which means that when the teleporter works it will take the player to wherever the sprite of number spriteid is, which could be anywhere or nowhere, since you didn't set the spriteid variable to anything in the actor code.

Finally, you are setting to actor to its own sector before changing the player sector, which is harmless but dumb.
0

User is offline   Japes 

#215

View PostDeeperThought, on Aug 17 2009, 11:25 AM, said:

No offense, but it's obvious you have no clue.

Your code only works if the hitag of the teleporter sprite is 1. I can pretty much guarantee you that the hitag is 0. Even if you set hitag on the sprite, hitag would be 0 in game unless the sprite is a SE or one of the other special effect sprites. I guess you were trying to copy some code you saw where the hitag variable was being used, but it doesn't make any sense here to do that. Just make the thing work without hitag.

Also, you have "spriteid" where you should have "THISACTOR", which means that when the teleporter works it will take the player to wherever the sprite of number spriteid is, which could be anywhere or nowhere, since you didn't set the spriteid variable to anything in the actor code.

Finally, you are setting to actor to its own sector before changing the player sector, which is harmless but dumb.


I thought I was using the hitag for where I was teleporting to not from, and if I did at least get that right, then that's exactly how I wanted it since I'm trying to use the same actor for a destination point, but distinguish between them by using hitags. I set sprite ID to the tile number of the TEND actor, I just didn't include it in the block of code....
0

User is offline   XThX2 

#216

Is there a way to detect if the hitsprite returned by hitscan command is an enemy ?

A solution for real railgun I've found : Make trails do hitscans and if they found the enemy, add an extra value to their htextra. (Controlled by a gamevar to make this happen only once per shot)
0

User is offline   lycanox 

#217

The way I would code it. Is by making the enemy unblockable and unhitable for the moment that the projectile actually hits the enemy so that it goes through the enemy. And have it spawn a trail do the actual damage when the cstats are restored to default.

Offcoure I have never tested it.
0

User is offline   Danukem 

  • Duke Plus Developer

#218

View PostXThX2, on Aug 19 2009, 03:26 AM, said:

Is there a way to detect if the hitsprite returned by hitscan command is an enemy ?

A solution for real railgun I've found : Make trails do hitscans and if they found the enemy, add an extra value to their htextra. (Controlled by a gamevar to make this happen only once per shot)


That's what I ended up doing for the railgun that I coded for DNWMD a few years back. I'm not sure I'd do it that way now, but obviously it worked so it can't be that bad. As for the hitsprite...the hitsprite gives you all the information you could possibly need. You can check the picnum, statnum, and everything else, so why would it be difficult to tell whether it's an enemy?
0

User is offline   XThX2 

#219

Yeah... I forgot it while I was posting though :/ I just coded it and it works fine. I wonder, what would be the method you would use to do it now?

Also, why is the statnum jumping from 13 to 1024 on Edukewiki ? Are there too many to list ?
0

User is offline   TerminX 

  • el fundador

  #220

Internally, the engine supports 1024 different status lists, 0-1023. Duke3D uses 13 of them whereas I think SW used hundreds. A value of 1024 (MAXSTATUS) means the sprite has been deleted.
0

User is offline   lycanox 

#221

Does anyone have any ideas on how to move a actor a bit higher.

I tried
ifvare ACTORZ 0 { getactor[THISACTOR].z ACTORZ }
addvar ACTORZ 1000
setactor[THISACTOR].z ACTORZ


And that worked for a while. But for some reason it stopped working when I moved to code to a different con file.
0

User is offline   XThX2 

#222

You need to substract from z, not add. Open mapster, try to raise the height of a sprite, you'll know what I mean.
0

User is offline   lycanox 

#223

Thanks, that did the trick.

Leaves me wondering why it did work perfectly before do. With such a mayor flaw in it.
0

User is offline   Danukem 

  • Duke Plus Developer

#224

View Postlycanox, on Aug 21 2009, 01:56 PM, said:

Thanks, that did the trick.

Leaves me wondering why it did work perfectly before do. With such a mayor flaw in it.



Two major flaws. You have { } around a single command (which is pointless), and it looks like they are supposed to go around a larger block of code.

This post has been edited by DeeperThought: 21 August 2009 - 01:53 PM

0

User is offline   Mblackwell 

  • Evil Overlord

#225

I wonder why you wouldn't just define a move command and use that: eg

move MYMOVEUP 0 -100

useractor notenemy MYACTOR 
	move MYMOVEUP getv
enda


This post has been edited by Mblackwell: 21 August 2009 - 02:41 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#226

Which gamevar flag should I use if I want it to reset when loading a map.

http://wiki.eduke32.com/wiki/Gamevar
And if someone can give a pretty more detailed explaination of what everything there means... =/
0

User is offline   Danukem 

  • Duke Plus Developer

#227

View PostIlovefoxes, on Aug 21 2009, 09:56 PM, said:

Which gamevar flag should I use if I want it to reset when loading a map.

http://wiki.eduke32.com/wiki/Gamevar
And if someone can give a pretty more detailed explaination of what everything there means... =/


There is no flag for that, just reset it manually at the appropriate time (in EVENT_ENTERLEVEL or whatever).
0

User is offline   lycanox 

#228

View PostDeeperThought, on Aug 21 2009, 11:51 PM, said:

Two major flaws. You have { } around a single command (which is pointless), and it looks like they are supposed to go around a larger block of code.

Actually I have a lot more code it must execute at that point in the game. But I deleted it temporally to see if they were causing the problem.


View PostMblackwell, on Aug 22 2009, 12:41 AM, said:

I wonder why you wouldn't just define a move command and use that: eg

move MYMOVEUP 0 -100

useractor notenemy MYACTOR 
	move MYMOVEUP getv
enda

That would mean that the actor has a large chance of colliding with other actors spawned on that location.
With using the setactor[THISACTOR].z command I allowed it to safely skip some other actors to prevent issues later on in the code.
0

User is offline   Mblackwell 

  • Evil Overlord

#229

Whatever floats your boat.
0

User is offline   Chip 

#230

I've just encountered something horrible - it appears model animations are not saved when the player is not looking at them. I know the model dissapears but I thought it would have kept a count on what animated frame it would be on if it were rendered.

I first noticed this when I saw my actor perform its random idle pose but it cut out half way through and went to its walking actions. At first I had no idea why it did that and since it only ends its animation after an actioncount of 26 and it worked fine all the other times.
Problem now is that I have a rarther longish climb animation which is heavilly based on counts synced to its actions - turn away for 2 or so seconds and then when you return my actor will be in a stupid pose and it could look as bad as seeing it half submerged in the sector's floor still trying to climb a wall.


My question is:
How do I force the model itself to be rendered when not in view assuming that its animations do indeed continue to play?

This post has been edited by Chip: 24 August 2009 - 03:17 AM

0

User is offline   Mblackwell 

  • Evil Overlord

#231

I can't say I've had that problem... are you sure you don't have an ifcansee/ifp pfacing condition floating around somewhere?
0

User is offline   Chip 

#232

My actor does not have any player relating commands so no ifcansee or pfacing stuff.
My actor is also an "useractor notenemy" so it may be another limitation to that.

This post has been edited by Chip: 25 August 2009 - 01:50 AM

0

#233

So, I'm trying to code a new enemy from scratch. Havn't touched con files for a hell of a long time and I must be doing something stupid somewhere. My enemy does everything I want it to, except die properly. Sometimes the code works perfectly, sometimes they they carry on walking and shooting. And when it spawns the dead sprite, sometimes it spawns a number of them instead of just one.

useractor enemy CHAV CHAV_NORMAL_STRENGTH

//Basic Setup
sizeat 40 20
fall
ifonwater cstat 128 else cstat 257
ifcansee
ifai NO
{
ai CHAVWALKS
ifrnd 128
sound PRED_RECOG
}


//Shooting
ifrnd 8
ifcanseetarget
ifpdistl 9000
{
ai CHAVSHOOTS 
shoot CHAVSHOT
sound PISTOL_FIRE
}

//reset code

ifcount 48
ifrnd 16
ifai CHAVSHOOTS
ai CHAVWALKS

//attacked code
ifhitweapon
{
spawn BLOOD

ifdead
{
addkills 1
ai CHAVDEAD
sound PRED_DYING
ai CHAVDEAD
spawn BLOODPOOL
}

ifrnd 8
sound PRED_PAIN
}

//death
ifai CHAVDEAD
{
ifactioncount 6
killit
spawn CHAVCORPSE
}
enda


Help a veteran n00b out, what am I doing wrong here.
0

User is offline   XThX2 

#234

You have two AI CHAVDEAD's in the ifdead condition. Remove one of them. Also, add a break after the death so it doesn't try to do things after it's dead.

I have a tiny question. This code gives this error on log;

Quote

Line 6791, getactor: tried to get picnum on invalid target sprite (16384) from spr 4 pic 1405 gv spritenum2


				whilevarn spritenum2 16384
				{
					addvar spritenum2 1
					
					getactor[spritenum2].picnum picnum
					switch picnum
					case CHAINGUNNER
						canseespr THISACTOR spritenum2 returnvar7
						
						ifvare returnvar7 1
						{
							setactorvar[spritenum2].para 1
							setvar randomvar 1
							randvar randomvar 24
							mulvar randomvar 48
							setactor[spritenum2].htextra randomvar
						}
					break
					endswitch
				}


The chaingunner's picnum is 1551 and onwards. (Frames) I think it's showing the APLAYER as the result, though I do not know why. How can I fix that error ? (Note : This is in APLAYER Code, checked by a ifvarg KICKBACKPIC 85; and spritenum2 is set to 0 when kickbackpic is 84.)
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#235

You are trying to use getactor on every actor in the game? ID of sprites sn not as sectors, in sectors the IDs are always 1,2,3... but in the case of an actor (if I am not wrong) it can very well being 1,5,301... so if you add a counter to check every sprite, it will end up in non-existing sprites.

You should use statnum to check if the sprite exist. Statnum of 1024 belongs to non-existing sprites.

This post has been edited by Ilovefoxes: 25 August 2009 - 10:00 AM

0

User is offline   Danukem 

  • Duke Plus Developer

#236

I'm going to ignore the other deficiencies and just help with the specific problem you posted about. Once the actor dies, it needs to stop executing its other behavior. You were allowing the actor to switch to its other ai after dying. This can be fixed by moving the death block up near the top and adding a break, as I did below. If you examine the code in the original enemies, you will see that they do the same thing (although not exactly the same way).

useractor enemy CHAV CHAV_NORMAL_STRENGTH

//Basic Setup
sizeat 40 20
fall
ifonwater cstat 128 else cstat 257
ifcansee
ifai NO
{
ai CHAVWALKS
ifrnd 128
sound PRED_RECOG
}

//death
ifai CHAVDEAD
{
  ifactioncount 6
  {
	killit
	spawn CHAVCORPSE
  }
  break
}


//Shooting
ifrnd 8
ifcanseetarget
ifpdistl 9000
{
ai CHAVSHOOTS 
shoot CHAVSHOT
sound PISTOL_FIRE
}

//reset code

ifcount 48
ifrnd 16
ifai CHAVSHOOTS
ai CHAVWALKS

//attacked code
ifhitweapon
{
spawn BLOOD

ifdead
{
addkills 1
ai CHAVDEAD
sound PRED_DYING
ai CHAVDEAD
spawn BLOODPOOL
}

ifrnd 8
sound PRED_PAIN
}
enda

0

User is offline   Mblackwell 

  • Evil Overlord

#237

View PostChip, on Aug 25 2009, 04:49 AM, said:

My actor does not have any player relating commands so no ifcansee or pfacing stuff.
My actor is also an "useractor notenemy" so it may be another limitation to that.


Care to post the relevant code?
0

#238

Thanks XThX2 and DT! I totally forgot about a break. After moving the code up the dead spawn disapeared, so I moved the spawn back to where I originally had it and it works perfectly now.

I'm surprised there isn't much by way of tutorials regarding putting in new enemies.

Thanks again.
0

User is offline   Danukem 

  • Duke Plus Developer

#239

View PostRockstarForADay, on Aug 25 2009, 09:25 AM, said:

I'm surprised there isn't much by way of tutorials regarding putting in new enemies.


There's some useful tutorials here: http://concode.planetduke.gamespy.com/

I have thought about writing my own and adding it to the wiki, but I'm afraid it would spin out of control and take too much of my time.
0

#240

I did see Reaper's site on my travels, but missed a few of the pages, thanks.

I think that would be an awesome edition to the wiki. Would take a while to write up though like you said. Still, the wiki could use a few more tutorials on there.
0

Share this topic:


  • 124 Pages +
  • « First
  • 6
  • 7
  • 8
  • 9
  • 10
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options