
EDuke32 Scripting "CON coding help"
#1944 Posted 21 February 2017 - 11:23 PM
The count is in there to prevent a glitch where the door would open and close quickly with just a quick tap of the key. The count and Boolean vars unlock the check for ifhitspace.
#1945 Posted 23 February 2017 - 04:55 AM
Drek, on 21 February 2017 - 11:23 PM, said:
The count is in there to prevent a glitch where the door would open and close quickly with just a quick tap of the key. The count and Boolean vars unlock the check for ifhitspace.
Otherwise is it possible to make directly rotate a sprite by 90° only with a script ?
(therefore animation frames would not even be required)
#1946 Posted 23 February 2017 - 07:04 AM
David B., on 23 February 2017 - 04:55 AM, said:
(therefore animation frames would not even be required)
I think it is, I think it will rotate at center. Look at the top of the page for angle info.
#1947 Posted 15 April 2017 - 04:55 PM
Normally they would just goto the ceiling of the TROR and not go up further.
For the mod I am finishing, sparks coming through the hole in the floor "somewhere" in the mod.
We know mobs, projectile will go through TROR limits that doesn't block.
first scene is it stops at the end of the TROR top and slides sideways.
second scene I added "fall" in its code and it goes beyond the TROR "top" instead of sliding sideways.
fall wont make the thing go up "fall down".
here is a test vid (not a level of my mod)
#1948 Posted 12 May 2017 - 01:42 PM
#1949 Posted 12 May 2017 - 02:13 PM
xvel yvel & zvel are set in mapster sometimes for custom mods, or maybe you want real velocity immediately upon map load.
Event loadactor is probably where you would set it, just setvar[THISACTOR].*vel ###
#1950 Posted 12 May 2017 - 02:18 PM
espawn MYACTOR ifvarn RETURN -1 { setactor[RETURN].xvel YOUR_VAR_OR_NUMBER // YVEL, ZVEL or whatever other structs. }
Or else you might have to catch it in EVENT_EGS, getting the RETURN to there should be trivial, but depending on what you're trying to do, a simple ifactor might be enough if you want every actor of that type to be affected when it spawns into the map.
This post has been edited by High Treason: 12 May 2017 - 02:18 PM
#1951 Posted 12 May 2017 - 03:25 PM
#1952 Posted 12 May 2017 - 04:09 PM
ifmove 0 { move YOURMOVE }in one of the events instead,
I don't know that this would make so much difference by now, though setting the VEL parameters immediately afterwards would certainly take a sprite up to full speed near enough instantly. Keep in mind that those values are in relation to the sprite's location in the map and not the orientation of the sprite - for example, rotating a sprite with a high XVEL will not change the way it moves, it will still move towards positive X on the map.
If you get stuck I'd be willing to take a quick look at what you're trying to do, as well as trying to make it work.
This post has been edited by High Treason: 12 May 2017 - 04:10 PM
#1953 Posted 12 May 2017 - 05:18 PM
High Treason, on 12 May 2017 - 04:09 PM, said:
That's not true. Sprites with a positive xvel member will move forwards (in the direction they are facing), whether it is on the x-axis of the map or not. I think you might be confusing this with using the internal clipmove function, or the movesprite CON command, which are different.
#1954 Posted 12 May 2017 - 05:51 PM
A cut-down version if you wish to observe this would be;
onevent EVENT_GAME ifactor APLAYER { setplayer[THISACTOR].xvel 102400 // Should be enough to make you move a little, but not fast enough to instantly smash into a wall. } endevent
I understand that the "ifactor" is redundant as I am using setplayer, but I use this "if" in my code because of other code that has to run exclusively in the APLAYER actor. I doubt it has any bearing at all, but it is included for consistency with what I have. Turning the player does not alter the direction in which they are traveling; A positive XVEL set this way serves to move the player towards positive X on the grid, regardless of which way they are facing.
This method is unusual for me anyway and is related to a specific purpose. Usually I just add/subtract X/Y/Z as I can safely assume the player won't be positioned outside of player space at any time the code is used.
#1955 Posted 12 May 2017 - 06:13 PM
High Treason, on 12 May 2017 - 05:51 PM, said:
That's because the player is different. For the player, there are posxv, posyv, and poszv members, all for speeds on the different planes. So yes, the player is the one entity in the game that works as you describe -- but we weren't talking about the player. We were talking about sprites that you can spawn. For regular sprites, positive xvel makes them move forward, negative makes them move backwards, positive zvel makes them move down, negative zvel makes them move up. And the yvel member on sprites is not used for velocity -- it has different purposes for different types of sprites.
#1956 Posted 12 May 2017 - 07:09 PM
I've noticed that some interesting things can happen if an actor's YVEL is manipulated and I am aware of some effects using it to store information. One such effect I discovered is actually useful in a map I've had shelved for years.
#1957 Posted 25 May 2017 - 10:52 AM
I'm trying to create an icon (sprite) with a script behind, its role is playing a sound (determined by the lotag) when the player is close to it and hits space.
But the sprite disappears in the game (I have seen the sprite is "annihilated" in the game because of the script behind, and the sprite has not been set as invisible) and nothing works as usual...
DEF FILE : dummytile 5970 24 24 texture 5970 { pal 0 { file "fx/icon_sound.jpg" } } DEFS.CON : define I_SOUND 5970 GAME.CON : gamevar snd 0 2 state playsnd ifpdistl 1024 ifhitspace { getactor[THISACTOR].lotag snd soundoncevar snd } ends useractor notenemy I_SOUND state playsnd enda
It's painful to do a single basic CON script that works... Some modders implement within their games new effects with icons (similar to S, M, T...) like in Dark Level. But despite my effort I can't figure out how they're doing this.
May I have some help to fix it ? It would be appreciated

#1958 Posted 25 May 2017 - 11:01 AM
eventloadactor I_SOUND getactor[THISACTOR].lotag snd setactor[THISACTOR].lotag 0 enda
Basically, you need to copy the lotag into a gamevar at map load, because otherwise the engine might do something to the sprite based on the number.
#1959 Posted 25 May 2017 - 12:12 PM
Hendricks266, on 25 May 2017 - 11:01 AM, said:
eventloadactor I_SOUND getactor[THISACTOR].lotag snd setactor[THISACTOR].lotag 0 enda
Basically, you need to copy the lotag into a gamevar at map load, because otherwise the engine might do something to the sprite based on the number.
But your solution works perfectly, thanks !
#1960 Posted 25 May 2017 - 01:02 PM
David B., on 25 May 2017 - 12:12 PM, said:
It's because lotag on sprites is used to determine whether they are deleted when the map loads. If the difficulty setting is lower than the tag, they get deleted.
#1961 Posted 25 May 2017 - 01:02 PM
This post has been edited by Mark.: 25 May 2017 - 01:04 PM
#1962 Posted 26 May 2017 - 12:15 PM
Mark., on 25 May 2017 - 01:02 PM, said:
#1963 Posted 30 May 2017 - 07:09 AM
This post has been edited by Mark.: 30 May 2017 - 09:26 AM
#1964 Posted 30 May 2017 - 11:19 AM
Mark., on 30 May 2017 - 07:09 AM, said:
You can do it the old fashioned way:
First, define a move that will be used like a var:
move WAIT
Then, in the actor's code, you do something like this (please excuse the shit formatting):
ifmove 0 ifp pfacing ifpdistl 1280 ifcansee move WAIT ifmove WAIT ifcount 30 action MYHOTACTION
#1965 Posted 30 May 2017 - 11:27 AM
This post has been edited by Mark.: 30 May 2017 - 11:37 AM
#1966 Posted 03 June 2017 - 12:37 PM
#1967 Posted 03 June 2017 - 01:06 PM
Perro Seco, on 03 June 2017 - 12:37 PM, said:
You can either have the player detect the type of projectile hitting him and reduce the damage when the owner of the projectile is not a player, or you can set the extra member on the projectile to a different amount after it is fired. The first option is not quite what you asked for, because the projectile would still do normal damage if an enemy shoots another enemy. So, focusing on the second option:
onevent EVENT_EGS ifspawnedby APLAYER nullop else { ifactor MYPROJECTILE strength 10 ifactor MYOTHERPROJECTILE strength 15 // etc. } endevent
If that doesn't work, try using setthisprojectile[].extra instead of strength.
#1968 Posted 04 June 2017 - 03:11 PM

#1969 Posted 04 June 2017 - 04:01 PM
Perro Seco, on 04 June 2017 - 03:11 PM, said:

I think you are confusing "strength" with "addstrength". Using negative values on "strength" should not work that way. In any case, what's going on here is that the .extra member of the projectile sprite, which stores damage, is being modified.
#1970 Posted 08 June 2017 - 05:44 AM
Drek, on 19 February 2017 - 12:46 PM, said:
Hello
I tried the script to open a door using an animated model. As a reminder, the closed door was a static model ("closed" position) while the next tile was defined as the same model with an animated opening.
The problem is when the model is switching to the next picnum to start the animation, the animation is not played but skips to the very last frame (completely opened).
As a result the door opens roughly anyway.
The behaviour is erratic because when I insisted on the door - opening & closing several times - it happens sometimes the animation is played (fluid opening),
and other times the animation goes "half-way". Is there some explanation or something to do ?
#1971 Posted 08 June 2017 - 10:03 AM
#1972 Posted 08 June 2017 - 12:09 PM
Trooper Dan, on 08 June 2017 - 10:03 AM, said:
#1973 Posted 08 June 2017 - 12:20 PM
David B., on 08 June 2017 - 12:09 PM, said:
That's what it's supposed to do when flags is set to 0, but I was just asking to confirm you can get the animation to display.
I'm beginning to think we may have an EDuke32 bug here. Like I said, I experienced a similar problem. It seems that in many instances, setting flags 1 on an animation will cause it to immediately skip to the last frame rather than play the whole thing.