Duke4.net Forums: EDuke32 Scripting - Duke4.net Forums

Jump to content

  • 120 Pages +
  • « First
  • 63
  • 64
  • 65
  • 66
  • 67
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Mblackwell 

  • Evil Overlord

#1921

angoff is Build values so 0-2047, positive or negative. Positive is clockwise. 512 is 90 degrees.
1

User is offline   Mark 

#1922

AHA. So I was using the command right but didn't go high enough with the values. It was a case of me assuming wrongly that it would have been either -128 to +128 or 0-255. I never entered anything outside that range. Thanks.

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

0

User is offline   Gambini 

#1923

nevermind, got it working!!

This post has been edited by Gambini: 02 February 2017 - 08:26 PM

0

User is offline   Gambini 

#1924

I did this, which spawns a driver on my jetskies and then it follows the player around (it´s a placeholder so we can start working on the level) but i can´t get the driver (5 angled sprite) retain the jetski (model) angle. the driver follows the jetski and all but it always points north. Any idea how to do it?

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

0

User is offline   Danukem 

  • Duke Plus Developer

#1925

I'm not sure how you are getting that to compile, since there is no such command as "setangle" but try this change:

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
1

User is offline   Mblackwell 

  • Evil Overlord

#1926

Why would you need to killit if peractor1 is -1? Based on your code it will never be -1.
0

User is offline   Danukem 

  • Duke Plus Developer

#1927

View PostMblackwell, on 02 February 2017 - 09:28 PM, said:

Why would you need to killit if peractor1 is -1? Based on your code it will never be -1.


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.
2

User is offline   Gambini 

#1928

Thanks a lot! That setangle line was a blind shot trying to fix the problem, the code compiled alright without it.

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.
0

User is offline   Mark 

#1929

I used it a couple of years ago but I can't seem to find now the snippet of code to disable global screen flash when firing a weapon.
0

User is offline   Danukem 

  • Duke Plus Developer

#1930

View PostMark., on 17 February 2017 - 07:38 PM, said:

I used it a couple of years ago but I can't seem to find now the snippet of code to disable global screen flash when firing a weapon.


http://wiki.eduke32....i/WEAPONx_FLAGS

orvar 256 on the weapon#_flags corresponding to the weapon
1

User is offline   Mark 

#1931

Thanks for steering me in the right direction. In case anyone else wants to use it.
// 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

0

User is offline   Mblackwell 

  • Evil Overlord

#1932

Not sure you want to use gs there, if it works it works but don't be surprised if something breaks at some point:
http://wiki.eduke32.com/wiki/Gs
0

User is offline   Danukem 

  • Duke Plus Developer

#1933

View PostMark., on 18 February 2017 - 04:09 AM, said:

Thanks for steering me in the right direction. In case anyone else wants to use it.
// 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...
0

User is offline   Mark 

#1934

Thats copy pasted from my Graveyard mod where everything "seemed" to be fine. I pasted it in my ongoing project and at first glance it seems to be working. I'll double check.

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

0

User is offline   David B. 

#1935

Hello everybody,

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 ?
0

User is offline   Mark 

#1936

I'm not sure of actual tile numbers, this is just an example. Use an existing switch that has tile 100 for open and tile 101 for close. Your animated switch model has 8 frames. 1 - 4 moving the valve wheel clockwise and 5-8 moving the wheel counter clockwise. In the defs you would assign frames 1-4 for tile 100 and 5-8 for tile 101.

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

0

User is offline   Danukem 

  • Duke Plus Developer

#1937

View PostMark., on 18 February 2017 - 07:57 AM, said:

EDIT: It works as intended removing the flash but it messed up the firing making those 3 weapons rapid fire like the chaingun.


Yes, for the reason I pointed out in my post immediately above yours. You used the chaingun value to set all 3 weapons.
0

User is offline   Mark 

#1938

I assumed wrongly that my code would have no effect on firing timing because gs had nothing to do with that. Live and learn.
0

User is offline   Kyanos 

#1939

View PostMark., on 18 February 2017 - 04:40 PM, said:

I assumed wrongly that my code would have no effect on firing timing because gs had nothing to do with that. Live and learn.

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.
1

User is offline   Kyanos 

#1940

View PostDavid B., on 18 February 2017 - 09:46 AM, said:

Hello everybody,

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.
1

User is offline   Mark 

#1941

Thanks Drek. It worked but you forgot the all important first line. gamevar temp 0 0. Luckily I knew just enough about cons to add that in. :P
1

User is offline   Kyanos 

#1942

View PostDavid B., on 18 February 2017 - 09:46 AM, said:

is there any way to control an animated 3d model with the 'use' key ?

View PostDrek, on 18 February 2017 - 05:00 PM, said:

Yes. I have made working door models.



I found the old project and copied out the code for reference.

Spoiler

2

User is offline   David B. 

#1943

View PostDrek, on 19 February 2017 - 12:46 PM, said:

I found the old project and copied out the code for reference.



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

0

User is offline   Kyanos 

#1944

It just slammed shut. It was wip.

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.
0

User is offline   David B. 

#1945

View PostDrek, on 21 February 2017 - 11:23 PM, said:

It just slammed shut. It was wip.

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)
0

User is offline   Kyanos 

#1946

View PostDavid B., on 23 February 2017 - 04:55 AM, said:

Otherwise is it possible to make directly rotate a sprite by 90° only with a script ?
(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.
0

User is offline   Zaxtor 

#1947

Found an extremely simple trick to make some sprites go "through TROR" when normally they would stop at the "top" of a TROR. I talk about TROR with no ceiling.
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)

4

User is offline   Mark 

#1948

Is there a way to preset the x,y,or zvel in an actor's code so that when it spawns it will have that value set?
0

User is offline   Kyanos 

#1949

Yes a few ways and different places to do it depending on what it is you're trying to accomplish.

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 ###
0

#1950

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

1

Share this topic:


  • 120 Pages +
  • « First
  • 63
  • 64
  • 65
  • 66
  • 67
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options