
EDuke32 Scripting "CON coding help"
#17 Posted 19 May 2009 - 03:22 PM
#18 Posted 19 May 2009 - 04:39 PM
ReaperTK, on May 19 2009, 07:18 PM, said:
OK I've got it checking for the picnum change (probably a better way to do it though than what I did). I had it store the current picnum to a per actor variable in the eventloadactor code then grabbed the picnum again in the EVENT_GAME code (after checking the EXTRA value) I then compared the two to determine if a change had occurred.
Now I just need to know the proper use of the operateactivators command to activate the doors (I threw in some debugging code to arbitrarily change the switches picnum as you'll see below just to make sure the proper conditions are actually being met.
onevent EVENT_GAME { ifvare EXTRA 20 { // Airlock Switch getactor[THISACTOR].picnum AIRLKNPIC ifvarvarn AIRLKNPIC AIRLKCPIC { // Switch has been activated operateactivators AIRLK 0 // setactor[THISACTOR].picnum 135 setvarvar AIRLKCPIC AIRLKNPIC } // end ifvarn } // end ifvare } // end EVENT_GAME endevent
I'm so close I can taste it.
EDIT: Nevermind, I've got it working perfectly now. I had an issue in the map that was preventing the doors from opening.
This post has been edited by ReaperTK: 19 May 2009 - 04:57 PM
#19 Posted 19 May 2009 - 07:37 PM
ReaperTK, on May 19 2009, 05:39 PM, said:
Haha, I do it the same way in my switch effects. I can't think of any other way of doing it at the moment.
#20 Posted 23 May 2009 - 02:03 AM
I'm no good at con editing so I'd need someone to tell me exactly what to do.
So if there is anyone out there who has the time and is willing to help me, I'll be forever in your debt.
EDIT: Sorry, just downloaded latest dukeplus and it includes the sd "blood clouds", which more that satisfy my needs... (for now!)
This post has been edited by XenoMatriX: 23 May 2009 - 03:49 AM
#21 Posted 06 June 2009 - 12:14 AM
#22 Posted 06 June 2009 - 12:52 AM
James, on Jun 6 2009, 01:14 AM, said:
That reminds me, I did this for one of the Blood mods a while ago. I was supposed to port the code for Dimebog, but I've been otherwise occupied. I am attaching the code that I used:

Number of downloads: 1578
Simplifying a bit, what I did was to add or subtract a number from the player's angle depending on the part of the firing sequence you are at. The angle is reset after firing so you can't tell that the player is turning. So: check altfire counter variable, and depending on what that is you change angle, fire bullet, reset angle (in the player's code). Then there is display code that syncs up with the firing.
#24 Posted 11 June 2009 - 04:05 AM
onevent EVENT_GAME . . . ifactor MACE2 { getactorvar[THISACTOR].ACTORCOUNT countvar addvar countvar 1 setactorvar[THISACTOR].ACTORCOUNT countvar ifvare countvar 5 { ifaction MACEFRAMES action MACEFRAMES2 else ifaction MACEFRAMES2 action MACEFRAMES3 else ifaction MACEFRAMES3 action MACEFRAMES4 else ifaction MACEFRAMES4 action MACEFRAMES5 else ifaction MACEFRAMES5 action MACEFRAMES6 else ifaction MACEFRAMES6 action MACEFRAMES7 else ifaction MACEFRAMES7 action MACEFRAMES setvar countvar 0 setactorvar[THISACTOR].ACTORCOUNT countvar } } . . . endevent define MACE2 7408 define MACESTAND 7414 action MACEFRAMES 0 1 1 action MACEFRAMES2 1 1 1 action MACEFRAMES3 2 1 1 action MACEFRAMES4 3 1 1 action MACEFRAMES5 4 1 1 action MACEFRAMES6 5 1 1 action MACEFRAMES7 6 1 1 defineprojectile MACE2 PROJ_WORKSLIKE 6278 //4096 + 2048 + 4 + 2 defineprojectile MACE2 PROJ_SPAWNS MACESTAND defineprojectile MACE2 PROJ_VEL 125 defineprojectile MACE2 PROJ_EXTRA 0 defineprojectile MACE2 PROJ_DROP -75 defineprojectile MACE2 PROJ_ISOUND -1 defineprojectile MACE2 PROJ_HITRADIUS 1 defineprojectile MACE2 PROJ_BOUNCES 4 defineprojectile MACE2 PROJ_BSOUND -1 defineprojectile MACE2 PROJ_XREPEAT 50 defineprojectile MACE2 PROJ_YREPEAT 50 defineprojectile MACE2 PROJ_CSTAT 1 defineprojectile MACE2 PROJ_CLIPDIST 70 useractor notenemy MACE2 0 MACEFRAMES enda useractor notenemy MACESTAND 0 sizeat 50 50 enda
That's the code I used for an object that is spawned upon the death of a monster... It basically spawns, falls on the ground, spins 4 times, and then disappears... it doesn't spawn the MACESTAND actor. What's wrong? And, this code USED to work on old versions.
This post has been edited by XThX2: 11 June 2009 - 04:06 AM
#25 Posted 11 June 2009 - 06:36 AM
XThX2, on Jun 11 2009, 05:05 AM, said:
onevent EVENT_GAME . . . ifactor MACE2 { getactorvar[THISACTOR].ACTORCOUNT countvar addvar countvar 1 setactorvar[THISACTOR].ACTORCOUNT countvar ifvare countvar 5 { ifaction MACEFRAMES action MACEFRAMES2 else ifaction MACEFRAMES2 action MACEFRAMES3 else ifaction MACEFRAMES3 action MACEFRAMES4 else ifaction MACEFRAMES4 action MACEFRAMES5 else ifaction MACEFRAMES5 action MACEFRAMES6 else ifaction MACEFRAMES6 action MACEFRAMES7 else ifaction MACEFRAMES7 action MACEFRAMES setvar countvar 0 setactorvar[THISACTOR].ACTORCOUNT countvar } } . . . endevent define MACE2 7408 define MACESTAND 7414 action MACEFRAMES 0 1 1 action MACEFRAMES2 1 1 1 action MACEFRAMES3 2 1 1 action MACEFRAMES4 3 1 1 action MACEFRAMES5 4 1 1 action MACEFRAMES6 5 1 1 action MACEFRAMES7 6 1 1 defineprojectile MACE2 PROJ_WORKSLIKE 6278 //4096 + 2048 + 4 + 2 defineprojectile MACE2 PROJ_SPAWNS MACESTAND defineprojectile MACE2 PROJ_VEL 125 defineprojectile MACE2 PROJ_EXTRA 0 defineprojectile MACE2 PROJ_DROP -75 defineprojectile MACE2 PROJ_ISOUND -1 defineprojectile MACE2 PROJ_HITRADIUS 1 defineprojectile MACE2 PROJ_BOUNCES 4 defineprojectile MACE2 PROJ_BSOUND -1 defineprojectile MACE2 PROJ_XREPEAT 50 defineprojectile MACE2 PROJ_YREPEAT 50 defineprojectile MACE2 PROJ_CSTAT 1 defineprojectile MACE2 PROJ_CLIPDIST 70 useractor notenemy MACE2 0 MACEFRAMES enda useractor notenemy MACESTAND 0 sizeat 50 50 enda
That's the code I used for an object that is spawned upon the death of a monster... It basically spawns, falls on the ground, spins 4 times, and then disappears... it doesn't spawn the MACESTAND actor. What's wrong? And, this code USED to work on old versions.
There is a bug in the current version of EDuke32 which causes actors spawned by bouncing projectiles to end up in random places (often so far away from the projectiles it appears they aren't spawning at all). The bug has been fixed, but the fixed version won't be released until polymer is. If you want the fix you need to use a recent polymer build.
As a workaround, you can change spawns to -1 and have the projectile spawn the actor in EVENT_KILLIT.
#27 Posted 12 June 2009 - 07:26 AM
DeeperThought, on Jun 11 2009, 06:36 AM, said:
As a workaround, you can change spawns to -1 and have the projectile spawn the actor in EVENT_KILLIT.
Hmm I guess I can wait the polymer's release... (I hope it is released shortly)
#28 Posted 16 June 2009 - 09:20 AM
#29 Posted 16 June 2009 - 09:35 AM
Unfortunately I can't remember what causes it. What was the last thing you implemented before you saw the bug?
#30 Posted 16 June 2009 - 11:01 AM
#31 Posted 16 June 2009 - 11:08 AM
I'll check my jumping code, I remember coding something to limit the jump of the player...
#32 Posted 25 June 2009 - 08:09 AM
/* getplayer[THISACTOR].jumping_counter TEMP ifvare TEMP 650 { setplayer[THISACTOR].jumping_counter ZERO } */
This post has been edited by XThX2: 25 June 2009 - 08:10 AM
#33 Posted 25 June 2009 - 08:12 AM
#34 Posted 25 June 2009 - 10:43 AM
#35 Posted 25 June 2009 - 02:51 PM
#36 Posted 26 June 2009 - 12:47 AM
Quote
I saw this below the reply box, right under the text "Attachments". Is this a joke ? D:
#37 Posted 26 June 2009 - 07:16 AM
XThX2, on Jun 26 2009, 01:47 AM, said:
The player flying up to the sky is a fairly simple, isolated problem and it shouldn't be very difficult to debug, especially if it's happening every time.
Here's a few basic debugging procedures that you should have done already:
*verify whether it happens in a single room map with no sprites (this will tell you, for example, whether it is some other sprite setting the player sprites z coordinate)
*display the values of posz and poszv on the screen or print them to the log
*comment out or otherwise disable EVENT_GAME, and then other events until you find the one responsible (if none, then you know the problem is in actor code)
#38 Posted 28 June 2009 - 06:19 AM
The attack damage is worked out by a formular which makes the attack damage higher depending on the actor's level. The actor also has access to multiple attacks but that's not really relevent.
After my formular is done, an actor at level 1 witch has an attack stat of 12 should do 4 damage to the player. That number is currently being held in a gamevar, how can I get that gamevar taken away from the player's HP? This value is also a positive value so I need to use subvar to take it away but I don't know what I'm meant to take it away since I can't edit the .extra for players.
*edit*
I've thought of a way but I would still prefere a different method.
Mine would be seomthing like this:
ifvarg TEMP 0 { addphealth -1 subvar TEMP 1 }
and then think of a way to have that loop till my attack value is empty.
Like I said, I would still prefere a better method, a more instant and direct reduction.
This post has been edited by Chip: 28 June 2009 - 06:40 AM
#39 Posted 28 June 2009 - 07:51 AM
#40 Posted 28 June 2009 - 10:38 AM
My main concern with that was it would take too long for large damage amounts to be applies - in one test the player was killed outright but it took like 5 seconds for the HP to run all the way down. I solved that by making it take off 100s till there were no 100s left then it'll move onto 50s, then 10s then finally 1s. It still takes like nearly a second to knock down the HP but I kindof like seeing it rub down through numbers instead of instantly applied.
This post has been edited by Chip: 28 June 2009 - 11:19 AM
#41 Posted 28 June 2009 - 10:58 AM
There's this thing which could be useful to you, though I couldn't figure out how to use it properly. Does anyone know how to use it?
Apart from that, how would you get player's ID from the monster? I know it has to do with the player structure member "i" but how, hitscans from monster ?
#42 Posted 29 June 2009 - 07:14 PM
getplayer[THISACTOR].i temp getactor[temp].extra temp2 subvarvar temp2 damage setactor[temp].extra temp2
getplayer[THISACTOR] for actors besides APLAYER refers to the nearest player, just like addphealth does. "extra" means health/strength for most actors. James's method has advantages, but is more complicated--I can't remember all the necessary details.
P.S.: Do you know about whilevarn? If you ever do need a loop.
This post has been edited by Dr. Kylstein: 29 June 2009 - 07:17 PM
#43 Posted 30 June 2009 - 09:06 AM
#44 Posted 30 June 2009 - 09:50 AM
MIKE SIMS, on Jun 30 2009, 10:06 AM, said:
onevent EVENT_DISPLAYREST ifvare player[THISACTOR].heat_on YES rotatesprite xcoord ycoord size rotation tilenumber shade color orientation 0 0 xdim ydim endevent
Look up rotatesprite in the EDuke32 wiki to understand this better. Replace the names I put in there (such as "tilenumber") either with numbers or your own variables. Good luck.
#45 Posted 30 June 2009 - 12:05 PM
Quote
getplayer[THISACTOR].i temp getactor[temp].extra temp2 subvarvar temp2 damage setactor[temp].extra temp2
getplayer[THISACTOR] for actors besides APLAYER refers to the nearest player, just like addphealth does. "extra" means health/strength for most actors. James's method has advantages, but is more complicated--I can't remember all the necessary details.
Ahh, obtaining and altering the player's HP through the actor sructure - that's cunning!
But if that works then why can't we just have the .extra command on the player structure as well and alter it directly through that?
This post has been edited by Chip: 30 June 2009 - 12:08 PM
#46 Posted 30 June 2009 - 12:21 PM
Chip, on Jun 30 2009, 12:05 PM, said:
But if that works then why can't we just have the .extra command on the player structure as well and alter it directly through that?
Then coding wouldn't be fun !
