
EDuke32 Scripting "CON coding help"
#293 Posted 08 September 2009 - 04:00 AM
HightTreason, check this. "bits"
#294 Posted 08 September 2009 - 04:07 AM
Ilovefoxes, on Sep 8 2009, 05:52 AM, said:
Both are essentially the same actor. (Which is probably how the game fools enemies to attack it. )
If you want the holoduke actor to actually do simple stuff. Ifpdistg 1000 or ifspawnedby APLAYER might have some effect.
(However do seem have side effects while teleporting or jet packing against a ridge.)
However, the best method I found is to spawn your own actor and quickly turn the holoduke off to get rid of the holoduke actor.
XThX2 said:
I was the one that asked it back then. And came to the same conclusion.
This post has been edited by lycanox: 08 September 2009 - 04:11 AM
#295 Posted 08 September 2009 - 12:17 PM
I don't have access to my computer now so I can't give you my exact code (I'll try tomorrow) but here's the gist of it:
When my actor has a positive value from his htextra he'll then do the following (plus more but that's not relevent)
gamevar MYENEMY -1 2 // records who my actor will attack gamevar DTEMP1 -1 2 // records the ID of what projectile (or attack) that hit the actor gamevar DTEMP2 0 2 // used as a temp value gamevar DTEMP3 -1 2 // records the ID of who shot the actor or inflicted damage if melee gamevar RECORD1 -1 2 // used as a temp, in this case it'll record the distance obtained through the dist command gamevar RECORD2 -1 2 // used as a temp, in this case it'll record the distance obtained through the dist command ifvare DTEMP3 -1 // you were hit but this value was not set meaning it was a projectile that hit the actor { getactor[THISACTOR].htowner DTEMP3 // know who's hit you getactor[THISACTOR].htpicnum DTEMP1 // know what's hitting you } ifvare MYENEMY -1 setvarvar MYENEMY DTEMP3 // if you have no enemy ID then treat who hit you as the enemy else // you had an enemy ID but now you have 2! { ifvarg MYENEMY -1 // you have an enemy ID { getactor[MYENEMY]statnum DTEMP2 ifvarn DTEMP2 1024 dist [RECORD1] [THISACTOR] MYENEMY } else setvar RECORD1 99999 ifvarg DTEMP3 -1 // you have an ID of the projectile's owner { getactor[DTEMP3]statnum DTEMP2 ifvarn DTEMP2 1024 dist [RECORD2] [THISACTOR] DTEMP3 } else setvar RECORD2 99999 ifvarvarl RECORD2 RECORD1 setvarvar MYENEMY DTEMP3 // the new enemy is closer so record his ID! } setvar DTEMP1 -1 // erase the knowledge of who hit you - its no longer needed. setvar RECORD1 -1 setvar RECORD2 -1
My errors bascally say something like that "error with dist - invalid sprite" meaning the actor does not exist but I made sure its being checked for with the statnum checking.....
This post has been edited by Chip: 08 September 2009 - 12:33 PM
#296 Posted 08 September 2009 - 12:27 PM
#297 Posted 08 September 2009 - 12:32 PM
XThX2, on Sep 8 2009, 09:27 PM, said:
If you're refering to the [ ] on a gamevar in the dist command, that's because the game throws a fit if I don't put them on saying stuff like "RECORD1" is not a game array...
Quote
Ignore that, I've just written this out now so things like that which would cause the game to not load up don't exist in my real code.
Quote
I'm going to have to but I didn't get time today but the fact is by rights the game shouldn't read those dist commands if my actor doesn't have an enemy ID or if so then not if it has a statnum of 1024.
This post has been edited by Chip: 08 September 2009 - 12:32 PM
#298 Posted 08 September 2009 - 12:45 PM
#299 Posted 08 September 2009 - 12:51 PM
DeeperThought, on Sep 8 2009, 09:45 PM, said:
Here's a quick run down where the error happens:
ifvarg DTEMP3 -1 // you have an ID of the projectile's owner { getactor[DTEMP3]statnum DTEMP2 ifvarn DTEMP2 1024 dist [RECORD2] [THISACTOR] DTEMP3 } else setvar RECORD2 99999
If the gamevar DTEMP3 holds a value of 0+ then check its existance with the statnum. If the statnum gamevar is not 1024 then check the distance between the actor and the enemy id that DTEMP3 holds.
I'm going to have to post my actual code tomorrow but I'm certain there's no difference between this and that...with the exception that the main code checks to make sure the actor THISACTOR actually exists incase it was somehow running this state from beond the void.
#300 Posted 08 September 2009 - 01:07 PM
XThX2, on Sep 8 2009, 01:27 PM, said:
Right, but it's not his "actual code", so it's waste of our time to even look at it.
#301 Posted 09 September 2009 - 12:58 AM
#302 Posted 09 September 2009 - 02:25 AM
This post has been edited by Chip: 09 September 2009 - 02:26 AM
#303 Posted 09 September 2009 - 03:10 AM
Ilovefoxes, on Sep 9 2009, 10:58 AM, said:
You'll have to do better than sector[THISACTOR]. Get the sectnum from thisactor to a gamevar and then use sector[] on that.
#304 Posted 09 September 2009 - 06:35 AM
Plagman, on Sep 9 2009, 04:10 AM, said:
I thought those were supposed to be equivalent.
#305 Posted 09 September 2009 - 06:55 AM
DeeperThought, on Sep 9 2009, 04:35 PM, said:
Ah, then THISACTOR is smarter than I thought; anyway, it should be getsector[] and not sector[]. Is it allowed to use it directly as a gamevar or do you have to assign ceilingstat to an actual gamevar first?
#306 Posted 09 September 2009 - 07:08 AM
Plagman, on Sep 9 2009, 07:55 AM, said:
A while back, TerminX added the ability to refer to struct members as variables for the purpose of comparing values. For example, ifvare sprite[THISACTOR].pal 10 is equivalent to ifspritepal 10. What Ilovefoxes posted conforms to the new syntax and should work. We still have to put members into variables in order to set things, though. For example, this does not work: setactor[THISACTOR].z player[THISACTOR].posz
EDIT: That's wrong. What I should have is that struct members cannot be the targets of gamevar writes. For example, setvarvar player[THISACTOR].posz Z is not valid. On the other hand, setactor[THISACTOR].z player[THISACTOR].posz should work.
This post has been edited by DeeperThought: 10 September 2009 - 03:37 PM
#307 Posted 09 September 2009 - 06:40 PM
Heh, I would also like to use getplayer[sprite[sprite[THISACTOR].owner].yvel].extra, but this seems overpower. =P
This post has been edited by Ilovefoxes: 09 September 2009 - 07:24 PM
#308 Posted 09 September 2009 - 09:27 PM
Ilovefoxes, on Sep 9 2009, 07:40 PM, said:
That doesn't make sense. Extra is not even a member of the player struct. Also, it kind of defeats the purpose if you make your code hard to read.
#309 Posted 09 September 2009 - 09:44 PM
But I mean to replace this:
Quote
getactor[OWNER].x X
Quote
This post has been edited by Ilovefoxes: 09 September 2009 - 09:44 PM
#310 Posted 10 September 2009 - 05:18 AM
#311 Posted 10 September 2009 - 09:15 AM
if you are using something like:
Quote
sound PISTOL_RICOCHET
But this:
Quote
addphealth 10
You must understand that the sound is not part of the game, and may or may not be here depending of the player option (sound on/off, maximum number of sounds, especially the lenght of the user sound file, etc).
This post has been edited by Ilovefoxes: 10 September 2009 - 09:16 AM
#312 Posted 10 September 2009 - 12:03 PM
Example: actor suffers a single freeze blast hit - he then takes damage from a melee hit (set directly through an actor) - actor now dies.....but plays the "freeze" effect which is the end effect of dying to a freezeblast hit.
..unless ifwasweapon <NAME OF ACTOR INFLICTING DAMAGE!> works in over riding the last weapon? Pure assumption based on the fact that actors will hard codedly know who set damage on them (as I found out when my actor started attacking himself after suffering fall damage - my actors record the owner of the weapon as their enemy and since the fall damage was set by himself he then recorded his own ID as his enemy!)
This post has been edited by Chip: 10 September 2009 - 12:12 PM
#313 Posted 10 September 2009 - 12:59 PM
#314 Posted 10 September 2009 - 01:27 PM
It sets ifwasweapon to tilenumber -1. Which is not defined as a projectile in the game and thus makes the game run the standard hit and dead code.
setactor[THISACTOR].htpicnum -1
This post has been edited by lycanox: 10 September 2009 - 02:00 PM
#315 Posted 11 September 2009 - 11:42 AM
lycanox, on Sep 10 2009, 10:27 PM, said:
setactor[THISACTOR].htpicnum -1
And that was my problem! Because this was infront of the actor taking damage it gets overwritten as soon as the htextra becomes a positive value. Simply adding the set picnum thing after htextra was set works.
In addition to that
Quote
Well that certainly works as far as my tests went!
I had it play a quote if "ifwasweapon CHARMELEON" (name of actor) turned true and it certainly did when ever the actor CHARMELEON sets damage to the actor through setactor[MYENEMY].htextra.
#316 Posted 11 September 2009 - 03:12 PM
The question is, how can I go about disabling this ? I think this is hardcoded in enemy type actors.
This post has been edited by XThX2: 11 September 2009 - 03:12 PM
#317 Posted 11 September 2009 - 04:23 PM
#318 Posted 11 September 2009 - 04:29 PM
getactor[THISACTOR].ang angvar ifhitweapon { setactor[THISACTOR].ang angvar
But that won't work unless the angle changes when ifhitweapon is checked. A foolproof method is to have the actor save their angle each tic at the end of their code, then restore to the saved angle when ifhitweapon is true
This post has been edited by DeeperThought: 11 September 2009 - 04:31 PM
#319 Posted 11 September 2009 - 04:58 PM
#320 Posted 12 September 2009 - 12:16 AM
#321 Posted 15 September 2009 - 04:23 AM
Any idea so that I can make it has no blank spot?
This post has been edited by Ilovefoxes: 15 September 2009 - 05:07 AM
#322 Posted 16 September 2009 - 04:10 PM
getactor[THISACTOR].z z2 getplayer[THISACTOR].i ID getactor[ID].z posz subvar z2 8192 subvarvar z2 posz ldist xyvalue2 THISACTOR ID mulvarvar z2 z2 mulvarvar xyvalue2 xyvalue2 addvarvar z2 xyvalue2 sqrt z2 z2 ezshoot z2 YELLOWROCKET /* getactor[THISACTOR].x x getactor[THISACTOR].y y getactor[THISACTOR].ang TEMP setvarvar y2 y addvar y2 128 rotatepoint x y x y2 TEMP x3 y3 setactor[RETURN].y y3 */
I was trying to make an actor shoot another from some distance with accurate vertical aim. The enemy targets player, and has rocket launcher mounted on his back, so he fires from a bit higher than the actor's Z. I thought of the case, draw some simple sketches and found out that phythagoras would just work fine. Difference between Z's form the height, their distance forms the base, and finally, the result forms the zvel it must come from. So, where have I been mistaken with this idea ? D:
[EDIT] : Forgot to say what doesn't work. The actor shoots at his feet if player is too far, and even behind himself which can actually go really far. If player is really close, then the rocket goes where it is supposed to, but most of the time, missed the player.
This post has been edited by XThX2: 16 September 2009 - 04:18 PM