
EDuke32 Scripting "CON coding help"
#226 Posted 21 August 2009 - 08:56 PM
http://wiki.eduke32.com/wiki/Gamevar
And if someone can give a pretty more detailed explaination of what everything there means... =/
#227 Posted 21 August 2009 - 09:15 PM
Ilovefoxes, on Aug 21 2009, 09:56 PM, said:
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).
#228 Posted 22 August 2009 - 08:09 AM
DeeperThought, on Aug 21 2009, 11:51 PM, said:
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.
Mblackwell, on Aug 22 2009, 12:41 AM, said:
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.
#230 Posted 24 August 2009 - 03:12 AM
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
#231 Posted 24 August 2009 - 08:53 AM
#232 Posted 25 August 2009 - 01:49 AM
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
#233 Posted 25 August 2009 - 06:09 AM
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.
#234 Posted 25 August 2009 - 06:45 AM
I have a tiny question. This code gives this error on log;
Quote
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.)
#235 Posted 25 August 2009 - 07:28 AM
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
#236 Posted 25 August 2009 - 07:52 AM
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
#237 Posted 25 August 2009 - 08:11 AM
Chip, on Aug 25 2009, 04:49 AM, said:
My actor is also an "useractor notenemy" so it may be another limitation to that.
Care to post the relevant code?
#238 Posted 25 August 2009 - 08:25 AM
I'm surprised there isn't much by way of tutorials regarding putting in new enemies.
Thanks again.
#239 Posted 25 August 2009 - 09:17 AM
RockstarForADay, on Aug 25 2009, 09:25 AM, said:
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.
#240 Posted 25 August 2009 - 10:43 AM
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.
#241 Posted 26 August 2009 - 04:08 AM
whilevarn spritenum2 16384 { addvar spritenum2 1 ifvarvarn spritenum2 THISACTOR { getactor[spritenum2].picnum picnum getactor[spritenum2].statnum statnum getactor[spritenum2].sectnum mysector ifvarn statnum 1024 ifvarn mysector -1 { switch picnum case ENLISTEE case LIZTROOP case PIGCOP case LIZMAN case ZOMBIEPLS case OCTABRAIN case COMMANDER case DEVIL case SHADE case CHAINGUNNER case EXTERMINATOR case TANK case BLOODSEEKER case NEWBEAST case NNEWWBEAST case CDEMON case PAINE case LSOUL case APLAYER canseespr THISACTOR spritenum2 returnvar7 ifvare returnvar7 1 { setactorvar[spritenum2].para 1 setactorvar[spritenum2].para_counter 0 randvar randomvar 24 mulvar randomvar 48 setactor[spritenum2].htextra randomvar } break endswitch } } }
I've played around with the code and I'm still having the same error, with these this time ;
Quote
Line 6794, getactor: tried to get statnum on invalid target sprite (16384) from spr 0 pic 1405 gv spritenum2
Line 6795, getactor: tried to get sectnum on invalid target sprite (16384) from spr 0 pic 1405 gv spritenum2
It gets stuck on APLAYER sprite for some reason. I don't know why. (1405 = Aplayer) What am I doing wrong here ? (Spritenum2 is -1 2)
This post has been edited by XThX2: 26 August 2009 - 04:11 AM
#242 Posted 26 August 2009 - 06:18 AM
^What that means is that sprite 0, which is a player sprite, is trying to get information from an invalid sprite (number 16384).
Put the addvar spritenum2 1 at the END of the while loop instead of the beginning.
#243 Posted 26 August 2009 - 07:27 AM
#244 Posted 26 August 2009 - 07:55 AM
Also, it is working perfectly now, thanks.

This post has been edited by XThX2: 26 August 2009 - 07:55 AM
#245 Posted 26 August 2009 - 08:43 AM
Mblackwell, on Aug 25 2009, 05:11 PM, said:
I bring you pictures and everything!
Observe picture 1:
Everthing works fine, of course I'm facing the actor through the whole situation.
(If you click the image to gointo Imageshack, then once its loaded, click the image again to get it to a single window - then click once more to full size the image but this last part may vary depending on your web browser)

In this next test, I turn away when the climbing animation starts and then when I return its in a horrible mess!

Clearly its gone wrong all because the player turned away. I'm certain this has to be down to the whole models (well sprites and what ever they have set to them) dissapearing when out of sight and thus screwing with the animations either by pausing them or resetting them, either way my movement code carries on and forces my actor into the possitions its meant to be at but of course the animation lost sync with it and it looks silly.
Here's the climbing code:
state pokeclimbstate ifmove MPOKEHANG1 nullop else move MPOKEHANG1 geth getv ifvare APPLYONCE 0 { getsector[TEMP5].floorz z2 subvar z2 90 setvar APPLYONCE 1 } getactor[THISACTOR].z z ifvarvarl z z2 { ifcount 120 setactor[THISACTOR].xvel 32 } else { subvar z 140 setactor[THISACTOR].z z } ifactioncount 45 { state resetvarsstate setvar TIMEOUT 3 setvar TEMP 2 action APOKEWALK } ends
Here's the defined animation:
anim { frame0 "FRAME396" frame1 "FRAME480" fps 19 flags 1 } frame { name "FRAME396" tile 5747 } // Climb up and over!
The actor is a "useractor notenemy", it does not have any share gamevars - all the ones it uses are per actor. There isn't a single player related command in any of its states.
This post has been edited by Chip: 26 August 2009 - 08:46 AM
#246 Posted 26 August 2009 - 09:23 AM
Oh and I reformatted your code so it's easier to read.
state pokeclimbstate ifmove MPOKEHANG1 nullop else move MPOKEHANG1 geth getv ifvare APPLYONCE 0 { getsector[TEMP5].floorz z2 subvar z2 90 setvar APPLYONCE 1 } getactor[THISACTOR].z z ifvarvarl z z2 { ifcount 120 setactor[THISACTOR].xvel 32 } else { subvar z 140 setactor[THISACTOR].z z } ifactioncount 45 { state resetvarsstate setvar TIMEOUT 3 setvar TEMP 2 action APOKEWALK } ends
#247 Posted 26 August 2009 - 10:10 AM
#248 Posted 26 August 2009 - 12:02 PM
Quote
All actions and vars are being set from another state followed by an instant "break" (in this case it was set in its hang state which it does before climbing) TEMP5 holds the sector's ID where it plans on climbing to which was set in its jump state. Its only reset in its standard paving stuff. Resetvarsstate is a state used to set my important gamevars to 0 (In this case my jumpable vars since the otheres were untouced)
That ifcount however isn't being reset - I forgot about that so I may throw into the resetvarsstate but it shouldn't cause any problems since it will get automaticaly reset in its seekstate upon the first invalid spotted sector. (It has an ifcount 2 { resetcount ......stuff... } when it doesn't like the look of the upcoming sector) My actor doesn't do anything else with that count so its harmless at the moment.
Quote
That's how I used to always write out my code but I actually started finding it easier to read in the other way, Its especially quicker to skim past.
Quote
I guess that's a little more evidence that models and animations needs a little looking into. For me this bug of re-animating dead monsters always occurs when I reload a saved gamed.
This post has been edited by Chip: 26 August 2009 - 12:07 PM
#249 Posted 26 August 2009 - 01:02 PM
http://wiki.eduke32.com/wiki/Mdflags
#250 Posted 27 August 2009 - 04:24 AM
DeeperThought, on Aug 26 2009, 10:02 PM, said:
http://wiki.eduke32.com/wiki/Mdflags
Yeah I tried that but it unfortunately didn't work, assuming I used it right. (which I may have not now that I think about it). I will however also try changing my actor from notenemy to enemy to see if that makes any change since enemies do alot more stuff then notenemies (I've only recently found out the enemy tagged actors have a built in paving code to help it avoid walls - not a good one but there is indeed one in there. I guess that's why it jerks in movement.)
This post has been edited by Chip: 27 August 2009 - 04:27 AM
#251 Posted 27 August 2009 - 04:38 AM
#252 Posted 27 August 2009 - 04:55 AM
If you're still having problems then you could aways try cansee which indeed can cross sectors (else it would be pointless for the command to need sector IDs imputted for botth points) but with that you'll need to obtain more details before using the command.
Side note, cansee is fantastic for paving code!
This post has been edited by Chip: 27 August 2009 - 04:57 AM
#253 Posted 27 August 2009 - 06:49 AM
#254 Posted 27 August 2009 - 07:35 AM
XThX2, on Aug 27 2009, 07:49 AM, said:
I'm guessing that when you used cansee, you set the z coordinates appropriately. canseespr works fine too, but keep in mind that sprites see from the bottoms of their feet, so it's a good idea to lift them up before using it.