EDuke32 Scripting "CON coding help"
#655 Posted 07 May 2011 - 09:32 PM
#656 Posted 08 May 2011 - 09:04 AM
DeeperThought, on 07 May 2011 - 08:19 PM, said:
Wow, thanks! It took a little bit of finagling with the numbers to make it look the way I wanted, but it's working well. The drawback you mentioned is negligible, though it seems to me less like the screen's continuing to bounce, and more like it's returning to the position it started in. Course, you wrote the code (in addition to trumping me in pretty much every imaginable way when it comes to this stuff) so you'd know about it better than I would.
#657 Posted 01 June 2011 - 06:02 AM
state correctcansee setvar sightvar 0 getactor[THISACTOR].z mz getplayer[THISACTOR].i ID getactor[ID].z posz subvar posz 8192 setactor[ID].z posz getactorvar[THISACTOR].height htemp ifvare htemp 0 setvar htemp 6144 subvarvar mz htemp setactor[THISACTOR].z mz canseespr THISACTOR ID sightvar addvarvar mz htemp addvar posz 8192 setactor[ID].z posz setactor[THISACTOR].z mz ends
The way I use this state can also be the problem so, I just use an ifrnd check and then this state and check if sightvar == 1 then move on to firing AI.
#658 Posted 01 June 2011 - 09:22 AM
XThX2, on 01 June 2011 - 06:02 AM, said:
state correctcansee setvar sightvar 0 getactor[THISACTOR].z mz getplayer[THISACTOR].i ID getactor[ID].z posz subvar posz 8192 setactor[ID].z posz getactorvar[THISACTOR].height htemp ifvare htemp 0 setvar htemp 6144 subvarvar mz htemp setactor[THISACTOR].z mz canseespr THISACTOR ID sightvar addvarvar mz htemp addvar posz 8192 setactor[ID].z posz setactor[THISACTOR].z mz ends
The way I use this state can also be the problem so, I just use an ifrnd check and then this state and check if sightvar == 1 then move on to firing AI.
What you are doing there is kind of strange. It's impossible to know what is in the variable named "height" prior to the state execution, which makes it difficult to evaluate. The most likely problem is that you are not actually moving the monster up before the sight check.
state correctcansee getactor[THISACTOR].z mz subvar mz 8192 setactor[THISACTOR].z mz ifcansee setvar sightvar YES else setvar sightvar NO addvar mz 8192 setactor[THISACTOR].z mz ends
How does this state work for you? Notice I moved the monster up, but not the player, then I did the regular "ifcansee" height check.
#659 Posted 01 June 2011 - 10:03 AM
And for your code, as always you've saved me from that big trouble ! I can't thank you enough for that ! I get what you did, but I have no idea why my method messed the monsters up. They all work as intended
#660 Posted 01 June 2011 - 10:13 AM
XThX2, on 01 June 2011 - 10:03 AM, said:
And for your code, as always you've saved me from that big trouble ! I can't thank you enough for that ! I get what you did, but I have no idea why my method messed the monsters up. They all work as intended
Now that you've explained it, it does seem that your code should have been working, assuming that each monster's height var stored the distance between its feet and eyeballs. You might want to check to make sure that variable has the correct values.
#661 Posted 01 June 2011 - 10:20 AM
This post has been edited by XThX2: 01 June 2011 - 10:21 AM
#662 Posted 03 June 2011 - 12:45 AM
This post has been edited by XThX2: 03 June 2011 - 12:45 AM
#663 Posted 03 June 2011 - 09:55 AM
#665 Posted 23 June 2011 - 02:05 PM
This post has been edited by James: 23 June 2011 - 02:05 PM
#666 Posted 23 June 2011 - 02:20 PM
James, on 23 June 2011 - 02:05 PM, said:
I don't know how it could be done via the input struct, but if you simply want to cut turning speed, you could do this:
getplayer[THISACTOR].oang temp getplayer[THISACTOR].ang tempb getincangle tempb temp tempb divvar tempb 2 addvarvar temp tempb setplayer[THISACTOR].ang temp
You can change the "divvar tempb 2" line to something else for a different ratio. If you want to put a cap on the amount the player can turn in one tic, then you could add a line after the getincangle command that limits it (e.g. "ifvarg tempb 64 setvar tempb 64 ifvarl tempb -64 setvar tempb -64")
#668 Posted 27 June 2011 - 07:44 PM
setvar spriteid 0
whilevarn spriteid 16384
{
setactor[spriteid].statnum 1
getactor[spriteid].x x
getactor[spriteid].y y
ifvare moving_var 1 { addvarvar x sector_xvel addvarvar y sector_yvel } else
{ subvarvar x sector_xvel subvarvar y sector_yvel }
setactor[spriteid].x x
setactor[spriteid].y y
addvar spriteid 1
}
sectsetinterpolation sectorsaved
getsector[sectorsaved].wallnum wallnum
addvarvar wallnum wallsaved
setvarvar wallnum_count wallsaved
whilevarvarn wallnum_count wallnum
{
getwall[wallnum_count].point2 set
getwall[set].x x
getwall[set].y y
ifvare moving_var 1
{ addvarvar x sector_xvel addvarvar y sector_yvel } else
{ subvarvar x sector_xvel subvarvar y sector_yvel }
dragpoint set x y
addvar wallnum_count 1
}
But cycle of sprite moving performed 4 times of tic therefore sector_yvel and sector_xvel added 4 times per tick while for vertex moving in cycle it added once. As a result, the speed of movement of sprites is above 4 times (more exactly 3,3(3) times). Why is happen and how to correct it?
Cycle for sprites moving running about 4 times the cycle for vertex moving regardless of the it position
This post has been edited by M210: 27 June 2011 - 07:53 PM
#669 Posted 27 June 2011 - 09:30 PM
#670 Posted 27 June 2011 - 09:51 PM
DeeperThought, on 27 June 2011 - 09:30 PM, said:
This isn't the case for sectnum/changespritesect any more, but I don't know about statnum.
EDIT: I just checked, and statnum is indeed covered:
from static void __fastcall VM_SetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2):
case ACTOR_SECTNUM:
changespritesect(iActor,lVar1);
return;
case ACTOR_STATNUM:
changespritestat(iActor,lVar1);
return;
This post has been edited by Hendricks266: 27 June 2011 - 09:57 PM
#671 Posted 28 June 2011 - 12:24 AM
DeeperThought, on 27 June 2011 - 09:30 PM, said:
I can show you all code of this state, do you want it?
DeeperThought, on 27 June 2011 - 09:30 PM, said:
This post has been edited by M210: 28 June 2011 - 12:27 AM
#672 Posted 09 July 2011 - 01:47 AM
Thanks in advance
#673 Posted 10 July 2011 - 06:29 AM
insane_metalhead, on 09 July 2011 - 01:47 AM, said:
It is hardcoded.
else if (pp->loogcnt > 0)
{
palette_t lp = { 0, 64, 0, pp->loogcnt>>1 };
Bmemcpy(&tempFade, &lp, sizeof(palette_t));
applyTint = 1;
}Try getting the player.pals values that a green value of 64.
http://wiki.eduke32.com/wiki/Pals
http://wiki.eduke32.com/wiki/Pals_time
Remember that pals is an array:
typedef struct {
char r,g,b,f;
} palette_t;So it would be something like:
getplayer[THISACTOR].pals 1 temp
ifvare temp 64
{
setplayer[THISACTOR].pals 1 0
setplayer[THISACTOR].pals 3 0
setplayer[THISACTOR].pals_time 0
}
#674 Posted 11 July 2011 - 01:28 AM
define PROJECTILE_FLAG_REALCLIPDIST 524288
define PROJECTILE_FLAG_ACCURATE 1048576
Anybody know what these flags for weapon projectiles do?
#675 Posted 03 September 2011 - 07:17 AM
#676 Posted 03 September 2011 - 08:47 AM
Norvak, on 03 September 2011 - 07:17 AM, said:
I assume this is for WGR2 so when you map the mapster scripts for that are already loaded (which means variable "i" has been declared).
The following should work. Go to the console and enter this while the sectors are selected:
do for i selsectors set sector[i].ceilingz 8192
Change "8192" to whatever you want the height to be in your case. The same thing will work for setting shade and other properties. Here is a list of the sector members: http://wiki.eduke32....ector_structure
#677 Posted 03 September 2011 - 10:53 AM
DeeperThought, on 03 September 2011 - 08:47 AM, said:
The following should work. Go to the console and enter this while the sectors are selected:
do for i selsectors set sector[i].ceilingz 8192
Change "8192" to whatever you want the height to be in your case. The same thing will work for setting shade and other properties. Here is a list of the sector members: http://wiki.eduke32....ector_structure
Thanks it works.
#678 Posted 03 September 2011 - 01:34 PM
#679 Posted 03 September 2011 - 02:01 PM
rasmus thorup, on 03 September 2011 - 01:34 PM, said:
http://wiki.eduke32....ter32_Scripting
Also there's a lot of example scripts that come with eduke32
#681 Posted 21 September 2011 - 02:13 PM
#682 Posted 21 September 2011 - 02:24 PM
#683 Posted 22 September 2011 - 12:43 AM
insane_metalhead, on 21 September 2011 - 02:13 PM, said:
It'll be a lot easier if you just create two user actors to execute the code instead of trying to mess around with an SE. Attached is a rough version of the effect. The code's all at the bottom of the game.con therein, but I'll post it here for the sake of explaining it. Course, if someone else has a more efficient way of doing it, feel free to tell me; this is just something I whipped up in about five minutes.
gamevar hitagsaved 0 2 // var used for grabbing the hitag from the actor right when it's loaded into the map
gamevar temphitag 0 2 // temporary var used for storing the hitag as an actorvar
gamevar fakehitag 0 2 // var used for the storing the hitag value so it can be read in actor code.
gamevar GLOBALHITAG -1 0 // a global var that will be set when the "START" teleport actor is engaged.
gamevar x 0 2
gamevar y 0 2
gamevar z 0 2
gamevar sector_actor 0 2
gamevar sector_player 0 2 // just position/sector variables.
define TELEPORTSTART 3328 // the actor that the player engages
define TELEPORTEND 3329 // the actor that changes the player's coordinates
eventloadactor TELEPORTSTART // when the TELEPORTSTART actor is loaded into the map...
getactor[THISACTOR].hitag hitagsaved // get its hitag value
setactorvar[THISACTOR].temphitag hitagsaved // and set the "temphitag" variable to whatever that value is
setactor[THISACTOR].hitag 0 // then set the hitag to zero.
enda
eventloadactor TELEPORTEND // and do the same thing for the TELEPORTEND actor
getactor[THISACTOR].hitag hitagsaved
setactorvar[THISACTOR].temphitag hitagsaved
setactor[THISACTOR].hitag 0
enda
useractor notenemy TELEPORTSTART 0
cstat 32768 // make it invisible
getactorvar[THISACTOR].temphitag fakehitag // set the "fakehitag" variable equal to the value of the "temphitag" variable
getactor[THISACTOR].sectnum sector_actor
getplayer[THISACTOR].cursectnum sector_player // get the sector number of both the player, and the TELEPORTSTART actor...
ifvarvare sector_actor sector_player // if they're equal (i.e the player is in the same sector as the TELEPORTSTART actor)...
{
ifhitspace { // if the player hits space...
ifcount 15 {
setvarvar GLOBALHITAG fakehitag resetcount // set the "GLOBALHITAG" variable equal to the value of the "fakehitag" variable.
}
}
}
enda
useractor notenemy TELEPORTEND 0
cstat 32768
getactorvar[THISACTOR].temphitag fakehitag // again, set the "fakehitag" variable
getactor[THISACTOR].sectnum sector_actor
getactor[THISACTOR].x x
getactor[THISACTOR].y y
getactor[THISACTOR].z z // grab the "TELEPORTEND" actor's x, y, z coordinates and sector number
ifvarvare GLOBALHITAG fakehitag { // if the "GLOBALHITAG" variable is equal the the "TELEPORTEND" actor's "fakehitag" variable...
setplayer[THISACTOR].cursectnum sector_actor
setplayer[THISACTOR].posx x
setplayer[THISACTOR].posy y // set the player's sector, x and y coordinates equal to the "TELEPORTEND" actor's...
subvar z 6500 // subtract 6500 from the "TELEPORTEND" actor's z-coordinate. (If this isn't done, the screen will briefly flicker towards the floor upon teleporting)
setplayer[THISACTOR].posz z // set the player's z-coordinate equal to the new z-coordinate.
setvar GLOBALHITAG -1 } // and reset the "GLOBALHITAG" so it can be done all over again.
enda
The map makes it clear-cut enough, but basically all you do is take a "TELEPORTSTART" actor and a "TELEPORTEND" actor, put them at two different parts of the map, then give them matching hitags.
Attached File(s)
-
teleport.zip (304.66K)
Number of downloads: 908
This post has been edited by EmericaSkater: 22 September 2011 - 01:20 AM

Help
Duke4.net
DNF #1
Duke 3D #1


