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

Jump to content

  • 124 Pages +
  • « First
  • 49
  • 50
  • 51
  • 52
  • 53
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Anvil 

#1495

I've found the code I've been looking for:

View PostHendricks420, on 17 June 2013 - 11:15 PM, said:

gamevar temp 0 0

onevent EVENT_ENTERLEVEL
getplayer[THISACTOR].i temp
setactor[temp].extra MAXPLAYERHEALTH
setplayer[THISACTOR].shield_amount 0
setplayer[THISACTOR].gotweapon PISTOL_WEAPON 1
setplayer[THISACTOR].gotweapon SHOTGUN_WEAPON 0
setplayer[THISACTOR].gotweapon CHAINGUN_WEAPON 0
setplayer[THISACTOR].gotweapon RPG_WEAPON 0
setplayer[THISACTOR].gotweapon HANDBOMB_WEAPON 0
setplayer[THISACTOR].gotweapon SHRINKER_WEAPON 0
setplayer[THISACTOR].gotweapon DEVISTATOR_WEAPON 0
setplayer[THISACTOR].gotweapon TRIPBOMB_WEAPON 0
setplayer[THISACTOR].gotweapon FREEZE_WEAPON 0
setplayer[THISACTOR].gotweapon GROW_WEAPON 0
setplayer[THISACTOR].ammo_amount PISTOL_WEAPON 48
setplayer[THISACTOR].ammo_amount SHOTGUN_WEAPON 0
setplayer[THISACTOR].ammo_amount CHAINGUN_WEAPON 0
setplayer[THISACTOR].ammo_amount RPG_WEAPON 0
setplayer[THISACTOR].ammo_amount HANDBOMB_WEAPON 0
setplayer[THISACTOR].ammo_amount SHRINKER_WEAPON 0
setplayer[THISACTOR].ammo_amount DEVISTATOR_WEAPON 0
setplayer[THISACTOR].ammo_amount TRIPBOMB_WEAPON 0
setplayer[THISACTOR].ammo_amount FREEZE_WEAPON 0
setplayer[THISACTOR].ammo_amount GROW_WEAPON 0
setplayer[THISACTOR].boot_amount 0
setplayer[THISACTOR].firstaid_amount 0
setplayer[THISACTOR].heat_amount 0
setplayer[THISACTOR].holoduke_amount 0
setplayer[THISACTOR].jetpack_amount 0
setplayer[THISACTOR].scuba_amount 0
setplayer[THISACTOR].steroids_amount 0
endevent


1

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1496

I would recommend to use EVENT_RESETPLAYER instead since it's syncronized.
0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#1497

What is the correct way to display models on screen.
I was trying to use rotatesprite in DISPLAYREST but it just displays the dummy tile.

This post has been edited by The Angry Kiwi: 27 August 2014 - 05:13 AM

0

User is offline   Mblackwell 

  • Evil Overlord

#1498

http://wiki.eduke32...._Language#model

Look under hud.
0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#1499

Thank you kind sir.
0

User is offline   Mblackwell 

  • Evil Overlord

#1500

You are quite welcome!
0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#1501

Now to work out how to set the addang to some sort of var so that I can rotate it constantly.
... Why can't we use CON variables in Def...

This post has been edited by The Angry Kiwi: 27 August 2014 - 06:59 PM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #1502

View PostThe Angry Kiwi, on 27 August 2014 - 06:58 PM, said:

... Why can't we use CON variables in Def...

It's a content definition markup language, not a scripting language.
0

User is offline   Mark 

#1503

As usual, without an example to look at in the Wiki I can't figure out how to do the following...

I need to stop sound numbers 494 and 496 when the player enters sector number 162. I have multiple maps that have sector number 162 but the 2 sounds to stop will only be playing in 1 of the maps so I don't have to worry about that part. I see the stopsound command in the Wiki but I don't know how to use the getsector command or whatever else will be needed for sector detection and pass it along to the stopsound command.
0

User is offline   Danukem 

  • Duke Plus Developer

#1504

View PostMark., on 14 September 2014 - 08:33 AM, said:

As usual, without an example to look at in the Wiki I can't figure out how to do the following...

I need to stop sound numbers 494 and 496 when the player enters sector number 162. I have multiple maps that have sector number 162 but the 2 sounds to stop will only be playing in 1 of the maps so I don't have to worry about that part. I see the stopsound command in the Wiki but I don't know how to use the getsector command or whatever else will be needed for sector detection and pass it along to the stopsound command.


I don't think it's a good idea to have specific sector numbers in your code. The number could change (e.g. if you deleted the sector and then re-created it because of a problem with the map) and then the code wouldn't work.

There are several different ways of doing what you want. You could place a sprite in the sector which is coded to stop the sounds, for example. Something like this:

useractor notenemy SOUNDSTOPPER 0

ifvarvare sprite[THISACTOR].sectnum player[THISACTOR].cursectnum
{
  stopsound 494 
  stopsound 496
}
enda


Obviously you have to define "SOUNDSTOPPER" as some tile number and then place the tile in the sector. You might also want to make it invisible (either in mapster or using code). And if you want the sounds to be able to play while the player is in that sector but after he arrives, then you would need a little more code to make that distinction. There might be a problem with the actor not waking up fast enough and the sounds starting to play -- make sure that the actor is in line of sight to the player before he enters the sector.
1

User is offline   Mark 

#1505

Sounds like it should work. I'll give it a try when I'm done snacking on my delicious cheese and crackers. :)
0

User is offline   Mark 

#1506

It works fine. It would be great if the sounds faded instead of shutting off abruptly, but it gets the job done and made the affected area much easier to hear the other softer backround sounds.

It was a problem at first until I realised I gave you 494 and 496 instead of the actual 394 and 396 :)

edit: If there is an easy addition to the previous code to put a delay of a few seonds before shutting down the sounds I could time it to the autoclosing of the doors to that area. Otherwise maybe its possible through the use of a touchplate and masterswitch with delay to spawn the new soundstopper sprite? No, there would be a chance the player moves out of that sector before the actor spawns.

This post has been edited by Mark.: 14 September 2014 - 10:26 AM

0

User is offline   Danukem 

  • Duke Plus Developer

#1507

I kept it simple for you, but if you want the sounds to play until the doors close, then the actor could be coded to detect the activation that causes the door to close, then stop sounds after an appropriate amount of time. If you want to just time it without detecting the activation and hope for the best, then do this:

useractor notenemy SOUNDSTOPPER 0

ifvarvare sprite[THISACTOR].sectnum player[THISACTOR].cursectnum
{
  ifcount 60 // or whatever count you want
  {
  stopsound 394 
  stopsound 396
  }
}
else resetcount
enda


I'm assuming that the player is not going to leave the sector before the actor gets a chance to stop the sounds.

This post has been edited by Trooper Dan: 14 September 2014 - 12:01 PM

0

User is offline   Mark 

#1508

This should work because after entering the doors and the sector, the player is presented with differing scenarios on the left and the right. They will probably stay put for a couple of seconds before choosing which way to go.
0

User is offline   Zaxtor 

#1509

Question about ifcount, how to reset one without reseting another ifcount?
a thing that has 2 ifcount inside same area of the sprite

I'm trying to make a not too complicated sprite.

If you make "ifcount xx { does something resetcount }
It will reset the ifcount after it "does something" to avoid spam by doing it excessively fast.

But my useractor has 2 ifcounts.

Example.

useractor notenemy SPRITENAME

ifcount 2 { "does something" resetcount } <----(ok so reset is to reset this one )
ifcount 200 { killit } <----( sprite expires after about 7 seconds. )

enda


Problem is inside the ifcount 2 when reset it will reset the ifcount 200 too.

So how to I make so it only reset the ifcount 2 without touching the ifcount 200?
I've tried "else", no working.
0

User is offline   Jblade 

#1510

Make a new game variable, like this:

gamevar INTERNAL_COUNT 0 2

then inside your sprite, do something like this:
ifvarl INTERNAL_COUNT 200
addvar INTERNAL_COUNT 1
else killit

That's pretty bare basic code but it'll work.
1

User is offline   Zaxtor 

#1511

It works thx.
0

User is offline   Zaxtor 

#1512

Is there a code to put a delay / cool down when firing a weapon.

Example weapon 10 (weapon0) fires extremely fast.
Is there a code to slow it down, slow down the firing speed?
not the projectile speed but the delay each time it fires.

This post has been edited by Zaxtor: 06 October 2014 - 06:55 AM

0

#1513

View PostZaxtor, on 06 October 2014 - 06:55 AM, said:

Is there a code to put a delay / cool down when firing a weapon.


Lol, I thought you've found the way. All the hard-coded weapon properties are pre-defined game variables (http://wiki.eduke32....efined_gamevars). Just redefine those vars which you need to alter. Try increasing WEAPON9_TOTALTIME a bit.
0

User is offline   Zaxtor 

#1514

View PostCraigFatman, on 06 October 2014 - 07:55 AM, said:

Lol, I thought you've found the way. All the hard-coded weapon properties are pre-defined game variables (http://wiki.eduke32....efined_gamevars). Just redefine those vars which you need to alter. Try increasing WEAPON9_TOTALTIME a bit.


I checked them already but is a bit confusing.

So I put them onevent?


According to the thing "These pre-defined gamevars may be altered without giving them the standard gamevar definition"
Same as "setvar RETURN x" it works without "gamevar RETURN x x" And is inside onevent.


But dunno where to put to make it work the WEAPON0_TOTALTIME

This post has been edited by Zaxtor: 06 October 2014 - 08:23 AM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1515

Just place it anywhere:

gamevar WEAPON0_TOTALTIME 14 1


This post has been edited by Fox: 06 October 2014 - 09:42 AM

0

User is offline   Zaxtor 

#1516

View PostFox, on 06 October 2014 - 09:42 AM, said:

Just place it anywhere:

gamevar WEAPON0_TOTALTIME 14 1



I placed it or otherwise it says is not a game variable.
I mainly mean the rest.

Cus I know that alone wont do anything.
It will behave like an "ordinary gamevar" that can be used by anything,
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1517

It will replace the default initial value for the pre-existing variable WEAPON0_TOTALTIME.
1

User is offline   Zaxtor 

#1518

It works.

Reason is I put 0 instead of 9.
I'm soo used of 0 (as weapon 10).
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1519

Now I see you mentioned "weapon 10" over there. When you are coding you should forget about the key you use to select weapon, and instead look for the IDs in defs.con:
define KNEE_WEAPON         0
define PISTOL_WEAPON       1
define SHOTGUN_WEAPON      2
define CHAINGUN_WEAPON     3
define RPG_WEAPON          4
define HANDBOMB_WEAPON     5
define SHRINKER_WEAPON     6
define DEVISTATOR_WEAPON   7
define TRIPBOMB_WEAPON     8
define FREEZE_WEAPON       9
define HANDREMOTE_WEAPON   10
define GROW_WEAPON         11

1

User is offline   Zaxtor 

#1520

True.

I made this, Works.

Weapon 0 (9) does diff sound. has a short delay before fireng.

Example

 gamevar WEAPON9_FIRESOUND 643 1
 gamevar WEAPON9_INITIALSOUND 642 1
 gamevar WEAPON9_FIREDELAY 32 1
 gamevar WEAPON9_TOTALTIME 42 1


1 fire sound.
2 (charging) sound.
for the sounds

This post has been edited by Zaxtor: 06 October 2014 - 05:03 PM

0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#1521

You have only just found these things out?
0

User is offline   Hendricks266 

  • Weaponized Autism

  #1522

Had to post this. Sorry Zax. :)

View PostTerminX, on 28 January 2012 - 09:05 AM, said:

Somewhere, something has gone VERY wrong when someone tried to explain to Zaxtor how to write CON files.

0

User is offline   Zaxtor 

#1523

Is confusing.
But now I understand better how it works.
0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#1524

I confusing your post but slowly understand them better.
0

Share this topic:


  • 124 Pages +
  • « First
  • 49
  • 50
  • 51
  • 52
  • 53
  • 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