
EDuke32 Scripting "CON coding help"
#201 Posted 14 August 2009 - 05:32 AM
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.
This post has been edited by XThX2: 14 August 2009 - 05:32 AM
#202 Posted 14 August 2009 - 06:47 AM
But more than likely there will be efficent and better ways to do this then what I suggested so you so probably best wait for someone else to reply.
Anyway a question of my own, Its simple really - my "useractor notenemy" does not seem to want to do certain things after death, he wont play sound files and he wont change his cstat to 0 (so it remains cstat 257)
My useractor enemy which I coppied this code from worked fine so is this a limitation to the useractor notenemy sprites?
This post has been edited by Chip: 14 August 2009 - 06:50 AM
#203 Posted 14 August 2009 - 07:32 AM
Chip, on Aug 14 2009, 07:47 AM, said:
My useractor enemy which I coppied this code from worked fine so is this a limitation to the useractor notenemy sprites?
Are you sure it isn't a bug in your code? I've never had a problem like that.
#204 Posted 14 August 2009 - 07:32 AM
XThX2, on Aug 14 2009, 10:32 AM, said:
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.
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...
#205 Posted 14 August 2009 - 08:09 AM
#206 Posted 14 August 2009 - 08:32 AM

#207 Posted 14 August 2009 - 06:59 PM
This post has been edited by Ilovefoxes: 14 August 2009 - 07:00 PM
#208 Posted 14 August 2009 - 09:49 PM
#209 Posted 15 August 2009 - 07:09 AM
DeeperThought, on Aug 14 2009, 04:32 PM, said:
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
#210 Posted 15 August 2009 - 08:00 AM
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.
#211 Posted 16 August 2009 - 04:24 AM
XThX2, 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
#212 Posted 16 August 2009 - 08:48 AM
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
#213 Posted 17 August 2009 - 06:08 AM
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?
#214 Posted 17 August 2009 - 08:25 AM
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.
#215 Posted 17 August 2009 - 09:16 AM
DeeperThought, on Aug 17 2009, 11:25 AM, said:
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....
#216 Posted 19 August 2009 - 02:26 AM
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)
#217 Posted 19 August 2009 - 04:06 AM
Offcoure I have never tested it.
#218 Posted 19 August 2009 - 07:11 AM
XThX2, on Aug 19 2009, 03:26 AM, said:
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?
#219 Posted 19 August 2009 - 08:15 AM
Also, why is the statnum jumping from 13 to 1024 on Edukewiki ? Are there too many to list ?
#220 Posted 19 August 2009 - 09:43 AM
#221 Posted 21 August 2009 - 12:09 PM
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.
#222 Posted 21 August 2009 - 12:17 PM
#223 Posted 21 August 2009 - 12:56 PM
Leaves me wondering why it did work perfectly before do. With such a mayor flaw in it.
#224 Posted 21 August 2009 - 01:51 PM
lycanox, on Aug 21 2009, 01:56 PM, said:
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
#225 Posted 21 August 2009 - 02:41 PM
move MYMOVEUP 0 -100 useractor notenemy MYACTOR move MYMOVEUP getv enda
This post has been edited by Mblackwell: 21 August 2009 - 02:41 PM
#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