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   Fox 

  • Fraka kaka kaka kaka-kow!

#204

View PostXThX2, on Aug 14 2009, 10:32 AM, said:

I need help at making a working railgun. My idea was this;

Make a fake bullet type projectile, have it spawn a trail. The trail goes through actors even if the projectile hit something, which is a good thing. I thought about how to damage the actors and what came to my mind was to make trail actors create hitradiuses with small range at EVENT_EGS. But this has one downside, which is that it damages the player. Well, the thing is, it's htpicnum seems to be 1670 (RADIUSPICNUM) but when I check it with ifvare hitpicnum 1670 setactor[THISACTOR].htextra -1 it still damages the player. I have an invulnerability item which causes the htextra of the player to be -1 when any damage is taken, however it strangely fails against this too. I guess this is a priority issue, but I can't seem to solve this one.
You should use projectile flag 65536 so that you can return "ifhitweapon MYPROJECTILE" from the hitradius too.

I can came to my mindo how to do the projectile you want. I would use a normal hitscan projectile and use other methods for creating the Railgun...
0

User is offline   m210® 

#205

If I have distances to many objects how to find the minimum distance to object?
0

User is offline   XThX2 

#206

I can't think of anything but a translation of bubblesort to CON. Well, it basically involves searching through all sprites, comparing two of their distances, if it's lower than the other, adds it to the upper queue and compares it to the next in line. I think you can use the thing I explained on top of this page, with some limitations like defining the picnum of your object so it won't slow things down. Yet, you are better off asking it to someone who knows doing that. :blink:
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#207

Heh, I guess it would be necessary a more complex command, like one to check several sprites. I meant, something like whilevarn and that stores the current (while) sprite ID.

This post has been edited by Ilovefoxes: 14 August 2009 - 07:00 PM

0

User is online   Danukem 

  • Duke Plus Developer

#208

He didn't express clearly what the problem is, but I doubt it's very complicated.
0

User is offline   Chip 

#209

View PostDeeperThought, on Aug 14 2009, 04:32 PM, said:

Are you sure it isn't a bug in your code? I've never had a problem like that.


Yeah it was a bug in my code - I solved this around 30 minutes after making that post but by then I had no access to that computer for the rest of the day so I couldn't edit out my post.
The problem was that my actor dying was an action which does not cancel ai strings (ai AIENEMYWALKING etc...) and that ai string gets read before the dying action thus throwing my actor back into its seek state and not its dying one.



The reason I used an action and not ai is because I did plan on having no ai strings at all because I was going to have varying speeds with my actor based on gamevars and as such the ai strings would have been just a duplicate of the actions defined since they're just an action with a movement.
However I have recnetly found out why we have ai strings........because controlling movement is just so damn crappy!

placing a move command within a state instantly stops the actor from counting so all ifcount commands fail to function and replacing the move command to setactor[THISACTOR].xvel 40 has absolutly no effect what so ever so I guess you can't set an actor's speed using that which ruins my whole plan about having gamevar based movements.
Now, I added my move command at the top of my actors state so perhaps I may get away with it by throwing them in at the very bottom of the state after all ifcount commands but I still wont have my gamevar based movment.

So is it at all possible to have movement adjusted by gamevars or am I just going to have to define like a million move commands and then have a million "ifvare SPEED 32 move 32 geth" thrown in as well?

This post has been edited by Chip: 15 August 2009 - 07:19 AM

0

User is offline   XThX2 

#210

ifmove YOURMOVE nullop else move YOURMOVE <commands>


That will solve your problem about continuous move calls. Try to use addlogvar with some actor structure members that are relevant to what you want and see if they fit the speed of the move.
0

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 online   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 online   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 online   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 online   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

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