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

Jump to content

  • 124 Pages +
  • « First
  • 78
  • 79
  • 80
  • 81
  • 82
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Hank 

#2364

 December Man, on 01 October 2018 - 02:22 PM, said:

I think what the wiki really needs are examples of using functions, events etc. within code. In zDoom wikia there are action functions:

https://zdoom.org/wi...ction_functions

Notice that each one has an example of how to use it within the code, even if they seem redundant at times. There are a few exceptions with no examples, but these have this note added:

Furthermore, many new functions e.g. events have no pages added. Notice how many hyperlinks are red here:

https://wiki.eduke32...wiki/Event_list

I guess I can assume which some of them do, but having clear verified info about it would save a lot of time.

 Mark, on 01 October 2018 - 03:04 PM, said:

https://wiki.eduke32...ctivatebysector

This is a good example of what I was up against early in my con code learning. There are many just like this.

The command seems very simple. Fill in a number for a sector and a sector tag. But where do I get those numbers from? It can't be as easy as taking the sector number shown in Mapster because those numbers are dynamic and can change. That leads me to believe there are more con commands that need to be included to get those 2 numbers to enter and to make use of the command. If so, the wiki should explain it right there and provide a small example.

Looks to me you guys just volunteered to update that wiki.

Just ask questions here, and once settled, add to the wiki. :rolleyes:

This post has been edited by Hank: 01 October 2018 - 03:21 PM

1

User is offline   Forge 

  • Speaker of the Outhouse

#2365

 Hendricks266, on 01 October 2018 - 03:08 PM, said:

Forking is not the solution. It's one of the situations where the adage "...now you have two problems" applies.

I wouldn't call it forking. I would all it rolling out a new model and not worrying about backwards compatibility.

This post has been edited by Forge: 01 October 2018 - 03:21 PM

0

User is offline   Mark 

#2366

Hank: Somebody would have to keep me in check. There is a good chance I could become "the blind leading the blind" by posting wrong info. I noticed a number of times that when I was working with Mblackwell on my projects I would code something that worked but may not have been the "proper" way to do it. I don't want to pass on my bad habits.

This post has been edited by Mark: 01 October 2018 - 03:27 PM

0

User is offline   Forge 

  • Speaker of the Outhouse

#2367

 Hank, on 01 October 2018 - 03:20 PM, said:

Looks to me you guys just volunteered to update that wiki.

Just ask questions here, and once settled, add to the wiki. :rolleyes:

second that motion. take it to a vote.


 Mark, on 01 October 2018 - 03:25 PM, said:

Hank: Somebody would have to keep me in check. There is a good chance I could become "the blind leading the blind" by posting wrong info.

wrong info can be updated and fixed. it's a start.

This post has been edited by Forge: 01 October 2018 - 03:26 PM

0

User is offline   Mark 

#2368

Yeah, but I'll look stupid. :rolleyes:
1

User is offline   Forge 

  • Speaker of the Outhouse

#2369

 Mark, on 01 October 2018 - 03:29 PM, said:

Yeah, but I'll look stupid. :rolleyes:

too late :P

there's more than one way to get results in script.
same as making a sloped sector in mapster - depends on which wall is the first wall. Opposite opposing walls of equal angles get the same result & both ways can be explained.

This post has been edited by Forge: 01 October 2018 - 03:34 PM

1

User is offline   Mark 

#2370

But some ways are more time efficient than others.

An example popped into my head. In Mapster I made it so a sound plays when the player enters a certain sector. Later on I wanted some more stuff to happen at the same time. I had recently looked in the wiki about game events. I decided to use an event to watch for when that sound played and then run my little block of code. It worked fine but for reasons I have forgotten, I was told it wasn't the proper way to accomplish my goal. So I'm afraid of putting more of that kind of thing in the wiki.

This post has been edited by Mark: 01 October 2018 - 03:50 PM

1

User is offline   Danukem 

  • Duke Plus Developer

#2371

View PostForge, on 01 October 2018 - 03:17 PM, said:

there should be - nuances and all.
It's something a lot of first time script modders aspire to do. That and new enemies. Modified huds and equipment items are probably high on the wish-list as well.


I feel somewhat responsible for this, especially since I started a tutorial on making new enemies and then didn't finish it (although I still could). I have two excuses, and neither of them is very good. The first excuse is that time spent writing the tutorial is coming straight out of the time I would otherwise be spending getting a project closer to release (recently that has been AA and now an AA update). The second excuse is that, with both enemies and weapons, it's better for the tutorial if it's as generic as possible. But I'm not interested in making generic enemies and weapons. So I would have to make a special, more generic enemy or weapon just for the purpose of the tutorial.

The reason why non-generic is bad is it always involves bringing in techniques and features that will be confusing as hell to someone trying to learn. If you look at the aforementioned enemy tutorial that I stopped working on, that was pretty much the reason. It was getting to the part on the cyber-enforcer where I would have to explain how to make it jump from long distance onto its target.
0

User is offline   Forge 

  • Speaker of the Outhouse

#2372

View PostMark, on 01 October 2018 - 03:36 PM, said:

But some ways are more time efficient than others.

technically you won't be 'wrong', or 'stupid'. Just inefficient.
Inefficient is better than none.
Again. the information can be updated.

Posted Image
0

User is offline   Forge 

  • Speaker of the Outhouse

#2373

View PostTrooper Dan, on 01 October 2018 - 03:38 PM, said:

The reason why non-generic is bad is it always involves bringing in techniques and features that will be confusing as hell to someone trying to learn.

Start with the base generic script
make an advanced section and update sporadically when it's convenient or a question gets answered.
0

User is offline   Mark 

#2374

I didn't realize a new page started. I added to my post on the previous page. DUH.
0

User is offline   Forge 

  • Speaker of the Outhouse

#2375

View PostMark, on 01 October 2018 - 03:54 PM, said:

I didn't realize a new page started. I added to my post on the previous page. DUH.

If you don't want to do it, don't do it. Nobody else is stepping up, so you're in good company.
1

User is offline   Micky C 

  • Honored Donor

#2376

View PostHendricks266, on 01 October 2018 - 01:18 PM, said:

I don't consider the current state of CON coding functionality to be sufficient for new users to learn easily. Everything is bespoke and ad hoc to the extreme. About the only good ways to learn how to do things are to look at existing code or to ask publicly and have it spoonfed to you. Even then, you end up with every mod having its own versions of boilerplate like weapon drawing functions that can never be modified by improved source port development without updating the mod, and which require the source port to painfully maintain old, flawed ways of doing things.


Was Lua meant to be the solution? Helixhorned gave the impression that it was going to be a sort of clean slate for coding, in addition to the con system.

If so, would that system be worked on and finished at some point?

This post has been edited by Micky C: 01 October 2018 - 04:31 PM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #2377

View PostMicky C, on 01 October 2018 - 04:31 PM, said:

Was Lua meant to be the solution? Helixhorned gave the impression that it was going to be a sort of clean slate for coding, in addition to the con system.

If so, would that system be worked on and finished at some point?

Lunatic was fundamentally misplaced. Helixhorned wanted to rewrite Duke 3D's game logic in Lua, and Lua would suck for that purpose. It's on the to-do list to torch all of Lunatic except the language bindings.
0

User is offline   MusicallyInspired 

  • The Sarien Encounter

#2378

I was wondering why nothing was happening with Lunatic and nobody was using it.
0

User is offline   Zaxtor 

#2379

Is there such a code to make a "kill tile" for monsters.

Like for duke, purplelava, ordinarylava, slime hurts you.

but is there a code to make if a monster walks into a sector(number) or floor tile(number) it kills them etc?

So I can make if a monster falls into the lava (accidentally) or etc, they die
0

User is offline   Mblackwell 

  • Evil Overlord

#2380

Yes, within an actor's code get/setsector[THISACTOR] will be the sector the current actor is standing in. So:
iffloordistl 1 // if on the ground
{
    getsector[THISACTOR].floorpicnum TEMP // the sector's floor tile
    ifvare TEMP MYHURTTILE // MYHURTILE should be whatever tile number you want to hurt the enemy
    {
        getactor[THISACTOR].extra TEMP // extra is enemy health
        ifvarg TEMP 0
            subvar TEMP 1
        setactor[THISACTOR].extra TEMP
    }
}


would probably do it for a quick and dirty version.
1

User is offline   Danukem 

  • Duke Plus Developer

#2381

I don't think that will trigger monster death, though, since "ifdead" checks are typically inside of "ifhitweapon" checks. This might work better for the damage code:

setactor[THISACTOR].htextra 1
setactor[THISACTOR].htpicnum MYHURTILE 


Setting htpicnum isn't really necessary, but it could be useful because it will make ifwasweapon return the lava picnum.
0

User is offline   Zaxtor 

#2382

It works.
Actor died when he gets (near the killable floor) diff height or not. (like in red line or between the 2 sectors). so translated, he dies without touching the lavafloor except if he flies over it.
lavasector is a mask based floor (one seen in the pics I posted on the thread of my map im working on)

So I changed it into "getsector[THISACTOR].ceilingpicnum TEMP"

and tile numb in var below etc
And when he falls inside the killable sector (lava sector with lava ceiling) he dies cuz of the "hurtable ceiling" inside the lava sector.

This post has been edited by Zaxtor: 01 October 2018 - 10:11 PM

0

#2383

View PostHank, on 01 October 2018 - 03:20 PM, said:

Looks to me you guys just volunteered to update that wiki.

Just ask questions here, and once settled, add to the wiki. :rolleyes:


That'd be great... if I knew what these events even do.
0

#2384

DELETED

This post has been edited by thisbecasper: 03 October 2018 - 09:32 AM

0

User is offline   Perro Seco 

#2385

View PostTrooper Dan, on 30 September 2018 - 03:18 PM, said:

I think some people get caught up on the convenience of the vending machine and never learn how to cook. If you are making a mod that has non-trivial coded features, you should learn how to cook.
Hey, you talking to me? I'm a professional chef and glasses of water are my speciality. :rolleyes:

View PostTrooper Dan, on 29 September 2018 - 06:59 AM, said:

As for why it's not working when you set posx and posy, it could be because you aren't setting the sector but I think it's more likely something else which is blocking your attempt. The first thing I would check is make sure that Lezing's bike code is not setting the player's coords at that point, since it could be overriding your attempt. Also, you should verify 100% that you have calculated the new coordinates correctly. You can do a visual confirmation by espawning a sprite there and setting it to those coordinates; do so in F7 view mode so that you can see it in game and verify it is in the right place.
Thank you for your help. You were right, I was changing the player's position and sector correctly, but below there were some lines interfering with the operation. However, I found a problem when changing posx and posy: the player can be moved through invisible blocking walls.

But I found another way to do it: spawning two invisible sprites when the player exits the car and moving one to the left and the other to the right. If one of them hits a wall, I delete it, and then I set the player position to one of those sprites, preferably to the left unless the sprite was deleted.
1

#2386

In my zombies I use randvar to randomly generate loot and powerups. It has been working fine for a long time but recently I think it's causing more and more desyncs (net_randomsynccheck out of sync). Is there a safe alternative to generate a random number used in multiplayer, or do you guys know other things that can cause desyncs without it being mentioned in the wiki?
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2387

Randvar is supposed to be the multiplayer-safe way to get random numbers. The unsafe versions are called displayrand*. The issue may be that you are calling it different numbers of times on different hosts.
1

#2388

View PostHendricks266, on 07 October 2018 - 10:43 AM, said:

Randvar is supposed to be the multiplayer-safe way to get random numbers. The unsafe versions are called displayrand*. The issue may be that you are calling it different numbers of times on different hosts.

In 5 out of 6 places it is used in newbeastcode when they die. The sixth place is when one player gets revived by another, then he calls randvar and uses it to speak a random line (is that what you mean by one duke calling it different amount of times than another, in one tick?) Or else I'm afraid you'll have to elaborate what you mean with "different hosts". Very helpful response indeed!

This post has been edited by thisbecasper: 07 October 2018 - 11:27 AM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #2389

I would recommend adding the "addlog" command immediately before every randvar, and then comparing the eduke32.log of two players who go out of sync.
0

#2390

View PostHendricks266, on 07 October 2018 - 11:31 AM, said:

I would recommend adding the "addlog" command immediately before every randvar, and then comparing the eduke32.log of two players who go out of sync.

Great idea! Before though? Wouldn't it desync if the randvar is different between two players right after it is set and used?
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2391

Hmm, I was thinking "addlog" as in just tracking the positions of calls that are made, but "addlogvar" of the resulting value after the randvar call could not hurt and might provide further information.
1

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#2392

View Postthisbecasper, on 07 October 2018 - 08:32 AM, said:

In my zombies I use randvar to randomly generate loot and powerups. It has been working fine for a long time but recently I think it's causing more and more desyncs (net_randomsynccheck out of sync). Is there a safe alternative to generate a random number used in multiplayer, or do you guys know other things that can cause desyncs without it being mentioned in the wiki?

Can you post the code?
0

User is offline   Mark 

#2393

I want to have an enemy that when you get close will either ( do something ) if the player is not holding any weapon or will ( do something else ) if they are holding any weapon. How do I have that enemy detect if the player is holding a weapon?

This post has been edited by Mark: 09 October 2018 - 11:49 AM

0

Share this topic:


  • 124 Pages +
  • « First
  • 78
  • 79
  • 80
  • 81
  • 82
  • 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