EDuke32 Scripting "CON coding help"
#1921 Posted 31 January 2017 - 09:06 PM
#1922 Posted 01 February 2017 - 04:13 AM
If I knew how, I would add that info to the wiki.
This post has been edited by Mark.: 01 February 2017 - 04:42 AM
#1923 Posted 02 February 2017 - 07:57 PM
This post has been edited by Gambini: 02 February 2017 - 08:26 PM
#1924 Posted 02 February 2017 - 09:10 PM
define JETSKI 5440 define JETSKISHOOT 5441 define JETSKI_DRIVER 5446 spritenvg JETSKI spritenvg JETSKI_DRIVER spriteshadow JETSKI //JETSKI define JETSKISTRENGTH 150 action JETSKISTAND 0 1 1 action JETSKIRUN 0 1 1 action JETSKISHOOT 0 2 1 4 action JETSKI_DRIVERSTAND 0 1 5 move JETSKIRUNVEL 150 move JETSKISTOP ai AIJETSKIGETENEMY JETSKIRUN JETSKIRUNVEL seekplayer ai AIJETSKISHOOTENEMY JETSKIRUN JETSKIRUNVEL faceplayer useractor notenemy JETSKI_DRIVER 0 ifvarn target -1 { ifvare actorvar[target].peractor1 -1 killit sizeat 40 40 getactor[target].z z action JETSKI_DRIVERSTAND cstat 0 setsprite THISACTOR sprite[target].x sprite[target].y z setangle THISACTOR [target].ang } enda useractor enemy JETSKI JETSKISTRENGTH fall ifaction 0 { fall sizeat 58 58 action JETSKIRUN cstat 257 espawn JETSKI_DRIVER setactorvar[RETURN].target THISACTOR setvarvar peractor1 RETURN } ifmove 0 move JETSKIRUNVEL faceplayer enda
This post has been edited by Gambini: 02 February 2017 - 09:11 PM
#1925 Posted 02 February 2017 - 09:24 PM
ifvarn target -1
{
ifvare actorvar[target].peractor1 -1 killit
sizeat 40 40
getactor[target].z z
action JETSKI_DRIVERSTAND
cstat 0
setsprite THISACTOR sprite[target].x sprite[target].y z
setactor[THISACTOR].ang sprite[target].ang
}
enda
#1926 Posted 02 February 2017 - 09:28 PM
#1927 Posted 02 February 2017 - 10:11 PM
Mblackwell, on 02 February 2017 - 09:28 PM, said:
He copied the code from a different actor where it made sense to have that line. I think it was code I wrote that had an enemy spawning a force field or something similar. There were other parts to it which didn't get copied. I left it in my edit because it wasn't related to the angle issue and it could become relevant later if more code is added.
#1928 Posted 03 February 2017 - 05:04 PM
Yes I based most of this by looking at code of actors that behaved similar to what i wanted. The driver (or attached sprite) is the tentacles code of the EDF troopers, i removed the pal specific lines but didn´t touch that ifvare actorvar[target].peractor1 -1 killit because i dont have a clue of what it is.
#1929 Posted 17 February 2017 - 07:38 PM
#1930 Posted 17 February 2017 - 09:10 PM
Mark., on 17 February 2017 - 07:38 PM, said:
http://wiki.eduke32....i/WEAPONx_FLAGS
orvar 256 on the weapon#_flags corresponding to the weapon
#1931 Posted 18 February 2017 - 04:09 AM
// NO GLOBAL FLASH WHEN FIRING PISTOL SHOTGUN CHAINGUN
onevent EVENT_RESETWEAPONS
setvarvar gs WEAPON1_FLAGS
setvarvar gs WEAPON2_FLAGS
setvarvar gs WEAPON3_FLAGS
orvar gs 256
setvarvar WEAPON1_FLAGS gs
setvarvar WEAPON2_FLAGS gs
setvarvar WEAPON3_FLAGS gs
endevent
EDIT: CODE PRODUCED A GLITCH. DO NOT USE AS-IS
This post has been edited by Mark.: 18 February 2017 - 08:25 AM
#1932 Posted 18 February 2017 - 06:31 AM
http://wiki.eduke32.com/wiki/Gs
#1933 Posted 18 February 2017 - 06:45 AM
Mark., on 18 February 2017 - 04:09 AM, said:
// NO GLOBAL FLASH WHEN FIRING PISTOL SHOTGUN CHAINGUN
onevent EVENT_RESETWEAPONS
setvarvar gs WEAPON1_FLAGS
setvarvar gs WEAPON2_FLAGS
setvarvar gs WEAPON3_FLAGS
The var can only store one value at a time, so it's equal to WEAPON3_FLAGS as of that last line...
#1934 Posted 18 February 2017 - 07:57 AM
EDIT: It works as intended removing the flash but it messed up the firing making those 3 weapons rapid fire like the chaingun. I'll have to also check to see if it affected Graveyard in the same way. Nobody ever reported the issue.... No rapid firing pistol or shotgun in Graveyard but I did not have the chaingun in it's noflash con. If I remove the noflash for weapon3, the chaingun, firing sequence goes back to normal for the pistol and shotgun while still keeping the noflash for those 2.
So I guess it will noflash for just those 2. I can live with that if no other glitches show up.
This post has been edited by Mark.: 18 February 2017 - 08:28 AM
#1935 Posted 18 February 2017 - 09:46 AM
I suppose it's the right thread to post that question, so is there any way to control an animated 3d model with the 'use' key ?
What I mean is a 3d model which starts its animation forward or backward each time the player presses the "use" key when looking at it : for example an animated switch, a valve wheel or a door.
Does anyone think it's possible - and possibly knows the way one could do that ?
#1936 Posted 18 February 2017 - 12:40 PM
There are other ways including con coding with the "ifhitspace" command which detects when the use key is pressed. But the above does not require con code. Just def'ing in the new model to replace the old.
This post has been edited by Mark.: 18 February 2017 - 12:47 PM
#1937 Posted 18 February 2017 - 12:56 PM
Mark., on 18 February 2017 - 07:57 AM, said:
Yes, for the reason I pointed out in my post immediately above yours. You used the chaingun value to set all 3 weapons.
#1938 Posted 18 February 2017 - 04:40 PM
#1939 Posted 18 February 2017 - 04:51 PM
Mark., on 18 February 2017 - 04:40 PM, said:
You aren't even using gs as the engine gun shade variable. You may as well replace it with a temp var. You are just storing the weapon flag value there then orvaring it. You should do the orvar once per weapon.
onevent EVENT_RESETWEAPONS setvarvar temp WEAPON1_FLAGS orvar temp 256 setvarvar WEAPON1_FLAGS temp setvarvar temp WEAPON2_FLAGS orvar temp 256 setvarvar WEAPON2_FLAGS temp setvarvar temp WEAPON3_FLAGS orvar temp 256 setvarvar WEAPON3_FLAGS temp endevent
Posted from my phone sorry in advance for any errors.
#1940 Posted 18 February 2017 - 05:00 PM
David B., on 18 February 2017 - 09:46 AM, said:
I suppose it's the right thread to post that question, so is there any way to control an animated 3d model with the 'use' key ?
What I mean is a 3d model which starts its animation forward or backward each time the player presses the "use" key when looking at it : for example an animated switch, a valve wheel or a door.
Does anyone think it's possible - and possibly knows the way one could do that ?
Yes. I have made working door models.
1 the models work best with clip shape maps for blocking IMO
2 ifhitspace is the con command you'll want to use
3 I made two states one was advance a tile num, the other subtracted one from the picnum
4 like in defs.con define two tiles as your model states aka open/closed
5 like in game.con write code for each state of the model to switch picnum to opposite state if it detects hitspace
6 add sounds via soundonce con code
Good luck feel free to ask more or for clarification.
#1941 Posted 18 February 2017 - 07:24 PM
#1942 Posted 19 February 2017 - 12:46 PM
David B., on 18 February 2017 - 09:46 AM, said:
Drek, on 18 February 2017 - 05:00 PM, said:
I found the old project and copied out the code for reference.
#1943 Posted 21 February 2017 - 09:57 AM
Drek, on 19 February 2017 - 12:46 PM, said:
That's great, thanks. In fact I have never made a script and I didn't know how to begin.
Well I'm not very skilled in coding.
I'm wondering how the door is animated when it's closing.
And also why there is a counter to 32.
This post has been edited by David B.: 21 February 2017 - 10:47 AM
#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