
EDuke32 Scripting "CON coding help"
#324 Posted 16 September 2009 - 04:21 PM
This post has been edited by DeeperThought: 16 September 2009 - 04:22 PM
#325 Posted 19 September 2009 - 04:23 PM
ifai AIHTROTELEPORT { ifvarand status 4 nullop else { ifvare temprand 0 setvar temprand -1 addvar status 4 } whilevarn spritenum 16384 { getactor[spritenum].picnum picnum ifvare picnum EFFECTSPRITE { getactor[spritenum].lotag lotag2 getactor[spritenum].hitag hitag2 whilevarn arrayholder 128 { setarray container[arrayholder] lotag2 setvarvar arraycheck container[arrayholder] setarray container[arrayholder] hitag2 setvarvar arraycheck2 container[arrayholder] ifvarvarn temprand randomvar5 ifvarvare randomvar5 arraycheck ifvarvare arraycheck2 yvel2 { getactor[THISACTOR].x mx getactor[THISACTOR].y my getactor[THISACTOR].z mz getactor[spritenum].x x2 getactor[spritenum].y y2 getactor[spritenum].z z2 getactor[spritenum].sectnum mysector sound TELEPORTER espawn TRANSPORTERBEAM setactor[RETURN].x mx setactor[RETURN].y my setactor[THISACTOR].x x2 setactor[THISACTOR].y y2 ifvarn mysector -1 setactor[THISACTOR].sectnum mysector subvar z2 1024 setactor[THISACTOR].z z2 sound TELEPORTER espawn TRANSPORTERBEAM setactor[RETURN].x x2 setactor[RETURN].y y2 setvarvar temprand randomvar5 ai AIHTROSHOOT1 } addvar arrayholder 1 } } addvar spritenum 1 } }
I wanted my guy to teleport to one of the "hitag" amount of teleporters which it's yvel also checks. I place hitag amounts of these "dummy actors" to where I Want this guy to teleport, and give them lotags starting from 0 to hitag. This guy randomly picks one of them, and teleports to the corresponding lotag of the randomed number. The problem is, it only teleports to a fixed place, which is only 1.
I thought of the general issue first, and thought that it was the tags of effectors not being set, and only the last one. So, I decided to use arrays and increase each array by 1, so that it would check it; in a secondary while loop. I'm not sure if I'm overcomplicating things, or missing something so little again; but this is basically the first time I touched arrays :/ (The idea is like in Heretic's D'sparil fight, the wizard randomly teleports to one of the 4 fixed places)
This post has been edited by XThX2: 19 September 2009 - 04:23 PM
#326 Posted 19 September 2009 - 04:28 PM
#327 Posted 19 September 2009 - 04:32 PM
ifspritepal 0 { ifrnd 72 { ai AIHTROPAIN sound HTRO_PAIN } } else { ifrnd 64 { ai AIHTROPAIN sound HTRO_PAIN } else { setvar randomvar5 0 setvar arrayholder 0 setvar arrayholder2 0 randvarvar randomvar5 yvel2 setvar spritenum 0 ai AIHTROTELEPORT } }
#328 Posted 19 September 2009 - 04:40 PM
The normal procedure when dealing with sprites that aren't SEs or the other hardcoded effect actors, is to get their lotags and hitags into variables at map load time using the eventloadactor command. Then you set their lotag and hitag struct members to 0 to prevent nasty hardcoded effects and refer only to the variables from that point forward. In your code you are checking the struct members, not the variables. Are you sure that isn't a problem?
#329 Posted 19 September 2009 - 06:06 PM
#330 Posted 19 September 2009 - 07:35 PM
Nfelli64, on Sep 19 2009, 07:06 PM, said:
Look at this and read the note at the top that I just edited:
http://wiki.eduke32.com/wiki/Confaq42
To reposition the camera, you will need to change the values of the camera variables (e.g. cameraang) in a display event. You will have to learn a lot of stuff before you can do that competently.
#331 Posted 19 September 2009 - 07:50 PM
Quote
simple enough.
This post has been edited by Nfelli64: 19 September 2009 - 07:55 PM
#332 Posted 20 September 2009 - 03:46 PM
Any idea?
#333 Posted 20 September 2009 - 04:12 PM
#334 Posted 20 September 2009 - 09:20 PM
#335 Posted 26 September 2009 - 01:06 PM
I was playing the game and found out that some actors have this property such as CHAIR1, CHAIR2, vases, and even the slimer. When you shoot them, the pellets go through them when one hits them. I checked the source code for such things but couldn't find; so what I'm asking is if anyone can provide me information about how this can be done, or is done in the game ? (I'm hoping that it's not hard-coded for the first pellet hitting the object, then the rest going through)
#336 Posted 26 September 2009 - 01:21 PM
XThX2, on Sep 26 2009, 02:06 PM, said:
Well of course it is hardcoded. Otherwise it would be possible to add to any actor using 1.5 CON commands.
#337 Posted 26 September 2009 - 01:58 PM
#338 Posted 26 September 2009 - 03:47 PM
#339 Posted 26 September 2009 - 07:08 PM
#340 Posted 26 September 2009 - 10:47 PM
Mblackwell, on Sep 26 2009, 08:08 PM, said:
That's better than nothing, but it's not great.
The second bullet will have a random component to its angle, because there is still no way to modify ANGRANGE when fired from a non-player. Also, it would be hard to recover the vertical angle accurately. And what if the actor got hit by more than one bullet at the same time? There's no way to know that just from checking the actor. Plus, you don't even know where the bullet hit, and when the actor fires the new bullet it will shoot from its mid-section regardless.
A better source of information is the SHOTSPARK1 actor itself, when it spawns. You get the exact location that it hit, the angle it is facing, and by comparing its location relative to the player you can recover the vertical angle as well. Plus there is one such actor for each bullet, so there's no problem in knowing how many hit. But deciding whether the SHOTSPARK1 should fire a new bullet, and then doing so with the right results presents its own problems.
#341 Posted 26 September 2009 - 11:48 PM
I suppose it is possible, as it seems to affect gameplay (for example a blocking wall sprite, etc).
#342 Posted 27 September 2009 - 03:11 AM
DeeperThought, on Sep 26 2009, 11:47 PM, said:
The second bullet will have a random component to its angle, because there is still no way to modify ANGRANGE when fired from a non-player. Also, it would be hard to recover the vertical angle accurately. And what if the actor got hit by more than one bullet at the same time? There's no way to know that just from checking the actor. Plus, you don't even know where the bullet hit, and when the actor fires the new bullet it will shoot from its mid-section regardless.
A better source of information is the SHOTSPARK1 actor itself, when it spawns. You get the exact location that it hit, the angle it is facing, and by comparing its location relative to the player you can recover the vertical angle as well. Plus there is one such actor for each bullet, so there's no problem in knowing how many hit. But deciding whether the SHOTSPARK1 should fire a new bullet, and then doing so with the right results presents its own problems.
I thought it would be a lot of work to do as well, which would have bugs. Right now, there's nothing I can do but to find the way to provide the smallest delay of all. For one thing, I've tried ifvarn and it's not really fast. I also tried the htg_t of the actor, still not enough. I tried whilevarn at some point but it was too fast that they were being fired at the same time.
So, what can I do to provide an almost unnoticable delay between all 24 shots ? (Or per 4 shots for 6 tries, 3 for 8 and such)
#343 Posted 27 September 2009 - 03:47 AM
I am not sure how you could do it, but I have discovered something close to that.

There you can see the shots are at different angles. During EVENT_EGS I use SHOTSPARK1 to change the player angle. And the delay equal to zero.
===//===//===
What is the best way to simulate a multiplayer game? I heard you can do it through the console command, but I don't know how. =/
This post has been edited by Ilovefoxes: 27 September 2009 - 05:35 AM
#344 Posted 27 September 2009 - 07:23 AM
#345 Posted 27 September 2009 - 08:06 AM
Mblackwell, on Sep 27 2009, 08:23 AM, said:
EVENT_EGS code is executed immediately when something is spawned and then never again for that sprite. For example, in "espawn PIGCOP setactor[RETURN].pal 17" the EGS code runs right after the spawn and before the pal is set. Maybe you were thinking of EVENT_GAME?
#346 Posted 27 September 2009 - 08:11 PM
DeeperThought, on Sep 27 2009, 11:06 AM, said:
Yes.
#347 Posted 29 September 2009 - 06:30 AM
In the old Polymer thread started by DT, he said that he had actors spawn SECTOREFFECTORS and the actors controlled them.
I've just tried that but the very instant a SECTOREFFECTOR is spawned (or espawned) the game crashes with -found lonely sectoreffector at x y ..... So I had it spawn a dummy actor first, set its values then change its picnum to a SECTOREFFECTOR but then the game would er.. no crash but not work either. The game would "pause" all map present actors of all types except the player allowing me to wounder around a map in a photo like mode - taking screen shots of current scenes and events from different angles!
However any newly spawned actors would work as normal
It was interesting but not what I wanted.
Basically how would I have my own non hard coded light sources in game? I intend to have things like flame throwers, weapons and such which need to spawn a light source so I can't just hide them off map and move them into place.
#348 Posted 29 September 2009 - 06:53 AM
But first, about you changing an actor to SE, do you tryed to change te tags in EVENT_EGS?
For what I know, SEs have an special cstat assigned to them. Debug an map and check it.
This post has been edited by Ilovefoxes: 29 September 2009 - 06:53 AM
#349 Posted 29 September 2009 - 06:58 AM
Quote
No I did not! I'll try that.
#350 Posted 29 September 2009 - 07:01 AM
Chip, on Sep 29 2009, 07:30 AM, said:
That's the method I use. But you have to change the statnum to 3.
EDIT: And no, you do not have to use EVENT_EGS.
This post has been edited by DeeperThought: 29 September 2009 - 07:01 AM
#351 Posted 29 September 2009 - 07:39 AM
Anyway I did it through event_EGS (Which still to this day I keep thinking is only for weapons! - I've got to get out of that habbit) and so I can bypass dummyactors and just have event_GAME move the SE to where the spawner was.
#352 Posted 02 October 2009 - 11:16 AM
Quote
32156: 31337 {
32157: 1778 getactor 253 19 331 230 331 14
32164: 1780 divvarvar 331
32166: 4 guniqhudid 253 17
32169: 1781 cos 380
32171: 4 guniqhudid 253 15
32174: 1782 sin 381
32176: 4 guniqhudid 253 15
32179: 1783 hitscan
32180: 4 guniqhudid 253 0
32183: 4 guniqhudid 253 1
32186: 4 guniqhudid 253 2
32189: 4 guniqhudid 253 13 380 381 331current actor: 524 (2605)
g_errorLineNum: 0, g_tw: 381
#353 Posted 03 October 2009 - 12:45 PM
Statnum only affects the APLAYER actor, not the player itself.
Constantly setting actor[].extra to zero works for single player, but not multiplayer as I cannot "ressurect" the player later.
Commands such as lockplayer only stop looking or moving around, isn't effective for making an intermission screen or something else.
This post has been edited by Ilovefoxes: 03 October 2009 - 12:52 PM