SOCing action help

Status
Not open for further replies.

lilaj67

What you Lookin at?
I ment to say LUA help
Okay so I'm pretty new to LUA so I need some help on what I should do.
So I have a character I'm creating and I though of a certain power I wanted to have. I wanted my character to leave behind temporary a light trail when he spins; and when he does a homing attack he can leave a temporary trail that enemies can run into how can I create this?
I wanted to make a custom spin or thok item that is light trail item, but another question is how do I hook up a custom spin item to the light trail idea?
I also wanted to know how to make a it where the character can shoot the projectile when I press a certain key?


I would be greatly appreciated! :)
---------- Post added at 02:13 AM ---------- Previous post was at 02:04 AM ----------

Also is there a way to make my character have multiple abilities with spin at the same time
 
Last edited:
You actually don't need Lua for most of that stuff. You probably could use it but it would be a whole lot easier just to use SOC.

I'm gonna assume you wanted both the spin trail and the thok trail to be able to hurt enemies. In that case you're going to need to make a custom object in your character's objctcfg. There won't be too much to it, it'll really only need one state that shows the sprite of the trail. Just make sure you put these flags on it: MF_NOBLOCKMAP|MF_NOGRAVITY|MF_MISSILE

Now the way you actually put it into use is in the s_skin. You'll use the spinitem and thokitem values and set them equal to whatever number or name you give your custom object.

To make a character shoot a projectile you're probably best off looking at the Lua file for Robo-hood as an example, that's what I did. http://mb.srb2.org/showthread.php?t=38219

Also, it's a common misconception, but the multiability you're thinking of does not mean more than one ability. What it does is let you use your ability multiple times in a jump. If you're wanting to make your character have more than one ability you'll use a Lua script very similar to the one you used for shooting.

EDIT: This page will help you get the format for making the custom object: http://wiki.srb2.org/wiki/Object_creation_tutorial/File_structure
 
Last edited:
Thank you for the info, I'll let you know how it goes.

---------- Post added at 01:48 AM ---------- Previous post was at 01:45 AM ----------

You actually don't need Lua for most of that stuff. You probably could use it but it would be a whole lot easier just to use SOC.

I'm gonna assume you wanted both the spin trail and the thok trail to be able to hurt enemies. In that case you're going to need to make a custom object in your character's objctcfg. There won't be too much to it, it'll really only need one state that shows the sprite of the trail. Just make sure you put these flags on it: MF_NOBLOCKMAP|MF_NOGRAVITY|MF_MISSILE

Now the way you actually put it into use is in the s_skin. You'll use the spinitem and thokitem values and set them equal to whatever number or name you give your custom object.

To make a character shoot a projectile you're probably best off looking at the Lua file for Robo-hood as an example, that's what I did. http://mb.srb2.org/showthread.php?t=38219

Also, it's a common misconception, but the multiability you're thinking of does not mean more than one ability. What it does is let you use your ability multiple times in a jump. If you're wanting to make your character have more than one ability you'll use a Lua script very similar to the one you used for shooting.

EDIT: This page will help you get the format for making the custom object: http://wiki.srb2.org/wiki/Object_creation_tutorial/File_structure



But I do have a few other questions, how do I make a custom thok item and how do I link the thok item to the to the soc?
Also what state type should I use to show the sprite and how do I do it? I also want to know how to adjust how many times the sprite appears during a thok, I wanted the interval of the appearance of the sprite to be small so that it looks a bit more like a light dash.

---------- Post added at 02:29 AM ---------- Previous post was at 01:48 AM ----------

You actually don't need Lua for most of that stuff. You probably could use it but it would be a whole lot easier just to use SOC.

I'm gonna assume you wanted both the spin trail and the thok trail to be able to hurt enemies. In that case you're going to need to make a custom object in your character's objctcfg. There won't be too much to it, it'll really only need one state that shows the sprite of the trail. Just make sure you put these flags on it: MF_NOBLOCKMAP|MF_NOGRAVITY|MF_MISSILE

Now the way you actually put it into use is in the s_skin. You'll use the spinitem and thokitem values and set them equal to whatever number or name you give your custom object.

To make a character shoot a projectile you're probably best off looking at the Lua file for Robo-hood as an example, that's what I did. http://mb.srb2.org/showthread.php?t=38219

Also, it's a common misconception, but the multiability you're thinking of does not mean more than one ability. What it does is let you use your ability multiple times in a jump. If you're wanting to make your character have more than one ability you'll use a Lua script very similar to the one you used for shooting.

EDIT: This page will help you get the format for making the custom object: http://wiki.srb2.org/wiki/Object_creation_tutorial/File_structure
So is this a good start?
Code:
State S_PLAY_ABL1 SpriteName = LITE SpriteFrame = A Duration = 5
Flags = MF_NOBLOCKMAP|MF_NOGRAVITY|MF_MISSILE
Which name do I put in the spin item and thok item?
 
Last edited:
But I do have a few other questions, how do I make a custom thok item and how do I link the thok item to the to the soc?
Also what state type should I use to show the sprite and how do I do it? I also want to know how to adjust how many times the sprite appears during a thok, I wanted the interval of the appearance of the sprite to be small so that it looks a bit more like a light dash.

The SOC isn't a separate thing, actually. Where you write out the object is the SOC and it all goes in your wad's objctcfg. You may have figured this out already, but you'll actually making a new state rather than using an existing type.

As for the sprite intervals, I honestly don't know. You'd probably need Lua to do something like that but you might not need to if you make the sprites big enough because I thought standard thok trails already looked pretty solid.

So is this a good start?
Code:
State S_PLAY_ABL1 SpriteName = LITE SpriteFrame = A Duration = 5
Flags = MF_NOBLOCKMAP|MF_NOGRAVITY|MF_MISSILE
Which name do I put in the spin item and thok item?

It's not bad but you should give the state a different name so it won't overwrite the built in one. You can name it anything so long as it starts with S_.

Also remember that you have to have value there even if you're not using it, I'd recommend copy and pasting the example on the wiki and just changing the values. Your state is probably gonna look something like this:

State S_INSERTNAMEHERE
SpriteName = LITE
SpriteFrame = A
Duration = 5
Next = S_INSERTNAMEHERE
Action None

Your object name can be anything so long as it starts with MT_. And that'll be what goes in spin and thokitem.

Also I forgot to mention that you need to declare your custom names at the beginning. All you have to do is type FREESLOT at the beginning followed by all the names like this:

FREESLOT
S_INSERTNAMEHERE
MT_INSERTNAMEHERE
SPR_LITE
 
Okay, so using freeslot allows me to make an object name whatever I want? So does the object name have to be listed inside the soc? Or does freeslot just connect that created object name to the soc automatically?

Wait forget everything I just said I didn't read the full soc so I got confused and thanks so let me test it and I'll tell you how it goes once again. And I'll happily give you credit in the wad for helping me.

---------- Post added at 06:17 AM ---------- Previous post was at 06:13 AM ----------

So the full soc should look like this?

FREESLOT
S_LIGHT
MT_LIGHT
SPR_LITE
State S_LIGHT
SpriteName = LITE
SpriteFrame = A
Duration = 5
Next = S_INSERTNAMEHERE
Action None
 
That's only part of it actually. You have the state there but you need the actual object, the block on the wiki page that looks like this:

Object
MapThingNum =
SpawnState =
SpawnHealth =
SeeState =
SeeSound =
ReactionTime =
AttackSound =
PainState =
PainChance =
PainSound =
MeleeState =
MissileState =
DeathState =
XDeathState =
DeathSound =
Speed =
Radius =
Height =
DispOffset =
Mass =
Damage =
ActiveSound =
Flags =
RaiseState =

A lot of those values will probably be able to be set to 0, but that's where you'll put the flags we mentioned earlier and the SpawnState is gonna be that state you just made.

FREESLOT
S_LIGHT
MT_LIGHT
SPR_LITE
State S_LIGHT
SpriteName = LITE
SpriteFrame = A
Duration = 5
Next = S_INSERTNAMEHERE
Action None

Also change Next to the state name and just to be safe we'll put a space between the freeslot block and the state.

FREESLOT
S_LIGHT
MT_LIGHT
SPR_LITE

State S_LIGHT
SpriteName = LITE
SpriteFrame = A
Duration = 5
Next = S_LIGHT
Action None
 
So should it look like this?

FREESLOT
S_LIGHT
MT_LIGHT
SPR_LITE

State S_LIGHT
SpriteName = LITE
SpriteFrame = A
Duration = 5
Next = S_LIGHT
Action None

Object MT_LIGHT
MapThingNum = 0
SpawnState = S_LIGHT
SpawnHealth = 0
SeeState = S_NULL
SeeSound = sfx_none
ReactionTime = 15
AttackSound = sfx_none
PainState = S_NULL
PainChance = 0
PainSound = sfx_none
MeleeState =
MissileState = 0
Duration = 3
DeathState = 0
XDeathState = S_NULL
DeathSound = sfx_none
Speed = 2
Radius = 15
Height = 0
DispOffset = 0
Mass = 0
Damage = 0
ActiveSound = 0
Flags = MF_NOBLOCKMAP|MF_NOGRAVITY|MF_MISSILE
RaiseState = S_NULL


And do I name my sprite that I want to use as my thok item the name that I gave it? (SPR_LITE) or do I name it A6 because of the sprite frame I chose?

---------- Post added at 04:54 AM ---------- Previous post was at 03:06 AM ----------

The soc didn't work, so what I did with the sprite name is I named is PLAYA6, and the thok item and spin item I set to MT_LIGHT, but the sprite isn't showing up and the object isn't hurting enemies behind me when I spin or thok?
What's going on?
 
Last edited:
The sprite isn't working because it shouldn't be called PLAYA6, it should be called LITEA0. Because you told it to use frame A of the sprite named LITE.

As for why it's not hurting enemies, the height and radius could be part of the problem. That's what sets the 'physical' size of the object. For now lets just try making them both 65536.

Also put S_NULL or something in the MeleeState blank, I don't know if it likes it being empty.
 
The sprite isn't working because it shouldn't be called PLAYA6, it should be called LITEA0. Because you told it to use frame A of the sprite named LITE.

As for why it's not hurting enemies, the height and radius could be part of the problem. That's what sets the 'physical' size of the object. For now lets just try making them both 65536.

Also put S_NULL or something in the MeleeState blank, I don't know if it likes it being empty.
This is the updated script with some fixed problems

FREESLOT
S_LIGHT
MT_LIGHT
SPR_LITE

State S_LIGHT
SpriteName = LITE
SpriteFrame = A
Duration = 5
Next = S_LIGHT
Action None

Object MT_LIGHT
MapThingNum = 0
SpawnState = S_LIGHT
SpawnHealth = -16578
SeeState = S_NULL
SeeSound = sfx_none
ReactionTime = 0
AttackSound = sfx_none
PainState = S_NULL
PainChance = 0
PainSound = sfx_none
MeleeState = S_NULL
MissileState = S_NULL
DeathState = S_NULL
XDeathState = S_NULL
DeathSound = sfx_none
Speed = 1500
Radius = 65536
Height = 65536
DispOffset = 0
Mass = 0
Damage = 0
ActiveSound = 0
Flags = MF_NOBLOCKMAP|MF_NOGRAVITY|MF_MISSILE
RaiseState = S_NULL


It's still not working after I changes the sprite name and everything I don't really see why it's doing this even after I fixed many parts of the script.

Here's the link to the wad so you can see what's wrong with it
http://www.mediafire.com/download/g3guj4jh8aj4qji/Cadrono.wad
 
Last edited:
It looks like the main problem is that in the S_SKIN you had the thok and spin items set to MT_THOK instead of your object, MT_LIGHT. When I did that the SOC seemed to be working perfectly, it left a trail and when the crawlas ran into it they were killed.

You also need to put a # on the next line under your PlayerText to separate it from the SOC code.
 
Never mind, I fixed that problem myself.

So now that I have my object set up and working, I want to know one more thing. You know how when two ring tosses collide and the screen flashes and goes BOOM. How do I make it do that upon collision with an enemy?
I shouldn't need as much help with this as I did before now that I know the soc language a bit more.

As for the shooting thing I want to know if there's a way to shoot a projectile by pressing the ring toss button, like Mario mode's flower power.
 
Last edited:
Ring tosses don't actually do that... The only thing that makes an explosion like you're describing is an armageddon shield, but I'm really not sure that you can separate the explosion from the shield itself or apply it to anything other than the player.

But what you might be able to do is use the A_Explode action. For that you'd probably need to set SpawnHealth to something so the object can be destroyed, then set DeathState to another new state that uses the A_Explode action. The Damage blank will determine the range of the explosion.

As for the projectiles, I haven't yet figured out a way to do that with SOCs, it'd probably be easier to use the Lua script I referred you to earlier. (The Robo-hood one). You should be able to use that script but just change the button to the ring toss button and the projectile (which I think is currently set to MT_ARROW) to whatever you want.
 
So do I create another object for that or do I just add the action into my already made thokitem/spinitem object?
 
Yeah you're adding it to your already made object. Since you want your trail to explode, right? You're just going to add another paragraph under your state S_LIGHT one that makes a new state for the explosion. Then you'll edit your object paragraph to put that state as the DeathState. Don't forget to declare the state in the FREESLOT section too.
 
So I finally know what I want him to do.
Is there any way I can make him thok and have two items at once?
You know how the explosion ring has an explosion of sparks and plays the "doosh" sound effect? What I'm trying to do is make it to where his thokitem shows the explosion each time the MT_Light object apprears. Is there a way I can do this without using lua?

So can I do the same with flags as I do with states? like this: S_EXAMPLE|S_EXAMPLE
 
Last edited:
No. If you want to spawn two items, you can make one item spawn the other.

What is the way I do that?
Deathstate really doesn't work because I can't get my thok item to die in the first place, otherwise the death state I could use to spawn an object with an object.
So How do I make it die?
 
Make S_LIGHT go to another state (S_LIGHT2 or whatever), and then spawn the second object in that state. S_LIGHT2 should have an infinite duration so that the object doesn't spawn more than once.
 
Make S_LIGHT go to another state (S_LIGHT2 or whatever), and then spawn the second object in that state. S_LIGHT2 should have an infinite duration so that the object doesn't spawn more than once.
Should the second object be spawned in side of the "NEXT" tab in the state like this?

State S_LIGHT2
SpriteName = NULL
SpriteFrame = 0
Next = S_LIGHT
Action None
 
"Next" indicates the next state (which is irrelevant in your case because the state is supposed to have an infinite duration). You want to spawn an object.

Actually, come to think of it, you only want to replicate the bomb ring explosion, so it should suffice to use A_RingExplode as an action in this state.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top