Oshigawa
Full Member
Posts: 228
Posts: 228
|
Post by Oshigawa on Jun 18, 2017 14:07:09 GMT
Hello,
i noticed there's CGKT variable int and float add and multiply operators available as custom playmaker actions, but there's no subtract, any chance of adding those? I can use add then use negative value, but i can't use variables that way.
|
|
|
Post by DarkTonic Dev on Jun 18, 2017 18:02:33 GMT
To do subtract, you add a negative int. We don't need to create this, you can already do it.
|
|
Oshigawa
Full Member
Posts: 228
Posts: 228
|
Post by Oshigawa on Jun 18, 2017 19:49:24 GMT
Yeah, but i can't do that if i'm using variables. For example, each enemy that appears adds a value to a variable, and when it is destroyed/leaves screen it subtracts that value. That means i use a variable for adding, and i have to subtract by manually entering the numner, which is kinda not handy.
I can subtract when the enemy is destroyed via killable, but does it count as "destroyed" when it despawns on leaving screen? I reckon not, what should i use in the "Else If" field for modifying a variable when it is despawned?
|
|
|
Post by DarkTonic Dev on Jun 18, 2017 20:22:41 GMT
I don't understand what you mean, your first sentence. Give me a full detailed example.
"Despawned" has nothing in the UI for modifying World Variables, you are correct. Only if Destroyed. The other alternate "else if" scenarios can only be utilized from code you write, in a KillableListener usually. So call it whatever you like.
|
|
Oshigawa
Full Member
Posts: 228
Posts: 228
|
Post by Oshigawa on Jun 18, 2017 20:55:28 GMT
Oh, ok. I have a wave generation system which works the following way. Few enemies spawn and each of them has a certain int value (smaller value for easier enemies, bigger for tougher ones) which is added to the "enemy pool" when they spawn. When the enemy is destroyed or leaves the screen, that same value is subtracted from the "enemy pool". After a few seconds, a check is done, if the pool is not full, some more enemies are added until the pool is full. Rinse and repeat. Kind of a self-adjusting difficulty mechanism. The "enemy pool" is actually just an integer variable with a progressively increasing threshold which says "no more spawning".
Destruction is easy to handle via killable, but despawn is not. So it comes down to two solutions:
1) Use two variables for each enemy value, one positive for use in killable, and one negative for usage with playmaker action.
2) Use only one positive variable for use in killable, and manually enter the negative value in the playmaker action in the despawn state.
You'll agree that both solutions are impractical when it comes to tweaking a large number of variables for nailing the gameplay.
|
|
|
Post by DarkTonic Dev on Jun 18, 2017 23:23:52 GMT
Ultimately, you would probably want to write a subclass of Killable. Not sure how you can handle the first number otherwise (the int that gets added when it gets spawned) without manually entering that in Playmaker otherwise.
If you want despawned and destroyed to act the same, this would probably work:
1) Add a KillablePlaymakerListener to your Killable. 2) Go in your FSM for the Killable and find or create an event that will transition to a state when the Killable is destroyed / despawned. 3) in the Listener from step 1, find the Despawning event and select your FSM if it's not already. Then select the event from step 2. 4) In your FSM state that will be hit from that event, check if the Killable's "IsDead" property is false. If it's true, you need do nothing. Your Death World Variable Modifiers will happen if you've set them up. If it is false, destroy the killable with the Core GameKit Destroy Killable action. That should do it. Not positive if it will work though.
|
|
|
Post by DarkTonic Dev on Jun 18, 2017 23:28:58 GMT
Other things that may help:
You can definitely in Playmaker create a copy of another variable and multiply it by -1 to get the negative version to use for whatever. Which you could use for your original question.
|
|
Oshigawa
Full Member
Posts: 228
Posts: 228
|
Post by Oshigawa on Jun 20, 2017 16:39:24 GMT
Yeah, i guess that's the best thing i can do. Thanks for the help
|
|
|
Post by DarkTonic Dev on Jun 20, 2017 19:01:13 GMT
No problem.
|
|